Class: TaoForm::Inputs::BooleanInput

Inherits:
SimpleForm::Inputs::BooleanInput
  • Object
show all
Defined in:
lib/tao_form/inputs/boolean_input.rb

Instance Method Summary collapse

Instance Method Details

#input(wrapper_options = nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/tao_form/inputs/boolean_input.rb', line 5

def input(wrapper_options = nil)
  merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)

  if switch?
    input_content = template.tao_switch(
      @builder, attribute_name, merged_input_options,
      checked_value, unchecked_value
    )
  else
    input_content = template.tao_check_box(
      @builder, attribute_name, merged_input_options,
      checked_value, unchecked_value
    )
  end

  template.(:div, input_content, class: 'boolean-field')
end