Class: ActiveAdmin::Inputs::Filters::CheckBoxesInput

Inherits:
Formtastic::Inputs::CheckBoxesInput
  • Object
show all
Includes:
Base
Defined in:
lib/active_admin/inputs/filters/check_boxes_input.rb

Instance Method Summary collapse

Methods included from Base

#collection_from_options, #input_wrapping, #label_from_options, #required?, #wrapper_html_options

Methods included from Filters::FormtasticAddons

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

Methods included from Formtastic::Inputs::Base

#input_wrapping

Instance Method Details

#choice_label(choice) ⇒ Object

Add whitespace before label



24
25
26
# File 'lib/active_admin/inputs/filters/check_boxes_input.rb', line 24

def choice_label(choice)
  ' ' + super
end

#choice_wrapping(html_options, &block) ⇒ Object

Don't wrap in LI tag



34
35
36
# File 'lib/active_admin/inputs/filters/check_boxes_input.rb', line 34

def choice_wrapping(html_options, &block)
  template.capture(&block)
end

#choices_group_wrapping(&block) ⇒ Object

Don't wrap in UL tag



29
30
31
# File 'lib/active_admin/inputs/filters/check_boxes_input.rb', line 29

def choices_group_wrapping(&block)
  template.capture(&block)
end

#hidden_field_for_allObject

Don't render hidden fields



39
40
41
# File 'lib/active_admin/inputs/filters/check_boxes_input.rb', line 39

def hidden_field_for_all
  ""
end

#hidden_fields?Boolean

Don't render hidden fields

Returns:

  • (Boolean)


44
45
46
# File 'lib/active_admin/inputs/filters/check_boxes_input.rb', line 44

def hidden_fields?
  false
end

#input_nameObject



7
8
9
# File 'lib/active_admin/inputs/filters/check_boxes_input.rb', line 7

def input_name
  "#{object_name}[#{searchable_method_name}_in][]"
end

#searchable_method_nameObject



15
16
17
18
19
20
21
# File 'lib/active_admin/inputs/filters/check_boxes_input.rb', line 15

def searchable_method_name
  if searchable_has_many_through?
    "#{reflection.through_reflection.name}_#{reflection.foreign_key}"
  else
    association_primary_key || method
  end
end

#selected_valuesObject



11
12
13
# File 'lib/active_admin/inputs/filters/check_boxes_input.rb', line 11

def selected_values
  @object.public_send("#{searchable_method_name}_in") || []
end