Class: Superform::Rails::Components::CheckboxComponent
- Inherits:
-
FieldComponent
- Object
- BaseComponent
- FieldComponent
- Superform::Rails::Components::CheckboxComponent
- Defined in:
- lib/superform/rails.rb
Instance Attribute Summary
Attributes inherited from BaseComponent
Instance Method Summary collapse
Methods inherited from BaseComponent
Constructor Details
This class inherits a constructor from Superform::Rails::Components::BaseComponent
Instance Method Details
#field_attributes ⇒ Object
268 269 270 |
# File 'lib/superform/rails.rb', line 268 def field_attributes { id: dom.id, name: dom.name, checked: field.value } end |
#view_template ⇒ Object
260 261 262 263 264 265 266 |
# File 'lib/superform/rails.rb', line 260 def view_template(&) # Rails has a hidden and checkbox input to deal with sending back a value # to the server regardless of if the input is checked or not. input(name: dom.name, type: :hidden, value: "0") # The hard coded keys need to be in here so the user can't overrite them. input(type: :checkbox, value: "1", **attributes) end |