Class: Sidebar::ParamField::CheckBoxField

Inherits:
Sidebar::ParamField show all
Defined in:
lib/sidebar.rb

Instance Attribute Summary

Attributes inherited from Sidebar::ParamField

#default, #key, #options

Instance Method Summary collapse

Methods inherited from Sidebar::ParamField

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

Constructor Details

This class inherits a constructor from Sidebar::ParamField

Instance Method Details

#canonicalize(value) ⇒ Object



95
96
97
98
99
100
101
102
# File 'lib/sidebar.rb', line 95

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

#input_html(sidebar) ⇒ Object



86
87
88
89
# File 'lib/sidebar.rb', line 86

def input_html(sidebar)
  hidden_field_tag(input_name(sidebar),0)+
  check_box_tag(input_name(sidebar), 1, sidebar.config[key], options)
end

#line_html(sidebar) ⇒ Object



91
92
93
# File 'lib/sidebar.rb', line 91

def line_html(sidebar)
  input_html(sidebar) + ' ' + label_html(sidebar) + '<br >'
end