Class: Form::SwitchComponent
- Inherits:
-
CheckboxComponent
- Object
- CheckboxComponent
- Form::SwitchComponent
- Defined in:
- app/components/spark/form/switch_component.rb
Instance Method Summary collapse
Instance Method Details
#before_render ⇒ Object
8 9 10 11 |
# File 'app/components/spark/form/switch_component.rb', line 8 def before_render add_class(size) if size add_class(join_class("align-#{align}")) if align end |
#input_attrs ⇒ Object
24 25 26 27 28 |
# File 'app/components/spark/form/switch_component.rb', line 24 def input_attrs super.merge({ class: join_class("input") }) end |
#render ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'app/components/spark/form/switch_component.rb', line 13 def render content_tag(:div, class: classnames) do component("form/label", text: label, class: join_class("label")) do concat(tag(:input, input_attrs)) concat content_tag(:span, class: join_class("panel")) { content_tag(:span, nil, class: join_class("tick")) } end end end |