Permalink
Browse files

Add :inline option to Radio and CheckBoxesInput.

After passing `inline: true` option to `:radio` or `:check_boxes` input,
input container will be rendered with `.radio-inline` or `.checkbox-inline` class.
  • Loading branch information...
jtomaszewski committed Feb 2, 2014
1 parent 5a26414 commit eae5fb7e9a2ebfedcd938ed48ca87103cb4772e1
@@ -5,7 +5,6 @@ class CheckBoxesInput < Formtastic::Inputs::CheckBoxesInput
include Base::Choices
# TODO Make sure help blocks work correctly.
- # TODO Support .inline
def to_html
form_group_wrapping do
@@ -30,9 +29,11 @@ def choice_html(choice)
end
def checkbox_wrapping(&block)
+ class_name = "checkbox"
+ class_name += " checkbox-inline" if options[:inline]
template.content_tag(:div,
template.capture(&block).html_safe,
- :class => "checkbox"
+ :class => class_name
)
end
@@ -5,7 +5,6 @@ class RadioInput < Formtastic::Inputs::RadioInput
include Base::Choices
# TODO Make sure help blocks work correctly.
- # TODO Support .inline
def to_html
form_group_wrapping do
@@ -35,9 +34,11 @@ def choice_html(choice)
end
def radio_wrapping(&block)
+ class_name = "radio"
+ class_name += " radio-inline" if options[:inline]
template.content_tag(:div,
template.capture(&block).html_safe,
- :class => "radio"
+ :class => class_name
)
end

0 comments on commit eae5fb7

Please sign in to comment.