Module: Maglev::Form::Inputs::CheckBox

Included in:
FormBuilder
Defined in:
app/lib/maglev/form/inputs/check_box.rb

Instance Method Summary collapse

Instance Method Details

#check_box(method, options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'app/lib/maglev/form/inputs/check_box.rb', line 7

def check_box(method, options = {})
  attributes = field_attributes(method)

  @template.render(Maglev::Uikit::Form::CheckboxComponent.new(
                     label: options[:label].presence || attributes[:content],
                     name: attributes[:name],
                     checked: object.public_send(method),
                     placeholder: options[:placeholder]
                   ))
end