Class: ActiveAdmin::Inputs::FilterBooleanInput
- Inherits:
-
Formtastic::Inputs::BooleanInput
- Object
- Formtastic::Inputs::BooleanInput
- ActiveAdmin::Inputs::FilterBooleanInput
show all
- Includes:
- FilterBase
- Defined in:
- lib/active_admin/inputs/filter_boolean_input.rb
Instance Method Summary
collapse
Methods included from FilterBase
#collection_from_options, #humanized_method_name, #input_wrapping, #reflection_for, #required?, #wrapper_html_options
Instance Method Details
#check_box_html ⇒ Object
14
15
16
|
# File 'lib/active_admin/inputs/filter_boolean_input.rb', line 14
def check_box_html
template.check_box_tag("#{object_name}[#{method}]", checked_value, checked?, input_html_options)
end
|
#checked? ⇒ Boolean
22
23
24
25
26
27
28
|
# File 'lib/active_admin/inputs/filter_boolean_input.rb', line 22
def checked?
if defined? ActionView::Helpers::InstanceTag
object && ActionView::Helpers::InstanceTag.check_box_checked?(object.send(search_method), checked_value)
else
object && boolean_checked?(object.send(search_method), checked_value)
end
end
|
30
31
32
|
# File 'lib/active_admin/inputs/filter_boolean_input.rb', line 30
def input_html_options
{ :name => "q[#{search_method}]" }
end
|
34
35
36
|
# File 'lib/active_admin/inputs/filter_boolean_input.rb', line 34
def metasearch_conditions
/is_true|is_false|is_present/
end
|
#search_method ⇒ Object
18
19
20
|
# File 'lib/active_admin/inputs/filter_boolean_input.rb', line 18
def search_method
method.to_s.match(metasearch_conditions) ? method : "#{method}_eq"
end
|
#to_html ⇒ Object
6
7
8
9
10
11
12
|
# File 'lib/active_admin/inputs/filter_boolean_input.rb', line 6
def to_html
input_wrapping do
[ label_html,
check_box_html
].join("\n").html_safe
end
end
|