Merge pull request #3126 from evazion/feat-queue-pools

Fix #3125: Show pools in mod queue
This commit is contained in:
Albert Yi
2017-06-08 14:13:44 -07:00
committed by GitHub
6 changed files with 64 additions and 80 deletions

View File

@@ -81,3 +81,11 @@ div#c-pool-orders, div#c-favorite-group-orders {
}
}
}
ul.inline-pool-list {
display: inline;
li {
display: inline;
}
}

View File

@@ -1031,11 +1031,16 @@ class Post < ActiveRecord::Base
module PoolMethods
def pools
@pools ||= begin
return Pool.none if pool_string.blank?
pool_ids = pool_string.scan(/\d+/)
Pool.where(["is_deleted = false and id in (?)", pool_ids])
Pool.undeleted.where(id: pool_ids).series_first
end
end
def has_active_pools?
pools.length > 0
end
def belongs_to_pool?(pool)
pool_string =~ /(?:\A| )pool:#{pool.id}(?:\Z| )/
end

View File

@@ -0,0 +1,43 @@
<div id="post-<%= post.id %>" class="post mod-queue-preview <%= PostPresenter.preview_class(post) %>" <%= PostPresenter.data_attributes(post) %>>
<aside>
<%= link_to(image_tag(post.preview_file_url), post_path(post), :target => "_blank") %>
</aside>
<section>
<ul>
<li>
<h2>
<%= link_to "Approve", moderator_post_approval_path(:post_id => post.id), :remote => true, :method => :post, :class => "approve-link" %>
| <%= link_to "Breaks Rules", moderator_post_disapproval_path(:post_id => post.id, :reason => "breaks_rules"), :remote => true, :method => :post, :class => "disapprove-link" %>
| <%= link_to "Poor Quality", moderator_post_disapproval_path(:post_id => post.id, :reason => "poor_quality"), :remote => true, :method => :post, :class => "disapprove-link" %>
| <%= link_to "No Interest", moderator_post_disapproval_path(:post_id => post.id, :reason => "disinterest"), :remote => true, :method => :post, :class => "disapprove-link" %>
| <%= link_to "Detailed Rejection", "#", "data-post-id" => post.id, :class => "detailed-rejection-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.has_dimensions? %>
(<%= post.image_width %>x<%= post.image_height %>)
<% end %>
</li>
<li><strong>Uploader</strong>: <%= link_to_user(post.uploader) %> <%= time_ago_in_words_tagged(post.created_at) %></li>
<% if post.is_flagged? %>
<li><strong>Flagged</strong>: <%= post_flag_reasons(post) %></li>
<% end %>
<% if (post.is_flagged? || post.is_deleted?) && post.appeals.any? %>
<li><strong>Appeals</strong>: <%= post_appeal_reasons(post) %></li>
<% end %>
<li>
<strong>Hidden</strong>: <%= render "post_disapprovals/compact_counts", :disapprovals => post.disapprovals, :post => post %>
</li>
<li><strong>Source</strong>: <%= post.source %></li>
<% if post.has_active_pools? %>
<li><strong>Pools</strong>: <%= render "pools/inline_list", pools: post.pools %></li>
<% end %>
<li><strong>Tags</strong>: <%= post.presenter.inline_tag_list_html(self) %></li>
</ul>
</section>
</div>

View File

