Class: Protoform::Rails::Components::Checkbox

Inherits:
FieldComponent show all
Defined in:
lib/protoform/rails/components/checkbox.rb

Instance Method Summary collapse

Methods inherited from Component

#dom, #title

Instance Method Details

#view_templateObject



7
8
9
10
11
12
13
14
# File 'lib/protoform/rails/components/checkbox.rb', line 7

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", **attrs)
end