class Formtastic::Inputs::BlazeToggleInput

Public Instance Methods

label_html_options() click to toggle source
Calls superclass method
# File lib/formtastic/inputs/blaze_toggle_input.rb, line 40
def label_html_options
  classes = input_html_options[:simple_checkbox] ? [] : ['c-toggle', input_html_options[:toggle_class]]
  super.merge(for: input_html_options[:id], class: classes - ['label'])
end
label_with_embedded_checkbox() click to toggle source
# File lib/formtastic/inputs/blaze_toggle_input.rb, line 45
def label_with_embedded_checkbox
  check_box_html << "" << (input_html_options[:simple_checkbox] ? '' : toggle_html)  # << label_text
end
to_html() click to toggle source

def to_html

input_wrapping do
  # hidden_field_html <<
  label_html <<
  builder.check_box( method, input_html_options )
  # label_with_nested_checkbox
end

end

# File lib/formtastic/inputs/blaze_toggle_input.rb, line 17
def to_html
  input_wrapping do
    toggle_label <<
      hidden_field_html <<
      toggle_checkbox
  end
end
toggle_checkbox() click to toggle source
# File lib/formtastic/inputs/blaze_toggle_input.rb, line 32
def toggle_checkbox
  builder.label(
    method,
    label_with_embedded_checkbox,
    label_html_options
  )
end
toggle_html() click to toggle source
# File lib/formtastic/inputs/blaze_toggle_input.rb, line 49
def toggle_html
  template.content_tag(
    :div,
    template.content_tag(:div, '', class: 'c-toggle__handle'),
    class: 'c-toggle__track'
  )
end
toggle_label() click to toggle source
# File lib/formtastic/inputs/blaze_toggle_input.rb, line 25
def toggle_label
  builder.label(
    method,
    label_text
  )
end