Class: Formtastic::Inputs::PrismToggleInput
- Inherits:
-
BooleanInput
- Object
- BooleanInput
- Formtastic::Inputs::PrismToggleInput
- Defined in:
- lib/formtastic/inputs/prism_toggle_input.rb
Overview
An opt-in boolean input rendered as an iOS-style switch instead of a checkbox, matching the "Toggle switches" section of the Prism theme.
f.input :active, as: :prism_toggle
Reuses BooleanInput's hidden-field/checked-value/name logic verbatim —
only the wrapping markup changes, so submitted params are identical to
a normal as: :boolean input.
Instance Method Summary collapse
Instance Method Details
#input_html_options ⇒ Object
22 23 24 |
# File 'lib/formtastic/inputs/prism_toggle_input.rb', line 22 def super.merge(class: [super[:class], "prism-toggle-input"].reject(&:blank?).join(" ")) end |
#label_html_options ⇒ Object
26 27 28 |
# File 'lib/formtastic/inputs/prism_toggle_input.rb', line 26 def super.merge(class: [super[:class], "prism-toggle"].reject(&:blank?).join(" ")) end |
#label_with_nested_checkbox ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/formtastic/inputs/prism_toggle_input.rb', line 14 def label_with_nested_checkbox builder.label( method, check_box_html + template.content_tag(:span, "", class: "prism-toggle-track") + label_text, ) end |