Permalink
Browse files

Creates correct radio button markup for Bootstrap 3.

  • Loading branch information...
1 parent 2c94216 commit d1dcd73f6321c62a3931a871f48bce4b4de069d7 @mjbellantoni committed Nov 25, 2013
Showing with 12 additions and 9 deletions.
  1. +12 −9 lib/formtastic-bootstrap/inputs/radio_input.rb
@@ -24,21 +24,24 @@ def wrapper_html_options
end
end
- # This came from check_boxes. Do needed refactoring.
- def choice_wrapping_html_options(choice)
- super(choice).tap do |options|
- options[:class] = ((options[:class].split) << "radio").join(" ")
+ def choice_html(choice)
+ radio_wrapping do
+ template.content_tag(:label,
+ builder.radio_button(input_name, choice_value(choice), input_html_options.merge(choice_html_options(choice)).merge(:required => false)) <<
+ choice_label(choice),
+ label_html_options.merge(choice_label_html_options(choice))
+ )
end
end
- def choice_html(choice)
- template.content_tag(:label,
- builder.radio_button(input_name, choice_value(choice), input_html_options.merge(choice_html_options(choice)).merge(:required => false)) <<
- choice_label(choice),
- label_html_options.merge(choice_label_html_options(choice))
+ def radio_wrapping(&block)
+ template.content_tag(:div,
+ template.capture(&block).html_safe,
+ :class => "radio"
)
end
end
end
end
+

0 comments on commit d1dcd73

Please sign in to comment.