forked from e621ng/e621ng
updated mod queue
This commit is contained in:
parent
a536a2699b
commit
0229dbc711
24
app/assets/javascripts/mod_queue.js
Normal file
24
app/assets/javascripts/mod_queue.js
Normal 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();
|
||||
});
|
@ -9,6 +9,8 @@ div#c-moderator-post-queues {
|
||||
aside {
|
||||
float: left;
|
||||
width: 520px;
|
||||
text-align: right;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
section {
|
||||
|
@ -5,7 +5,7 @@ module Moderator
|
||||
before_filter :janitor_only
|
||||
|
||||
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])
|
||||
respond_with(@posts)
|
||||
end
|
||||
|
@ -41,7 +41,7 @@ class Post < ActiveRecord::Base
|
||||
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 :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 :tag_match, lambda {|query| Post.tag_match_helper(query)}
|
||||
scope :exact_tag_match, lambda {|query| Post.exact_tag_match_helper(query)}
|
||||
|
@ -1,7 +1,7 @@
|
||||
class PostDisapproval < ActiveRecord::Base
|
||||
belongs_to :post
|
||||
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!
|
||||
joins(:post).where("posts.is_pending = FALSE AND posts.is_flagged = FALSE").each do |post_disapproval|
|
||||
|
@ -10,7 +10,7 @@ $("#c-posts #flag").show();
|
||||
|
||||
$("#pending-approval-notice").hide();
|
||||
|
||||
$("#c-post-moderation #post-<%= @post.id %>").hide();
|
||||
$("#c-moderator-post-queues #post-<%= @post.id %>").hide();
|
||||
Danbooru.notice("Post was approved");
|
||||
|
||||
<% end %>
|
@ -9,7 +9,7 @@ $("#c-posts #disapprove").hide();
|
||||
|
||||
$("#pending-approval-notice").hide();
|
||||
|
||||
$("#c-post-moderation #post-<%= @post.id %>").hide();
|
||||
Danbooru.notice("Post was disapproved");
|
||||
$("#c-moderator-post-queues #post-<%= @post.id %>").hide();
|
||||
Danbooru.notice("Post was hidden");
|
||||
|
||||
<% end %>
|
@ -32,18 +32,25 @@
|
||||
|
||||
<section>
|
||||
<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>Rating: <%= post.rating %></li>
|
||||
<li>Score: <%= 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><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><strong>Rating</strong>: <%= post.pretty_rating %></li>
|
||||
<li><strong>Score</strong>: <%= post.score %></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? %>
|
||||
<li>Flagged: <%= post_flag_reason(post) %></li>
|
||||
<li><strong>Flagged</strong>: <%= post_flag_reason(post) %></li>
|
||||
<% end %>
|
||||
<% 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 %>
|
||||
<li>Disapprovals: <%= post.disapprovals.count %></li>
|
||||
<li>Tags: <%= post.tag_string %></li>
|
||||
<li><strong>Hidden</strong>: <%= post.disapprovals.count %></li>
|
||||
<li><strong>Tags</strong>: <%= post.tag_string %></li>
|
||||
</ul>
|
||||
</section>
|
||||
</article>
|
||||
|
@ -17,3 +17,6 @@ en:
|
||||
post_appeal:
|
||||
creator: "You"
|
||||
creator_id: "You"
|
||||
post_disapproval:
|
||||
post: "You"
|
||||
post_id: "You"
|
Loading…
Reference in New Issue
Block a user