Class: Formtastic::Inputs::BlazeToggleInput
- Inherits:
-
BooleanInput
- Object
- BooleanInput
- Formtastic::Inputs::BlazeToggleInput
- Includes:
- Base
- Defined in:
- lib/formtastic/inputs/blaze_toggle_input.rb
Instance Method Summary collapse
- #label_html_options ⇒ Object
- #label_with_embedded_checkbox ⇒ Object
-
#to_html ⇒ Object
def to_html input_wrapping do # hidden_field_html << label_html << builder.check_box( method, input_html_options ) # label_with_nested_checkbox end end.
- #toggle_checkbox ⇒ Object
- #toggle_html ⇒ Object
- #toggle_label ⇒ Object
Instance Method Details
#label_html_options ⇒ Object
40 41 42 43 |
# File 'lib/formtastic/inputs/blaze_toggle_input.rb', line 40 def classes = [:simple_checkbox] ? [] : ['c-toggle', [:toggle_class]] super.merge(for: [:id], class: classes - ['label']) end |
#label_with_embedded_checkbox ⇒ Object
45 46 47 |
# File 'lib/formtastic/inputs/blaze_toggle_input.rb', line 45 def check_box_html << "" << ([:simple_checkbox] ? '' : toggle_html) # << label_text end |
#to_html ⇒ Object
def to_html
input_wrapping do
# hidden_field_html <<
label_html <<
builder.check_box( method, )
# label_with_nested_checkbox
end
end
17 18 19 20 21 22 23 |
# 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 ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/formtastic/inputs/blaze_toggle_input.rb', line 32 def toggle_checkbox builder.label( method, , ) end |
#toggle_html ⇒ Object
49 50 51 52 53 54 55 |
# 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 ⇒ Object
25 26 27 28 29 30 |
# File 'lib/formtastic/inputs/blaze_toggle_input.rb', line 25 def toggle_label builder.label( method, label_text ) end |