Class: Forms::Plain::Checkbox

Inherits:
Checkbox
  • Object
show all
Defined in:
lib/forms/plain/checkbox.rb

Overview

Bare checkbox, keeping the hidden unchecked-value field (that's binding logic, not styling). Also fills the :toggle theme role — a toggle is a styled checkbox.

Instance Method Summary collapse

Instance Method Details

#view_templateObject



9
10
11
12
13
14
# File 'lib/forms/plain/checkbox.rb', line 9

def view_template
  input(type: "hidden", name: @name, value: @unchecked_value) if @unchecked_value && @name
  attrs = unstyled_attributes
  attrs[:checked] = true if @checked
  input(type: "checkbox", value: @value, **attrs)
end