Module: FlexaFormtasticBootstrap::Inputs::Base::Choices

Included in:
CheckBoxesInput, RadioInput
Defined in:
lib/flexa_formtastic_bootstrap/inputs/base/choices.rb

Instance Method Summary collapse

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.(: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.(:ul,
    template.capture(&block),
    choices_group_wrapping_html_options
  )
end

#choices_group_wrapping_html_optionsObject



24
25
26
# File 'lib/flexa_formtastic_bootstrap/inputs/base/choices.rb', line 24

def choices_group_wrapping_html_options
  { :class => "choices-group inputs-list" }
end

#choices_wrapping_html_optionsObject



12
13
14
15
# File 'lib/flexa_formtastic_bootstrap/inputs/base/choices.rb', line 12

def choices_wrapping_html_options
  # 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.(:div, choices_wrapping_html_options) do
    [yield, error_html(:block), hint_html(:block)].join("\n").html_safe  
  end
end

#label_html_optionsObject



42
43
44
# File 'lib/flexa_formtastic_bootstrap/inputs/base/choices.rb', line 42

def label_html_options
  super.merge(:for => nil)
end

#legend_htmlObject

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.(:label, label_html_options) do
    render_label? ? label_text : "".html_safe
  end
end