Class: FormtasticBootstrap::Inputs::RadioInput
- Inherits:
-
Formtastic::Inputs::RadioInput
- Object
- Formtastic::Inputs::RadioInput
- FormtasticBootstrap::Inputs::RadioInput
- Includes:
- Base, Base::Choices
- Defined in:
- lib/formtastic-bootstrap/inputs/radio_input.rb
Instance Method Summary collapse
- #choice_html(choice) ⇒ Object
-
#choice_wrapping_html_options(choice) ⇒ Object
This came from check_boxes.
-
#to_html ⇒ Object
TODO Make sure help blocks work correctly.
- #wrapper_html_options ⇒ Object
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
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
36 37 38 39 40 41 42 |
# File 'lib/formtastic-bootstrap/inputs/radio_input.rb', line 36 def choice_html(choice) template.content_tag(:label, builder.(input_name, choice_value(choice), .merge((choice)).merge(:required => false)) << choice_label(choice), .merge((choice)) ) end |
#choice_wrapping_html_options(choice) ⇒ Object
This came from check_boxes. Do needed refactoring.
30 31 32 33 34 |
# File 'lib/formtastic-bootstrap/inputs/radio_input.rb', line 30 def (choice) super(choice).tap do || [:class] = (([:class].split) << "radio").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 |
# File 'lib/formtastic-bootstrap/inputs/radio_input.rb', line 10 def to_html control_group_wrapping do control_label_html << controls_wrapping do collection.map { |choice| choice_html(choice) }.join("\n").html_safe end end end |
#wrapper_html_options ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/formtastic-bootstrap/inputs/radio_input.rb', line 21 def # Formtastic marks these as 'radio' but Bootstrap does something # with that, so change it to 'radio_buttons'. super.tap do || [:class] = [:class].gsub("radio", "radio_buttons") end end |