module ActiveAdmin::Inputs::Filters::Base::SearchMethodSelect

Public Class Methods

included(base) click to toggle source
# File lib/active_admin/inputs/filters/base/search_method_select.rb, line 21
def self.included(base)
  base.extend ClassMethods
end

Public Instance Methods

current_filter() click to toggle source
# File lib/active_admin/inputs/filters/base/search_method_select.rb, line 59
def current_filter
  @current_filter ||= begin
    methods = filters.map { |f| "#{method}_#{f}" }
    methods.detect { |m| @object.public_send m } || methods.first
  end
end
filter_options() click to toggle source
# File lib/active_admin/inputs/filters/base/search_method_select.rb, line 66
def filter_options
  filters.collect do |filter|
    [I18n.t("ransack.predicates.#{filter}").capitalize, "#{method}_#{filter}"]
  end
end
filters() click to toggle source
# File lib/active_admin/inputs/filters/base/search_method_select.rb, line 55
def filters
  options[:filters] || self.class.filters
end
input_html() click to toggle source
# File lib/active_admin/inputs/filters/base/search_method_select.rb, line 47
def input_html
  builder.text_field current_filter, input_html_options
end
select_html() click to toggle source
# File lib/active_admin/inputs/filters/base/search_method_select.rb, line 51
def select_html
  template.select_tag "", template.options_for_select(filter_options, current_filter)
end
to_html() click to toggle source
# File lib/active_admin/inputs/filters/base/search_method_select.rb, line 39
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
wrapper_html_options() click to toggle source
Calls superclass method
# File lib/active_admin/inputs/filters/base/search_method_select.rb, line 33
def wrapper_html_options
  opts = super
  (opts[:class] ||= "") << " select_and_search" unless seems_searchable?
  opts
end