Class: Sidebars::Field::RadioField
- Inherits:
-
Sidebars::Field
show all
- Defined in:
- lib/sidebars/plugin.rb
Instance Attribute Summary
#key, #options
Instance Method Summary
(collapse)
build, class_for, #initialize, #input_name, #label_html, #line_html
Instance Method Details
46
47
48
49
50
51
52
53
|
# File 'lib/sidebars/plugin.rb', line 46
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
|
- (Object) label_for(choice)
55
56
57
|
# File 'lib/sidebars/plugin.rb', line 55
def label_for(choice)
choice.is_a?(Array) ? choice.last : choice.to_s.humanize
end
|
- (Object) value_for(choice)
59
60
61
|
# File 'lib/sidebars/plugin.rb', line 59
def value_for(choice)
choice.is_a?(Array) ? choice.first : choice
end
|