updated mod queue

This commit is contained in:
albert
2011-10-26 18:16:29 -04:00
parent a536a2699b
commit 0229dbc711
9 changed files with 50 additions and 14 deletions

View File

@@ -0,0 +1,24 @@
(function() {
Danbooru.ModQueue = {};
Danbooru.ModQueue.initialize_approve_all_button = function(e) {
$("#c-moderator-post-queues #approve-all-button").click(function() {
$(".approve-link").trigger("click");
});
e.preventDefault();
}
Danbooru.ModQueue.initialize_hide_all_button = function(e) {
$("#c-moderator-post-queues #hide-all-button").click(function() {
$(".disapprove-link").trigger("click");
});
e.preventDefault();
}
})();
$(function() {
Danbooru.ModQueue.initialize_approve_all_button();
Danbooru.ModQueue.initialize_hide_all_button();
});

View File

@@ -9,6 +9,8 @@ div#c-moderator-post-queues {
aside { aside {
float: left; float: left;
width: 520px; width: 520px;
text-align: right;
padding-right: 20px;
} }
section { section {

View File

@@ -5,7 +5,7 @@ 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.search(:tag_match => params[:query]) @search = ::Post.order("id asc").pending_or_flagged.available_for_moderation(params[:hidden]).search(:tag_match => params[:query])
@posts = @search.paginate(params[:page]) @posts = @search.paginate(params[:page])
respond_with(@posts) respond_with(@posts)
end end

View File

@@ -41,7 +41,7 @@ class Post < ActiveRecord::Base
scope :commented_before, lambda {|date| where("last_commented_at < ?", date).order("last_commented_at DESC")} scope :commented_before, lambda {|date| where("last_commented_at < ?", date).order("last_commented_at DESC")}
scope :has_notes, where("last_noted_at is not null") scope :has_notes, where("last_noted_at is not null")
scope :for_user, lambda {|user_id| where(["uploader_id = ?", user_id])} scope :for_user, lambda {|user_id| where(["uploader_id = ?", user_id])}
scope :available_for_moderation, lambda {where(["id NOT IN (SELECT pd.post_id FROM post_disapprovals pd WHERE pd.user_id = ?)", CurrentUser.id])} scope :available_for_moderation, lambda {|hidden| hidden.present? ? where(["id NOT IN (SELECT pd.post_id FROM post_disapprovals pd WHERE pd.user_id = ?)", CurrentUser.id]) : where(["id NOT IN (SELECT pd.post_id FROM post_disapprovals pd WHERE pd.user_id = ?)", CurrentUser.id])}
scope :hidden_from_moderation, lambda {where(["id IN (SELECT pd.post_id FROM post_disapprovals pd WHERE pd.user_id = ?)", CurrentUser.id])} scope :hidden_from_moderation, lambda {where(["id IN (SELECT pd.post_id FROM post_disapprovals pd WHERE pd.user_id = ?)", CurrentUser.id])}
scope :tag_match, lambda {|query| Post.tag_match_helper(query)} scope :tag_match, lambda {|query| Post.tag_match_helper(query)}
scope :exact_tag_match, lambda {|query| Post.exact_tag_match_helper(query)} scope :exact_tag_match, lambda {|query| Post.exact_tag_match_helper(query)}

View File

@@ -1,7 +1,7 @@
class PostDisapproval < ActiveRecord::Base class PostDisapproval < ActiveRecord::Base
belongs_to :post belongs_to :post
belongs_to :user belongs_to :user
validates_uniqueness_of :post_id, :scope => [:user_id] validates_uniqueness_of :post_id, :scope => [:user_id], :message => "have already hidden this post"
def self.prune! def self.prune!
joins(:post).where("posts.is_pending = FALSE AND posts.is_flagged = FALSE").each do |post_disapproval| joins(:post).where("posts.is_pending = FALSE AND posts.is_flagged = FALSE").each do |post_disapproval|

View File

@@ -10,7 +10,7 @@ $("#c-posts #flag").show();
$("#pending-approval-notice").hide(); $("#pending-approval-notice").hide();
$("#c-post-moderation #post-<%= @post.id %>").hide(); $("#c-moderator-post-queues #post-<%= @post.id %>").hide();
Danbooru.notice("Post was approved"); Danbooru.notice("Post was approved");
<% end %> <% end %>

View File

@@ -9,7 +9,7 @@ $("#c-posts #disapprove").hide();
$("#pending-approval-notice").hide(); $("#pending-approval-notice").hide();
$("#c-post-moderation #post-<%= @post.id %>").hide(); $("#c-moderator-post-queues #post-<%= @post.id %>").hide();
Danbooru.notice("Post was disapproved"); Danbooru.notice("Post was hidden");
<% end %> <% end %>

View File

@@ -32,18 +32,25 @@
<section> <section>
<ul> <ul>
<li><%= link_to "Approve", moderator_post_approval_path(:post_id => post.id), :remote => true, :method => :post %> | <%= link_to "Disapprove", moderator_post_disapproval_path(:post_id => post.id), :remote => true, :method => :post %></li> <li><h2><%= link_to "Approve", moderator_post_approval_path(:post_id => post.id), :remote => true, :method => :post, :class => "approve-link" %> | <%= link_to "Hide", moderator_post_disapproval_path(:post_id => post.id), :remote => true, :method => :post, :class => 'disapprove-link' %></h2></li>
<li>Rating: <%= post.rating %></li> <li><strong>Rating</strong>: <%= post.pretty_rating %></li>
<li>Score: <%= post.score %></li> <li><strong>Score</strong>: <%= post.score %></li>
<li>Uploader: <%= link_to(post.uploader.name, user_path(post.uploader_id)) %> <%= time_ago_in_words(post.created_at) %> ago</li> <li>
<strong>Size:</strong>
<%= number_to_human_size(post.file_size) %>
<% if post.is_image? %>
(<%= post.image_width %>x<%= post.image_height %>)
<% end %>
</li>
<li><strong>Uploader</strong>: <%= link_to(post.uploader.name, user_path(post.uploader_id)) %> <%= time_ago_in_words(post.created_at) %> ago</li>
<% if post.is_flagged? %> <% if post.is_flagged? %>
<li>Flagged: <%= post_flag_reason(post) %></li> <li><strong>Flagged</strong>: <%= post_flag_reason(post) %></li>
<% end %> <% end %>
<% if (post.is_flagged? || post.is_deleted?) && post.appeals.any? %> <% if (post.is_flagged? || post.is_deleted?) && post.appeals.any? %>
<li>Appeals: <%= post_appeal_reason(post) %></li> <li><strong>Appeals</strong>: <%= post_appeal_reason(post) %></li>
<% end %> <% end %>
<li>Disapprovals: <%= post.disapprovals.count %></li> <li><strong>Hidden</strong>: <%= post.disapprovals.count %></li>
<li>Tags: <%= post.tag_string %></li> <li><strong>Tags</strong>: <%= post.tag_string %></li>
</ul> </ul>
</section> </section>
</article> </article>

View File

@@ -17,3 +17,6 @@ en:
post_appeal: post_appeal:
creator: "You" creator: "You"
creator_id: "You" creator_id: "You"
post_disapproval:
post: "You"
post_id: "You"