Module: ActiveAdmin::Inputs::Filters::Base

Extended by:
ActiveSupport::Autoload
Includes:
Filters::FormtasticAddons, Formtastic::Inputs::Base
Included in:
BooleanInput, CheckBoxesInput, DatePickerInput, DateRangeInput, NumericInput, SelectInput, StringInput, TextInput
Defined in:
lib/active_admin/inputs/filters/base.rb,
lib/active_admin/inputs/filters/base/search_method_select.rb

Defined Under Namespace

Modules: SearchMethodSelect

Instance Method Summary collapse

Methods included from Filters::FormtasticAddons

#column, #column_for, #has_predicate?, #humanized_method_name, #klass, #polymorphic_foreign_type?, #reflection_for, #scope?, #searchable_has_many_through?, #seems_searchable?

Instance Method Details

#collection_from_optionsObject

Override the standard finder to accept a proc


34
35
36
37
38
39
40
# File 'lib/active_admin/inputs/filters/base.rb', line 34

def collection_from_options
  if options[:collection].is_a?(Proc)
    template.instance_exec(&options[:collection])
  else
    super
  end
end

#input_wrapping(&block) ⇒ Object


12
13
14
# File 'lib/active_admin/inputs/filters/base.rb', line 12

def input_wrapping(&block)
  template. :div, template.capture(&block), wrapper_html_options
end

#label_from_optionsObject

Can pass proc to filter label option


21
22
23
24
25
# File 'lib/active_admin/inputs/filters/base.rb', line 21

def label_from_options
  res = super
  res = res.call if res.is_a? Proc
  res
end

#required?Boolean

Returns:

  • (Boolean)

16
17
18
# File 'lib/active_admin/inputs/filters/base.rb', line 16

def required?
  false
end

#wrapper_html_optionsObject


27
28
29
30
31
# File 'lib/active_admin/inputs/filters/base.rb', line 27

def wrapper_html_options
  opts = super
  (opts[:class] ||= "") << " filter_form_field filter_#{as}"
  opts
end