fixes #2453: Customize per page pagination limit for mod queue
This commit is contained in:
@@ -5,12 +5,22 @@ module Moderator
|
|||||||
before_filter :post_approvers_only
|
before_filter :post_approvers_only
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
if params[:per_page]
|
||||||
|
session["mq_per_page"] = params[:per_page]
|
||||||
|
end
|
||||||
|
|
||||||
::Post.without_timeout do
|
::Post.without_timeout do
|
||||||
@posts = ::Post.order("posts.id asc").pending_or_flagged.available_for_moderation(params[:hidden]).search(:tag_match => "#{params[:query]} status:any").paginate(params[:page], :limit => 25)
|
@posts = ::Post.order("posts.id asc").pending_or_flagged.available_for_moderation(params[:hidden]).search(:tag_match => "#{params[:query]} status:any").paginate(params[:page], :limit => per_page)
|
||||||
@posts.each # hack to force rails to eager load
|
@posts.each # hack to force rails to eager load
|
||||||
end
|
end
|
||||||
respond_with(@posts)
|
respond_with(@posts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def per_page
|
||||||
|
session["mq_per_page"] || params[:per_page] || 25
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
<div id="c-moderator-post-queues">
|
<div id="c-moderator-post-queues">
|
||||||
<div id="a-show">
|
<div id="a-show">
|
||||||
<div id="search">
|
|
||||||
<%= form_tag(moderator_post_queue_path, :method => :get) do %>
|
|
||||||
<%= text_field_tag "query", params[:query], :size => 40 %>
|
|
||||||
<%= submit_tag "Search" %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<h1>Moderation Queue</h1>
|
<h1>Moderation Queue</h1>
|
||||||
|
|
||||||
|
<div id="search">
|
||||||
|
<%= form_tag(moderator_post_queue_path, :method => :get) do %>
|
||||||
|
<%= text_field_tag "query", params[:query], :size => 40 %>
|
||||||
|
<%= select_tag "per_page", options_for_select(%w(25 50 100 200), session["mq_per_page"])%>
|
||||||
|
<%= submit_tag "Search" %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="moderation-guideline">
|
<div id="moderation-guideline">
|
||||||
<h1>Deletion Guidelines</h1>
|
<h1>Deletion Guidelines</h1>
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
Reference in New Issue
Block a user