module ActiveAdmin::Inputs::Filters::Base::SearchMethodSelect
def self.included(base)
def self.included(base) base.extend ClassMethods end
def current_filter
def current_filter @current_filter ||= begin methods = filters.map { |f| "#{method}_#{f}" } methods.detect { |m| @object.public_send m } || methods.first end end
def filter_options
def filter_options filters.collect do |filter| [I18n.t("active_admin.filters.predicates.#{filter}"), "#{method}_#{filter}"] end end
def filters
def filters options[:filters] || self.class.filters end
def input_html
def input_html builder.text_field current_filter, input_html_options end
def select_html
def select_html template.select_tag "", template.options_for_select(filter_options, current_filter) end
def to_html
def to_html input_wrapping do label_html << # your label select_html << # the dropdown that holds the available search methods input_html # your input field end end
def wrapper_html_options
def wrapper_html_options opts = super (opts[:class] ||= "") << " select_and_search" unless seems_searchable? opts end