Module: ActiveAdmin::Inputs::FilterBase
- Includes:
- Formtastic::Inputs::Base
- Included in:
- FilterCheckBoxesInput, FilterDateRangeInput, FilterNumericInput, FilterSelectInput, FilterStringInput
- Defined in:
- lib/active_admin/inputs/filter_base.rb
Instance Method Summary collapse
-
#collection_from_options ⇒ Object
Override the standard finder to accept a proc.
-
#humanized_method_name ⇒ Object
Returns the default label for a given attribute Will use ActiveModel I18n if possible.
- #input_wrapping(&block) ⇒ Object
-
#reflection_for(method) ⇒ Object
Returns the association reflection for the method if it exists.
- #required? ⇒ Boolean
- #wrapper_html_options ⇒ Object
Instance Method Details
#collection_from_options ⇒ Object
Override the standard finder to accept a proc
22 23 24 25 26 27 28 |
# File 'lib/active_admin/inputs/filter_base.rb', line 22 def if [:collection].is_a?(Proc) [:collection].call else super end end |
#humanized_method_name ⇒ Object
Returns the default label for a given attribute Will use ActiveModel I18n if possible
32 33 34 35 36 37 38 |
# File 'lib/active_admin/inputs/filter_base.rb', line 32 def humanized_method_name if object.base.respond_to?(:human_attribute_name) object.base.human_attribute_name(method) else method.to_s.send(builder.label_str_method) end end |
#input_wrapping(&block) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/active_admin/inputs/filter_base.rb', line 6 def input_wrapping(&block) template.content_tag(:div, template.capture(&block), ) end |
#reflection_for(method) ⇒ Object
Returns the association reflection for the method if it exists
41 42 43 |
# File 'lib/active_admin/inputs/filter_base.rb', line 41 def reflection_for(method) @object.base.reflect_on_association(method) if @object.base.respond_to?(:reflect_on_association) end |
#required? ⇒ Boolean
13 14 15 |
# File 'lib/active_admin/inputs/filter_base.rb', line 13 def required? false end |
#wrapper_html_options ⇒ Object
17 18 19 |
# File 'lib/active_admin/inputs/filter_base.rb', line 17 def { :class => "filter_form_field #{as}" } end |