pools/gallery: allow searching for collection pools (#3992).
Default to showing only series pools when not doing a search. Otherwise, when doing a search, show both series and collection pools.
This commit is contained in:
@@ -30,8 +30,10 @@ class PoolsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def gallery
|
def gallery
|
||||||
limit = params[:limit] || CurrentUser.user.per_page
|
params[:limit] ||= CurrentUser.user.per_page
|
||||||
@pools = Pool.series.search(search_params).reorder("updated_at desc").paginate(params[:page], :limit => limit, :search_count => params[:search])
|
search = search_params.presence || ActionController::Parameters.new(category: "series")
|
||||||
|
|
||||||
|
@pools = Pool.search(search).paginate(params[:page], :limit => params[:limit], :search_count => params[:search])
|
||||||
@post_set = PostSets::PoolGallery.new(@pools)
|
@post_set = PostSets::PoolGallery.new(@pools)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -37,22 +37,20 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<% if path != gallery_pools_path %>
|
<tr>
|
||||||
<tr>
|
<th><label for="search_category">Category</th>
|
||||||
<th><label for="search_category">Category</th>
|
<td>
|
||||||
<td>
|
<div class="input">
|
||||||
<div class="input">
|
<%= select "search", "category", [["Series", "series"], ["Collection", "collection"]], :selected => params[:search][:category], :include_blank => true %>
|
||||||
<%= select "search", "category", [["Series", "series"], ["Collection", "collection"]], :selected => params[:search][:category], :include_blank => true %>
|
</div>
|
||||||
</div>
|
</td>
|
||||||
</td>
|
</tr>
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th><label for="search_order">Order</th>
|
<th><label for="search_order">Order</th>
|
||||||
<td>
|
<td>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<%= select "search", "order", [["Last updated", "updated_at"], ["Name", "name"], ["Recently created", "created_at"], ["Post count", "post_count"]], :selected => params[:search][:order] %>
|
<%= select "search", "order", [["Last updated", "updated_at"], ["Name", "name"], ["Recently created", "created_at"], ["Post count", "post_count"]], :selected => params[:search][:order], :include_blank => true %>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user