Merge pull request #3248 from evazion/feat-tag-relation-search
Fix #2633: Search for status:active at tag_aliases and tag_implications
This commit is contained in:
@@ -22,8 +22,7 @@ class TagAliasesController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@search = TagAlias.search(params[:search])
|
@tag_aliases = TagAlias.search(params[:search]).paginate(params[:page], :limit => params[:limit])
|
||||||
@tag_aliases = @search.order("(case status when 'pending' then 1 when 'queued' then 2 when 'active' then 3 else 0 end), antecedent_name, consequent_name").paginate(params[:page], :limit => params[:limit])
|
|
||||||
respond_with(@tag_aliases) do |format|
|
respond_with(@tag_aliases) do |format|
|
||||||
format.xml do
|
format.xml do
|
||||||
render :xml => @tag_aliases.to_xml(:root => "tag-aliases")
|
render :xml => @tag_aliases.to_xml(:root => "tag-aliases")
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ class TagImplicationsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@search = TagImplication.search(params[:search])
|
@tag_implications = TagImplication.search(params[:search]).paginate(params[:page], :limit => params[:limit])
|
||||||
@tag_implications = @search.order("(case status when 'pending' then 1 when 'queued' then 2 when 'active' then 3 else 0 end), antecedent_name, consequent_name").paginate(params[:page], :limit => params[:limit])
|
|
||||||
respond_with(@tag_implications) do |format|
|
respond_with(@tag_implications) do |format|
|
||||||
format.xml do
|
format.xml do
|
||||||
render :xml => @tag_implications.to_xml(:root => "tag-implications")
|
render :xml => @tag_implications.to_xml(:root => "tag-implications")
|
||||||
|
|||||||
@@ -1,17 +1,8 @@
|
|||||||
class TagAlias < ApplicationRecord
|
class TagAlias < TagRelationship
|
||||||
attr_accessor :skip_secondary_validations
|
|
||||||
|
|
||||||
before_save :ensure_tags_exist
|
before_save :ensure_tags_exist
|
||||||
after_save :clear_all_cache
|
after_save :clear_all_cache
|
||||||
after_destroy :clear_all_cache
|
after_destroy :clear_all_cache
|
||||||
after_save :create_mod_action
|
after_save :create_mod_action
|
||||||
before_validation :initialize_creator, :on => :create
|
|
||||||
before_validation :normalize_names
|
|
||||||
validates_format_of :status, :with => /\A(active|deleted|pending|processing|queued|error: .*)\Z/
|
|
||||||
validates_presence_of :creator_id, :antecedent_name, :consequent_name
|
|
||||||
validates :creator, presence: { message: "must exist" }, if: lambda { creator_id.present? }
|
|
||||||
validates :approver, presence: { message: "must exist" }, if: lambda { approver_id.present? }
|
|
||||||
validates :forum_topic, presence: { message: "must exist" }, if: lambda { forum_topic_id.present? }
|
|
||||||
validates_uniqueness_of :antecedent_name
|
validates_uniqueness_of :antecedent_name
|
||||||
validate :absence_of_transitive_relation
|
validate :absence_of_transitive_relation
|
||||||
validate :antecedent_and_consequent_are_different
|
validate :antecedent_and_consequent_are_different
|
||||||
@@ -24,40 +15,6 @@ class TagAlias < ApplicationRecord
|
|||||||
attr_accessible :antecedent_name, :consequent_name, :forum_topic_id, :skip_secondary_validations
|
attr_accessible :antecedent_name, :consequent_name, :forum_topic_id, :skip_secondary_validations
|
||||||
attr_accessible :status, :approver_id, :as => [:admin]
|
attr_accessible :status, :approver_id, :as => [:admin]
|
||||||
|
|
||||||
module SearchMethods
|
|
||||||
def name_matches(name)
|
|
||||||
where("(antecedent_name like ? escape E'\\\\' or consequent_name like ? escape E'\\\\')", name.mb_chars.downcase.to_escaped_for_sql_like, name.downcase.to_escaped_for_sql_like)
|
|
||||||
end
|
|
||||||
|
|
||||||
def active
|
|
||||||
where("status IN (?)", ["active", "processing"])
|
|
||||||
end
|
|
||||||
|
|
||||||
def search(params)
|
|
||||||
q = where("true")
|
|
||||||
return q if params.blank?
|
|
||||||
|
|
||||||
if params[:name_matches].present?
|
|
||||||
q = q.name_matches(params[:name_matches])
|
|
||||||
end
|
|
||||||
|
|
||||||
if params[:antecedent_name].present?
|
|
||||||
q = q.where("antecedent_name = ?", params[:antecedent_name])
|
|
||||||
end
|
|
||||||
|
|
||||||
if params[:id].present?
|
|
||||||
q = q.where("id in (?)", params[:id].split(",").map(&:to_i))
|
|
||||||
end
|
|
||||||
|
|
||||||
case params[:order]
|
|
||||||
when "created_at"
|
|
||||||
q = q.order("created_at desc")
|
|
||||||
end
|
|
||||||
|
|
||||||
q
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
module CacheMethods
|
module CacheMethods
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
@@ -124,7 +81,6 @@ class TagAlias < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
extend SearchMethods
|
|
||||||
include CacheMethods
|
include CacheMethods
|
||||||
include ApprovalMethods
|
include ApprovalMethods
|
||||||
include ForumMethods
|
include ForumMethods
|
||||||
@@ -172,32 +128,6 @@ class TagAlias < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_pending?
|
|
||||||
status == "pending"
|
|
||||||
end
|
|
||||||
|
|
||||||
def is_active?
|
|
||||||
status == "active"
|
|
||||||
end
|
|
||||||
|
|
||||||
def normalize_names
|
|
||||||
self.antecedent_name = antecedent_name.mb_chars.downcase.tr(" ", "_")
|
|
||||||
self.consequent_name = consequent_name.downcase.tr(" ", "_")
|
|
||||||
end
|
|
||||||
|
|
||||||
def initialize_creator
|
|
||||||
self.creator_id ||= CurrentUser.user.id
|
|
||||||
self.creator_ip_addr ||= CurrentUser.ip_addr
|
|
||||||
end
|
|
||||||
|
|
||||||
def antecedent_tag
|
|
||||||
Tag.find_or_create_by_name(antecedent_name)
|
|
||||||
end
|
|
||||||
|
|
||||||
def consequent_tag
|
|
||||||
Tag.find_or_create_by_name(consequent_name)
|
|
||||||
end
|
|
||||||
|
|
||||||
def absence_of_transitive_relation
|
def absence_of_transitive_relation
|
||||||
# We don't want a -> b && b -> c chains if the b -> c alias was created first.
|
# We don't want a -> b && b -> c chains if the b -> c alias was created first.
|
||||||
# If the a -> b alias was created first, the new one will be allowed and the old one will be moved automatically instead.
|
# If the a -> b alias was created first, the new one will be allowed and the old one will be moved automatically instead.
|
||||||
@@ -310,17 +240,6 @@ class TagAlias < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def deletable_by?(user)
|
|
||||||
return true if user.is_admin?
|
|
||||||
return true if is_pending? && user.is_builder?
|
|
||||||
return true if is_pending? && user.id == creator_id
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
def editable_by?(user)
|
|
||||||
deletable_by?(user)
|
|
||||||
end
|
|
||||||
|
|
||||||
def reject!
|
def reject!
|
||||||
update({ :status => "deleted" }, :as => CurrentUser.role)
|
update({ :status => "deleted" }, :as => CurrentUser.role)
|
||||||
clear_all_cache
|
clear_all_cache
|
||||||
|
|||||||
@@ -1,21 +1,8 @@
|
|||||||
class TagImplication < ApplicationRecord
|
class TagImplication < TagRelationship
|
||||||
attr_accessor :skip_secondary_validations
|
|
||||||
|
|
||||||
before_save :update_descendant_names
|
before_save :update_descendant_names
|
||||||
after_save :update_descendant_names_for_parents
|
after_save :update_descendant_names_for_parents
|
||||||
after_destroy :update_descendant_names_for_parents
|
after_destroy :update_descendant_names_for_parents
|
||||||
after_save :create_mod_action
|
after_save :create_mod_action
|
||||||
belongs_to :creator, :class_name => "User"
|
|
||||||
belongs_to :approver, :class_name => "User"
|
|
||||||
belongs_to :forum_topic
|
|
||||||
belongs_to :forum_post
|
|
||||||
before_validation :initialize_creator, :on => :create
|
|
||||||
before_validation :normalize_names
|
|
||||||
validates_format_of :status, :with => /\A(active|deleted|pending|processing|queued|error: .*)\Z/
|
|
||||||
validates_presence_of :creator_id, :antecedent_name, :consequent_name
|
|
||||||
validates :creator, presence: { message: "must exist" }, if: lambda { creator_id.present? }
|
|
||||||
validates :approver, presence: { message: "must exist" }, if: lambda { approver_id.present? }
|
|
||||||
validates :forum_topic, presence: { message: "must exist" }, if: lambda { forum_topic_id.present? }
|
|
||||||
validates_uniqueness_of :antecedent_name, :scope => :consequent_name
|
validates_uniqueness_of :antecedent_name, :scope => :consequent_name
|
||||||
validate :absence_of_circular_relation
|
validate :absence_of_circular_relation
|
||||||
validate :absence_of_transitive_relation
|
validate :absence_of_transitive_relation
|
||||||
@@ -23,8 +10,6 @@ class TagImplication < ApplicationRecord
|
|||||||
validate :consequent_is_not_aliased
|
validate :consequent_is_not_aliased
|
||||||
validate :antecedent_and_consequent_are_different
|
validate :antecedent_and_consequent_are_different
|
||||||
validate :wiki_pages_present, :on => :create
|
validate :wiki_pages_present, :on => :create
|
||||||
attr_accessible :antecedent_name, :consequent_name, :forum_topic_id, :skip_secondary_validations
|
|
||||||
attr_accessible :status, :approver_id, :as => [:admin]
|
|
||||||
|
|
||||||
module DescendantMethods
|
module DescendantMethods
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
@@ -91,44 +76,6 @@ class TagImplication < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module SearchMethods
|
|
||||||
def name_matches(name)
|
|
||||||
where("(antecedent_name like ? escape E'\\\\' or consequent_name like ? escape E'\\\\')", name.downcase.to_escaped_for_sql_like, name.downcase.to_escaped_for_sql_like)
|
|
||||||
end
|
|
||||||
|
|
||||||
def active
|
|
||||||
where(status: %w[active processing queued])
|
|
||||||
end
|
|
||||||
|
|
||||||
def search(params)
|
|
||||||
q = where("true")
|
|
||||||
return q if params.blank?
|
|
||||||
|
|
||||||
if params[:id].present?
|
|
||||||
q = q.where("id in (?)", params[:id].split(",").map(&:to_i))
|
|
||||||
end
|
|
||||||
|
|
||||||
if params[:name_matches].present?
|
|
||||||
q = q.name_matches(params[:name_matches])
|
|
||||||
end
|
|
||||||
|
|
||||||
if params[:antecedent_name].present?
|
|
||||||
q = q.where("antecedent_name = ?", params[:antecedent_name])
|
|
||||||
end
|
|
||||||
|
|
||||||
if params[:consequent_name].present?
|
|
||||||
q = q.where("consequent_name = ?", params[:consequent_name])
|
|
||||||
end
|
|
||||||
|
|
||||||
case params[:order]
|
|
||||||
when "created_at"
|
|
||||||
q = q.order("created_at desc")
|
|
||||||
end
|
|
||||||
|
|
||||||
q
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
module ValidationMethods
|
module ValidationMethods
|
||||||
def absence_of_circular_relation
|
def absence_of_circular_relation
|
||||||
# We don't want a -> b && b -> a chains
|
# We don't want a -> b && b -> a chains
|
||||||
@@ -285,50 +232,12 @@ class TagImplication < ApplicationRecord
|
|||||||
|
|
||||||
include DescendantMethods
|
include DescendantMethods
|
||||||
include ParentMethods
|
include ParentMethods
|
||||||
extend SearchMethods
|
|
||||||
include ValidationMethods
|
include ValidationMethods
|
||||||
include ApprovalMethods
|
include ApprovalMethods
|
||||||
|
|
||||||
def initialize_creator
|
|
||||||
self.creator_id = CurrentUser.user.id
|
|
||||||
self.creator_ip_addr = CurrentUser.ip_addr
|
|
||||||
end
|
|
||||||
|
|
||||||
def normalize_names
|
|
||||||
self.antecedent_name = antecedent_name.downcase.tr(" ", "_")
|
|
||||||
self.consequent_name = consequent_name.downcase.tr(" ", "_")
|
|
||||||
end
|
|
||||||
|
|
||||||
def is_pending?
|
|
||||||
status == "pending"
|
|
||||||
end
|
|
||||||
|
|
||||||
def is_active?
|
|
||||||
status == "active"
|
|
||||||
end
|
|
||||||
|
|
||||||
def antecedent_tag
|
|
||||||
Tag.find_or_create_by_name(antecedent_name)
|
|
||||||
end
|
|
||||||
|
|
||||||
def consequent_tag
|
|
||||||
Tag.find_or_create_by_name(consequent_name)
|
|
||||||
end
|
|
||||||
|
|
||||||
def reload(options = {})
|
def reload(options = {})
|
||||||
super
|
super
|
||||||
clear_parents_cache
|
clear_parents_cache
|
||||||
clear_descendants_cache
|
clear_descendants_cache
|
||||||
end
|
end
|
||||||
|
|
||||||
def deletable_by?(user)
|
|
||||||
return true if user.is_admin?
|
|
||||||
return true if is_pending? && user.is_builder?
|
|
||||||
return true if is_pending? && user.id == creator_id
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
def editable_by?(user)
|
|
||||||
deletable_by?(user)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
121
app/models/tag_relationship.rb
Normal file
121
app/models/tag_relationship.rb
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
class TagRelationship < ApplicationRecord
|
||||||
|
self.abstract_class = true
|
||||||
|
|
||||||
|
attr_accessor :skip_secondary_validations
|
||||||
|
attr_accessible :antecedent_name, :consequent_name, :forum_topic_id, :skip_secondary_validations
|
||||||
|
attr_accessible :status, :approver_id, :as => [:admin]
|
||||||
|
|
||||||
|
belongs_to :creator, :class_name => "User"
|
||||||
|
belongs_to :approver, :class_name => "User"
|
||||||
|
belongs_to :forum_post
|
||||||
|
belongs_to :forum_topic
|
||||||
|
has_one :antecedent_tag, :class_name => "Tag", :foreign_key => "name", :primary_key => "antecedent_name"
|
||||||
|
has_one :consequent_tag, :class_name => "Tag", :foreign_key => "name", :primary_key => "consequent_name"
|
||||||
|
|
||||||
|
before_validation :initialize_creator, :on => :create
|
||||||
|
before_validation :normalize_names
|
||||||
|
validates_format_of :status, :with => /\A(active|deleted|pending|processing|queued|error: .*)\Z/
|
||||||
|
validates_presence_of :creator_id, :antecedent_name, :consequent_name
|
||||||
|
validates :creator, presence: { message: "must exist" }, if: lambda { creator_id.present? }
|
||||||
|
validates :approver, presence: { message: "must exist" }, if: lambda { approver_id.present? }
|
||||||
|
validates :forum_topic, presence: { message: "must exist" }, if: lambda { forum_topic_id.present? }
|
||||||
|
|
||||||
|
def initialize_creator
|
||||||
|
self.creator_id = CurrentUser.user.id
|
||||||
|
self.creator_ip_addr = CurrentUser.ip_addr
|
||||||
|
end
|
||||||
|
|
||||||
|
def normalize_names
|
||||||
|
self.antecedent_name = antecedent_name.mb_chars.downcase.tr(" ", "_")
|
||||||
|
self.consequent_name = consequent_name.mb_chars.downcase.tr(" ", "_")
|
||||||
|
end
|
||||||
|
|
||||||
|
def is_pending?
|
||||||
|
status == "pending"
|
||||||
|
end
|
||||||
|
|
||||||
|
def is_active?
|
||||||
|
status == "active"
|
||||||
|
end
|
||||||
|
|
||||||
|
def deletable_by?(user)
|
||||||
|
return true if user.is_admin?
|
||||||
|
return true if is_pending? && user.is_builder?
|
||||||
|
return true if is_pending? && user.id == creator_id
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
def editable_by?(user)
|
||||||
|
deletable_by?(user)
|
||||||
|
end
|
||||||
|
|
||||||
|
module SearchMethods
|
||||||
|
def name_matches(name)
|
||||||
|
where("(antecedent_name like ? escape E'\\\\' or consequent_name like ? escape E'\\\\')", name.mb_chars.downcase.to_escaped_for_sql_like, name.mb_chars.downcase.to_escaped_for_sql_like)
|
||||||
|
end
|
||||||
|
|
||||||
|
def status_matches(status)
|
||||||
|
status = status.downcase
|
||||||
|
|
||||||
|
if status == "approved"
|
||||||
|
where(status: %w[active processing queued])
|
||||||
|
else
|
||||||
|
where(status: status)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def pending_first
|
||||||
|
order("(case status when 'pending' then 1 when 'queued' then 2 when 'active' then 3 else 0 end), antecedent_name, consequent_name")
|
||||||
|
end
|
||||||
|
|
||||||
|
def active
|
||||||
|
where(status: %w[active processing queued])
|
||||||
|
end
|
||||||
|
|
||||||
|
def search(params)
|
||||||
|
q = all
|
||||||
|
|
||||||
|
if params[:id].present?
|
||||||
|
q = q.where(id: params[:id].split(",").map(&:to_i))
|
||||||
|
end
|
||||||
|
|
||||||
|
if params[:name_matches].present?
|
||||||
|
q = q.name_matches(params[:name_matches])
|
||||||
|
end
|
||||||
|
|
||||||
|
if params[:antecedent_name].present?
|
||||||
|
q = q.where(antecedent_name: params[:antecedent_name].split)
|
||||||
|
end
|
||||||
|
|
||||||
|
if params[:consequent_name].present?
|
||||||
|
q = q.where(consequent_name: params[:consequent_name].split)
|
||||||
|
end
|
||||||
|
|
||||||
|
if params[:status].present?
|
||||||
|
q = q.status_matches(params[:status])
|
||||||
|
end
|
||||||
|
|
||||||
|
if params[:category].present?
|
||||||
|
q = q.joins(:consequent_tag).where("tags.category": params[:category].split)
|
||||||
|
end
|
||||||
|
|
||||||
|
params[:order] ||= "status"
|
||||||
|
case params[:order].downcase
|
||||||
|
when "status"
|
||||||
|
q = q.pending_first
|
||||||
|
when "created_at"
|
||||||
|
q = q.order("created_at desc")
|
||||||
|
when "updated_at"
|
||||||
|
q = q.order("updated_at desc")
|
||||||
|
when "name"
|
||||||
|
q = q.order("antecedent_name asc, consequent_name asc")
|
||||||
|
when "tag_count"
|
||||||
|
q = q.joins(:consequent_tag).order("tags.post_count desc, antecedent_name asc, consequent_name asc")
|
||||||
|
end
|
||||||
|
|
||||||
|
q
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
extend SearchMethods
|
||||||
|
end
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<% tag_aliases.each do |tag_alias| %>
|
<% tag_aliases.each do |tag_alias| %>
|
||||||
<tr id="tag-alias-<%= tag_alias.id %>">
|
<tr id="tag-alias-<%= tag_alias.id %>">
|
||||||
<td class="category-<%= tag_alias.antecedent_tag.category %>"><%= link_to tag_alias.antecedent_name, posts_path(:tags => tag_alias.antecedent_name) %> <span class="count"><%= tag_alias.antecedent_tag.post_count rescue 0 %></span></td>
|
<td class="category-<%= tag_alias.antecedent_tag.try(:category) %>"><%= link_to tag_alias.antecedent_name, posts_path(:tags => tag_alias.antecedent_name) %> <span class="count"><%= tag_alias.antecedent_tag.post_count rescue 0 %></span></td>
|
||||||
<td class="category-<%= tag_alias.consequent_tag.try(:category) %>"><%= link_to tag_alias.consequent_name, posts_path(:tags => tag_alias.consequent_name) %> <span class="count"><%= tag_alias.consequent_tag.post_count rescue 0 %></span></td>
|
<td class="category-<%= tag_alias.consequent_tag.try(:category) %>"><%= link_to tag_alias.consequent_name, posts_path(:tags => tag_alias.consequent_name) %> <span class="count"><%= tag_alias.consequent_tag.post_count rescue 0 %></span></td>
|
||||||
<td>
|
<td>
|
||||||
<% if tag_alias.forum_topic_id %>
|
<% if tag_alias.forum_topic_id %>
|
||||||
@@ -45,4 +45,4 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
<div id="c-tag-aliases">
|
<div id="c-tag-aliases">
|
||||||
<div id="a-index">
|
<div id="a-index">
|
||||||
<%= simple_form_for(:search, method: :get, url: tag_aliases_path, defaults: { required: false }) do |f| %>
|
<%= simple_form_for(:search, method: :get, url: tag_aliases_path, defaults: { required: false }, html: { class: "inline-form" }) do |f| %>
|
||||||
<%= f.input :name_matches, label: "Name", input_html: { value: params[:search][:name_matches], data: { autocomplete: "tag" } } %>
|
<%= f.input :name_matches, label: "Name", input_html: { value: params[:search][:name_matches], data: { autocomplete: "tag" } } %>
|
||||||
|
<%= f.input :status, label: "Status", collection: ["", "Approved", "Pending"], selected: params[:search][:status] %>
|
||||||
|
<%= f.input :category, label: "Category", collection: Danbooru.config.canonical_tag_category_mapping.to_a, include_blank: true, selected: params[:search][:category] %>
|
||||||
|
<%= f.input :order, label: "Order", collection: [%w[Status status], %w[Recently\ created created_at], %w[Recently\ updated updated_at], %w[Name name], %w[Tag\ count tag_count]], selected: params[:search][:order] %>
|
||||||
<%= f.submit "Search" %>
|
<%= f.submit "Search" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
@@ -16,4 +19,3 @@
|
|||||||
<% content_for(:page_title) do %>
|
<% content_for(:page_title) do %>
|
||||||
Tag Aliases - <%= Danbooru.config.app_name %>
|
Tag Aliases - <%= Danbooru.config.app_name %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
<div id="c-tag-implications">
|
<div id="c-tag-implications">
|
||||||
<div id="a-index">
|
<div id="a-index">
|
||||||
<%= simple_form_for(:search, method: :get, url: tag_implications_path, defaults: { required: false }) do |f| %>
|
<%= simple_form_for(:search, method: :get, url: tag_implications_path, defaults: { required: false }, html: { class: "inline-form" }) do |f| %>
|
||||||
<%= f.input :name_matches, label: "Name", input_html: { value: params[:search][:name_matches], data: { autocomplete: "tag" } } %>
|
<%= f.input :name_matches, label: "Name", input_html: { value: params[:search][:name_matches], data: { autocomplete: "tag" } } %>
|
||||||
|
<%= f.input :status, label: "Status", collection: ["", "Approved", "Pending"], selected: params[:search][:status] %>
|
||||||
|
<%= f.input :category, label: "Category", collection: Danbooru.config.canonical_tag_category_mapping.to_a, include_blank: true, selected: params[:search][:category] %>
|
||||||
|
<%= f.input :order, label: "Order", collection: [%w[Status status], %w[Recently\ created created_at], %w[Recently\ updated updated_at], %w[Name name], %w[Tag\ count tag_count]], selected: params[:search][:order] %>
|
||||||
<%= f.submit "Search" %>
|
<%= f.submit "Search" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user