@@ -13,45 +13,7 @@
</div>
<% @posts.each do |post| %>
<div id="post-<%= post.id %>" class="post mod-queue-preview <%= PostPresenter.preview_class(post) %>" <%= PostPresenter.data_attributes(post) %>>
<aside>
<%= link_to(image_tag(post.preview_file_url), post_path(post), :target => "_blank") %>
</aside>
<section>
<ul>
<li>
<h2>
<%= link_to "Approve", moderator_post_approval_path(:post_id => post.id), :remote => true, :method => :post, :class => "approve-link" %>
| <%= link_to "Breaks Rules", moderator_post_disapproval_path(:post_id => post.id, :reason => "breaks_rules"), :remote => true, :method => :post, :class => "disapprove-link" %>
| <%= link_to "Poor Quality", moderator_post_disapproval_path(:post_id => post.id, :reason => "poor_quality"), :remote => true, :method => :post, :class => "disapprove-link" %>
| <%= link_to "No Interest", moderator_post_disapproval_path(:post_id => post.id, :reason => "disinterest"), :remote => true, :method => :post, :class => "disapprove-link" %>
| <%= link_to "Detailed Rejection", "#", "data-post-id" => post.id, :class => "detailed-rejection-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.has_dimensions? %>
(<%= post.image_width %>x<%= post.image_height %>)
<% end %>
</li>
<li><strong>Uploader</strong>: <%= link_to_user(post.uploader) %> <%= time_ago_in_words_tagged(post.created_at) %></li>
<% if post.is_flagged? %>
<li><strong>Flagged</strong>: <%= post_flag_reasons(post) %></li>
<% end %>
<% if (post.is_flagged? || post.is_deleted?) && post.appeals.any? %>
<li><strong>Appeals</strong>: <%= post_appeal_reasons(post) %></li>
<% end %>
<li>
<strong>Hidden</strong>: <%= render "post_disapprovals/compact_counts", :disapprovals => post.disapprovals, :post => post %>
</li>
<li><strong>Tags</strong>: <%= post.tag_string %></li>
</ul>
</section>
</div>
<%= render "post", post: post %>
<% end %>
</div>
</div>

View File

@@ -24,46 +24,7 @@
</div>
<% @posts.each do |post| %>
<div id="post-<%= post.id %>" class="post mod-queue-preview <%= PostPresenter.preview_class(post) %>" <%= PostPresenter.data_attributes(post) %>>
<aside>
<%= link_to(image_tag(post.preview_file_url), post_path(post), :target => "_blank") %>
</aside>
<section>
<ul>
<li>
<h2>
<%= link_to "Approve", moderator_post_approval_path(:post_id => post.id), :remote => true, :method => :post, :class => "approve-link" %>
| <%= link_to "Breaks Rules", moderator_post_disapproval_path(:post_id => post.id, :reason => "breaks_rules"), :remote => true, :method => :post, :class => "disapprove-link" %>
| <%= link_to "Poor Quality", moderator_post_disapproval_path(:post_id => post.id, :reason => "poor_quality"), :remote => true, :method => :post, :class => "disapprove-link" %>
| <%= link_to "No Interest", moderator_post_disapproval_path(:post_id => post.id, :reason => "disinterest"), :remote => true, :method => :post, :class => "disapprove-link" %>
| <%= link_to "Detailed Rejection", "#", "data-post-id" => post.id, :class => "detailed-rejection-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.has_dimensions? %>
(<%= post.image_width %>x<%= post.image_height %>)
<% end %>
</li>
<li><strong>Uploader</strong>: <%= link_to_user(post.uploader) %> <%= time_ago_in_words_tagged(post.created_at) %></li>
<% if post.is_flagged? %>
<li><strong>Flagged</strong>: <%= post_flag_reasons(post) %></li>
<% end %>
<% if (post.is_flagged? || post.is_deleted?) && post.appeals.any? %>
<li><strong>Appeals</strong>: <%= post_appeal_reasons(post) %></li>
<% end %>
<li>
<strong>Hidden</strong>: <%= render "post_disapprovals/compact_counts", :disapprovals => post.disapprovals, :post => post %>
</li>
<li><strong>Source</strong>: <%= post.source %></li>
<li><strong>Tags</strong>: <%= post.presenter.inline_tag_list_html(self) %></li>
</ul>
</section>
</div>
<%= render "post", post: post %>
<% end %>
</div>

View File

@@ -0,0 +1,5 @@
<ul class="inline-pool-list">
<% pools.each do |pool| %>
<li><%= link_to pool.pretty_name, pool, :class => "pool-category-#{pool.category}" %></li>
<% end %>
</ul>