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
- #checkbox_wrapping(&block) ⇒ Object
- #choice_html(choice) ⇒ Object
-
#to_html ⇒ Object
TODO Make sure help blocks work correctly.
Methods included from Base::Choices
#choice_label_html_options, #choice_wrapping_html_options
Methods included from Base::Wrapping
#add_on_content, #add_on_wrapper_classes, #bootstrap_wrapping, #form_group_wrapping, #input_content, #prepended_or_appended?, #wrapper_html_options
Methods included from Base::Labelling
#label_html, #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
#form_control_input_html_options, #input_html_options
Instance Method Details
#checkbox_wrapping(&block) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/formtastic-bootstrap/inputs/check_boxes_input.rb', line 30 def checkbox_wrapping(&block) class_name = "checkbox" class_name += " checkbox-inline" if [:inline] template.content_tag(:div, template.capture(&block).html_safe, :class => class_name ) end |
#choice_html(choice) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/formtastic-bootstrap/inputs/check_boxes_input.rb', line 18 def choice_html(choice) checkbox_wrapping do template.content_tag(:label, hidden_fields? ? check_box_with_hidden_input(choice) : check_box_without_hidden_input(choice) << choice_label(choice), .merge((choice)) ) end end |
#to_html ⇒ Object
TODO Make sure help blocks work correctly.
9 10 11 12 13 14 15 16 |
# File 'lib/formtastic-bootstrap/inputs/check_boxes_input.rb', line 9 def to_html bootstrap_wrapping do hidden_field_for_all << # Might need to remove this guy. collection.map { |choice| choice_html(choice) }.join("\n").html_safe end end |