Permalink
Browse files

Tidied rendering wrapper tag code

  • Loading branch information...
1 parent 6fde5b4 commit 94ef52723a903aa7ce69048cf87d5a1b54bd3afb John Polling committed Feb 6, 2010
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/formtastic.rb
View
@@ -1273,7 +1273,7 @@ def field_set_and_list_wrapping(*args, &block) #:nodoc:
# Ruby 1.9: String#to_s behavior changed, need to make an explicit join.
contents = contents.join if contents.respond_to?(:join)
fieldset = template.content_tag(:fieldset,
- legend << (@@item_separator == :li ? template.content_tag(:ol, contents) : contents),
+ legend << render_contents(contents),
html_options.except(:builder, :parent)
)
@@ -1305,7 +1305,7 @@ def field_set_and_list_wrapping_for_method(method, options, contents) #:nodoc:
template.content_tag(:legend,
self.label(method, options_for_label(options).merge(:for => options.delete(:label_for))), :class => 'label'
) <<
- (@@item_separator == :li ? template.content_tag(:ol, contents) : contents)
+ render_contents(contents)
)
end
@@ -1627,6 +1627,11 @@ def set_include_blank(options)
end
options
end
+
+ private
+ def render_contents(contents)
+ @@item_separator == :li ? template.content_tag(:ol, contents) : contents
+ end
end

0 comments on commit 94ef527

Please sign in to comment.