Module: FlexaFormtasticBootstrap::Inputs::Base::Choices
- Included in:
- CheckBoxesInput, RadioInput
- Defined in:
- lib/flexa_formtastic_bootstrap/inputs/base/choices.rb
Instance Method Summary collapse
- #choice_label(choice) ⇒ Object
- #choices_group_wrapping(&block) ⇒ Object
- #choices_group_wrapping_html_options ⇒ Object
- #choices_wrapping_html_options ⇒ Object
- #input_div_wrapping(&block) ⇒ Object
- #label_html_options ⇒ Object
-
#legend_html ⇒ Object
This is actually a label in Bootstrap.
Instance Method Details
#choice_label(choice) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/flexa_formtastic_bootstrap/inputs/base/choices.rb', line 28 def choice_label(choice) "\n".html_safe + template.content_tag(:span) do # (choice.is_a?(Array) ? choice.first : choice).to_s (choice.is_a?(Array) ? choice.first : choice).to_s end end |
#choices_group_wrapping(&block) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/flexa_formtastic_bootstrap/inputs/base/choices.rb', line 17 def choices_group_wrapping(&block) template.content_tag(:ul, template.capture(&block), ) end |
#choices_group_wrapping_html_options ⇒ Object
24 25 26 |
# File 'lib/flexa_formtastic_bootstrap/inputs/base/choices.rb', line 24 def { :class => "choices-group inputs-list" } end |
#choices_wrapping_html_options ⇒ Object
12 13 14 15 |
# File 'lib/flexa_formtastic_bootstrap/inputs/base/choices.rb', line 12 def # TODO Call the Formtastic one explicity and append? { :class => "choices input" } end |
#input_div_wrapping(&block) ⇒ Object
6 7 8 9 10 |
# File 'lib/flexa_formtastic_bootstrap/inputs/base/choices.rb', line 6 def input_div_wrapping(&block) template.content_tag(:div, ) do [yield, error_html(:block), hint_html(:block)].join("\n").html_safe end end |
#label_html_options ⇒ Object
42 43 44 |
# File 'lib/flexa_formtastic_bootstrap/inputs/base/choices.rb', line 42 def super.merge(:for => nil) end |
#legend_html ⇒ Object
This is actually a label in Bootstrap.
36 37 38 39 40 |
# File 'lib/flexa_formtastic_bootstrap/inputs/base/choices.rb', line 36 def legend_html template.content_tag(:label, ) do render_label? ? label_text : "".html_safe end end |