Class: Sidebar::ParamField::RadioField
Instance Attribute Summary
#default, #key, #options
Instance Method Summary
collapse
build, #canonicalize, class_for, #initialize, #input_name, #label, #label_html, #line_html
Instance Method Details
67
68
69
70
71
72
73
74
|
# File 'lib/sidebar.rb', line 67
def input_html()
options[:choices].collect do |choice|
value = value_for(choice)
radio_button_tag(input_name(), value,
value == .config[key], options) +
content_tag('label', label_for(choice))
end.join("<br />")
end
|
#label_for(choice) ⇒ Object
76
77
78
|
# File 'lib/sidebar.rb', line 76
def label_for(choice)
choice.is_a?(Array) ? choice.last : choice.to_s.humanize
end
|
#value_for(choice) ⇒ Object
80
81
82
|
# File 'lib/sidebar.rb', line 80
def value_for(choice)
choice.is_a?(Array) ? choice.first : choice
end
|