Class: FormtasticBootstrap::Inputs::CheckBoxesInput
- Inherits:
-
Formtastic::Inputs::CheckBoxesInput
- Object
- Formtastic::Inputs::CheckBoxesInput
- FormtasticBootstrap::Inputs::CheckBoxesInput
- Includes:
- Base, Base::Choices
- Defined in:
- lib/formtastic-bootstrap/inputs/check_boxes_input.rb
Instance Method Summary collapse
- #choice_html(choice) ⇒ Object
- #choice_wrapping_html_options(choice) ⇒ Object
-
#to_html ⇒ Object
TODO Make sure help blocks work correctly.
Methods included from Base::Choices
Methods included from Base::Wrapping
#appended_input_wrapping, #bootstrap_wrapping, #control_group_wrapping, #controls_wrapper_html_options, #controls_wrapping, #prepended_and_appended_input_wrapping, #prepended_input_wrapping, #wrapper_html_options
Methods included from Base::Labelling
#control_label_html, #control_label_html_options, #label_html_options
Methods included from Base::Hints
Methods included from Base::Errors
#error_first_html, #error_html, #error_list_html, #error_none_html, #error_sentence_html
Methods included from Base::Html
Instance Method Details
#choice_html(choice) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/formtastic-bootstrap/inputs/check_boxes_input.rb', line 28 def choice_html(choice) template.content_tag(:label, hidden_fields? ? check_box_with_hidden_input(choice) : check_box_without_hidden_input(choice) << choice_label(choice), .merge((choice)) ) end |
#choice_wrapping_html_options(choice) ⇒ Object
22 23 24 25 26 |
# File 'lib/formtastic-bootstrap/inputs/check_boxes_input.rb', line 22 def (choice) super(choice).tap do || [:class] = (([:class].split) << "checkbox").join(" ") end end |
#to_html ⇒ Object
TODO Make sure help blocks work correctly. TODO Support .inline
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/formtastic-bootstrap/inputs/check_boxes_input.rb', line 10 def to_html control_group_wrapping do control_label_html << hidden_field_for_all << controls_wrapping do collection.map { |choice| choice_html(choice) }.join("\n").html_safe end end end |