include hide empty option for tag search
This commit is contained in:
@@ -400,6 +400,10 @@ class Tag < ActiveRecord::Base
|
|||||||
q = q.where("category = ?", params[:category])
|
q = q.where("category = ?", params[:category])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if params[:hide_empty] == "yes"
|
||||||
|
q = q.where("post_count > 0")
|
||||||
|
end
|
||||||
|
|
||||||
case params[:sort].present?
|
case params[:sort].present?
|
||||||
when "count"
|
when "count"
|
||||||
q = q.order("post_count desc")
|
q = q.order("post_count desc")
|
||||||
|
|||||||
@@ -1,13 +1,22 @@
|
|||||||
<div id="c-tags">
|
<div id="c-tags">
|
||||||
<div id="a-search">
|
<div id="a-search">
|
||||||
<%= form_tag(tags_path, :method => :get, :class => "simple_form") do %>
|
<%= form_tag(tags_path, :method => :get, :class => "simple_form") do %>
|
||||||
<%= search_field "name_matches", :label => "Name" %>
|
<div class="input">
|
||||||
|
<label for="search_name">Name</label>
|
||||||
|
<%= text_field "search", "name_matches" %>
|
||||||
|
<span class="hint">Use * for wildcard</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<label for="search_category">Category</label>
|
<label for="search_category">Category</label>
|
||||||
<%= select "search", "category", [""] + Danbooru.config.canonical_tag_category_mapping.to_a %>
|
<%= select "search", "category", [""] + Danbooru.config.canonical_tag_category_mapping.to_a %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="input">
|
||||||
|
<label for="search_hide_empty">Hide Empty</label>
|
||||||
|
<%= select "search", "hide_empty", ["no", "yes"] %>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<label for="search_sort">Sort</label>
|
<label for="search_sort">Sort</label>
|
||||||
<%= select "search", "sort", %w(name count date) %>
|
<%= select "search", "sort", %w(name count date) %>
|
||||||
|
|||||||
Reference in New Issue
Block a user