45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/acts_as_concatenation/view_helper.rb', line 45
def to_checkbox_group_tag(choices, options)
ulid = "#{tag_id}_ul"
real_values = value(object)||[]
tagname = tag_name + '[]'
s = "<input type='hidden' name='#{tagname}' value='' style='display:none;'/>"
s << "<ul id=#{ulid} class=selectbox-group>"
choices.each do |o|
if_checked = real_values.include?(o[1].to_s) ? "checked='checked'" : ""
s << "<li>"
s << "<input type='checkbox' name='#{tagname}' value='#{o[1]}' #{if_checked}/><label>#{o[0]}</label>"
s << "</li>"
end
s << "</ul>"
end
|