Class: FormtasticBootstrap::Inputs::CheckBoxesInput

Inherits:
Formtastic::Inputs::CheckBoxesInput
  • Object
show all
Includes:
Base, Base::Choices
Defined in:
lib/formtastic-bootstrap/inputs/check_boxes_input.rb

Instance Method Summary collapse

Methods included from Base::Choices

#choices_wrapping_html_options, #control_label_html_options, #input_div_wrapping, #legend_html

Methods included from Base::Wrapping

#control_group_div_wrapping, #generic_input_wrapping, #inline_inputs_div_wrapping, #input_div_wrapping, #prepended_input_wrapping, #wrapper_html_options

Methods included from Base::Labelling

#control_label_html_options, #label_html, #label_html_options

Methods included from Base::Html

#input_html_options

Methods included from Base::Hints

#hint_html

Methods included from Base::Errors

#error_first_html, #error_html, #error_list_html, #error_none_html, #error_sentence_html

Instance Method Details

#choice_html(choice) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/formtastic-bootstrap/inputs/check_boxes_input.rb', line 19

def choice_html(choice)
  template.(:label,
    hidden_fields? ?
      check_box_with_hidden_input(choice) :
      check_box_without_hidden_input(choice) <<
    choice_label(choice),
    label_html_options.merge(:for => choice_input_dom_id(choice)).merge(choice_wrapping_html_options(choice))
  )
end

#choice_wrapping_html_options(choice) ⇒ Object



29
30
31
32
# File 'lib/formtastic-bootstrap/inputs/check_boxes_input.rb', line 29

def choice_wrapping_html_options(choice)
  new_class = [super[:class], 'checkbox'].join(' ')
  super.merge(:class => new_class)
end

#to_htmlObject



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/formtastic-bootstrap/inputs/check_boxes_input.rb', line 7

def to_html
  control_group_div_wrapping do
    legend_html <<
    hidden_field_for_all <<
    input_div_wrapping do
      collection.map { |choice|
        choice_html(choice)
      }.join("\n").html_safe
    end
  end
end