add hilighting to mod queue

This commit is contained in:
albert
2013-02-22 15:47:36 -05:00
parent 85a832cb5d
commit 26b5f3091c
5 changed files with 41 additions and 4 deletions

View File

@@ -22,11 +22,31 @@
e.preventDefault(); 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() { $(function() {
if ($("#c-moderator-post-queues").length) { if ($("#c-moderator-post-queues").length) {
Danbooru.ModQueue.initialize_approve_all_button(); Danbooru.ModQueue.initialize_approve_all_button();
Danbooru.ModQueue.initialize_hide_all_button(); Danbooru.ModQueue.initialize_hide_all_button();
Danbooru.ModQueue.initialize_hilights();
} }
}); });

View File

@@ -6,6 +6,18 @@ div#c-moderator-post-queues {
overflow: hidden; 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 { aside {
float: left; float: left;
width: 220px; width: 220px;

View File

@@ -5,8 +5,9 @@ module Moderator
before_filter :janitor_only before_filter :janitor_only
def show def show
@search = ::Post.order("id asc").pending_or_flagged.available_for_moderation(params[:hidden]).search(:tag_match => "#{params[:query]} status:any") ::Post.without_timeout do
@posts = @search.paginate(params[:page]) @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) respond_with(@posts)
end end
end end

View File

@@ -426,6 +426,10 @@ class Post < ActiveRecord::Base
tag_string =~ /(?:^| )#{tag}(?:$| )/ tag_string =~ /(?:^| )#{tag}(?:$| )/
end end
def has_dup_tag?
has_tag?("duplicate") ? true : false
end
def tag_categories def tag_categories
@tag_categories ||= Tag.categories_for(tag_array) @tag_categories ||= Tag.categories_for(tag_array)
end end

View File

@@ -13,7 +13,7 @@
<div id="moderation-guideline"> <div id="moderation-guideline">
<h1>Deletion Guidelines</h1> <h1>Deletion Guidelines</h1>
<p> <p>
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] %> <% if params[:hidden] %>
<%= link_to "View pending posts", moderator_post_queue_path(:query => params[:query], :hidden => nil) %>. <%= link_to "View pending posts", moderator_post_queue_path(:query => params[:query], :hidden => nil) %>.
<% else %> <% else %>
@@ -25,7 +25,7 @@
</div> </div>
<% @posts.each do |post| %> <% @posts.each do |post| %>
<article id="post-<%= post.id %>"> <article class="post" id="post-<%= post.id %>" data-score="<%= post.score %>" data-has-children="<%= post.has_children? %>" data-has-dup="<%= post.has_dup_tag? %>">
<aside> <aside>
<%= link_to(image_tag(post.preview_file_url), post_path(post)) %> <%= link_to(image_tag(post.preview_file_url), post_path(post)) %>
</aside> </aside>