Class: SidebarField::CheckBoxField

Inherits:
SidebarField show all
Defined in:
lib/sidebar_field.rb

Instance Attribute Summary

Attributes inherited from SidebarField

#default, #key, #options

Instance Method Summary collapse

Methods inherited from SidebarField

build, class_for, #current_value, #initialize, #input_html, #input_name, #label, #label_html

Constructor Details

This class inherits a constructor from SidebarField

Instance Method Details

#canonicalize(value) ⇒ Object



90
91
92
93
94
95
96
97
# File 'lib/sidebar_field.rb', line 90

def canonicalize(value)
  case value
  when "0"
    false
  else
    true
  end
end

#line_html(sidebar) ⇒ Object



83
84
85
86
87
88
# File 'lib/sidebar_field.rb', line 83

def line_html(sidebar)
  content = hidden_field_tag(input_name(sidebar), 0) +
    tag.label(check_box_tag(input_name(sidebar), 1,
                            current_value(sidebar), options) + label)
  tag.div(content, class: "checkbox")
end