From 26b5f3091ce8824b0ae5b45576df48484c6a3863 Mon Sep 17 00:00:00 2001 From: albert Date: Fri, 22 Feb 2013 15:47:36 -0500 Subject: [PATCH] add hilighting to mod queue --- app/assets/javascripts/mod_queue.js | 20 +++++++++++++++++++ .../stylesheets/specific/mod_queue.css.scss | 12 +++++++++++ .../moderator/post/queues_controller.rb | 5 +++-- app/models/post.rb | 4 ++++ app/views/moderator/post/queues/show.html.erb | 4 ++-- 5 files changed, 41 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/mod_queue.js b/app/assets/javascripts/mod_queue.js index 0f7d4fe03..e3f2fd6fc 100644 --- a/app/assets/javascripts/mod_queue.js +++ b/app/assets/javascripts/mod_queue.js @@ -22,11 +22,31 @@ e.preventDefault(); }); } + + Danbooru.ModQueue.initialize_hilights = function() { + $.each($("article.post"), function(i, v) { + var $post = $(v); + var score = parseInt($post.data("score")); + if (score >= 3) { + $post.addClass("post-pos-score"); + } + if (score <= -3) { + $post.addClass("post-neg-score"); + } + if ($post.data("has-children")) { + $post.addClass("post-has-children"); + } + if ($post.data("has-dup")) { + $post.addClass("post-has-dup"); + } + }); + } })(); $(function() { if ($("#c-moderator-post-queues").length) { Danbooru.ModQueue.initialize_approve_all_button(); Danbooru.ModQueue.initialize_hide_all_button(); + Danbooru.ModQueue.initialize_hilights(); } }); diff --git a/app/assets/stylesheets/specific/mod_queue.css.scss b/app/assets/stylesheets/specific/mod_queue.css.scss index d6c49db06..cd47533d6 100644 --- a/app/assets/stylesheets/specific/mod_queue.css.scss +++ b/app/assets/stylesheets/specific/mod_queue.css.scss @@ -6,6 +6,18 @@ div#c-moderator-post-queues { overflow: hidden; } + article.post-has-dup { + background: rgb(255, 255, 100); + } + + article.post-neg-score { + background: rgb(255, 230, 230); + } + + article.post-pos-score { + background: rgb(230, 255, 230); + } + aside { float: left; width: 220px; diff --git a/app/controllers/moderator/post/queues_controller.rb b/app/controllers/moderator/post/queues_controller.rb index 06eff5c52..d631b0a8f 100644 --- a/app/controllers/moderator/post/queues_controller.rb +++ b/app/controllers/moderator/post/queues_controller.rb @@ -5,8 +5,9 @@ module Moderator before_filter :janitor_only def show - @search = ::Post.order("id asc").pending_or_flagged.available_for_moderation(params[:hidden]).search(:tag_match => "#{params[:query]} status:any") - @posts = @search.paginate(params[:page]) + ::Post.without_timeout do + @posts = ::Post.order("id asc").pending_or_flagged.available_for_moderation(params[:hidden]).search(:tag_match => "#{params[:query]} status:any").paginate(params[:page]) + end respond_with(@posts) end end diff --git a/app/models/post.rb b/app/models/post.rb index 8cf3f3a2b..d22eafa32 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -426,6 +426,10 @@ class Post < ActiveRecord::Base tag_string =~ /(?:^| )#{tag}(?:$| )/ end + def has_dup_tag? + has_tag?("duplicate") ? true : false + end + def tag_categories @tag_categories ||= Tag.categories_for(tag_array) end diff --git a/app/views/moderator/post/queues/show.html.erb b/app/views/moderator/post/queues/show.html.erb index 8cd528975..cefd5320b 100644 --- a/app/views/moderator/post/queues/show.html.erb +++ b/app/views/moderator/post/queues/show.html.erb @@ -13,7 +13,7 @@

Deletion Guidelines

- As a general rule, you should only approve of posts that you personally like. Posts that are not approved in three days will be automatically deleted. Posts with score -3 or lower are marked red. Posts with score 3 or higher are marked green. + As a general rule, you should only approve of posts that you personally like. Posts that are not approved in three days will be automatically deleted. Posts with score -3 or lower are marked red. Posts with score 3 or higher are marked green. Posts with the duplicate tag are marked in yellow. <% if params[:hidden] %> <%= link_to "View pending posts", moderator_post_queue_path(:query => params[:query], :hidden => nil) %>. <% else %> @@ -25,7 +25,7 @@

<% @posts.each do |post| %> -
+