Is there a possibility to wrap checkboxes and radio buttons together in a unordered list ?
When not, How I can display them vertically ?
I know this is layout related, but still a programming question.
Is there a possibility to wrap checkboxes and radio buttons together in a unordered list ?
When not, How I can display them vertically ?
I know this is layout related, but still a programming question.
As a quick hack to move on with life, adding this to the bottom of application helper works to simple wrap each label/input pair in a div:
module SimpleForm::ActionViewExtensions::Builder
def collection_radio(attribute, collection, value_method, text_method, options={}, html_options={})
collection.map do |item|
value = item.send value_method
text = item.send text_method
default_html_options = default_html_options_for_collection(item, value, options, html_options)
@template.content_tag(:div, radio_button(attribute, value, default_html_options) <<
label("#{attribute}_#{value}", text, :class => "collection_radio"))
end.join.html_safe
end
def collection_check_boxes(attribute, collection, value_method, text_method, options={}, html_options={})
collection.map do |item|
value = item.send value_method
text = item.send text_method
default_html_options = default_html_options_for_collection(item, value, options, html_options)
default_html_options[:multiple] = true
@template.content_tag(:div,
check_box(attribute, default_html_options, value, '') <<
label("#{attribute}_#{value}", text, :class => "collection_check_boxes"))
end.join.html_safe
end
end