Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add class for collection_wrapper_tag

  • Loading branch information...
commit ee557636d3919f20af5f17e307f12e717d57e635 1 parent 5ea7d40
@mfila authored
View
3  lib/generators/simple_form/templates/config/initializers/simple_form.rb
@@ -32,6 +32,9 @@
# You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
# config.collection_wrapper_tag = nil
+ # You can define the class to use on all collection wrappers. Default is nil.
+ # config.collection_wrapper_class = :'inputs-list'
+
# You can wrap each item in a collection of radio/check boxes with a tag, defaulting to span.
# config.item_wrapper_tag = :span
View
4 lib/simple_form.rb
@@ -42,6 +42,10 @@ module SimpleForm
mattr_accessor :collection_wrapper_tag
@@collection_wrapper_tag = nil
+ # You can define the class to use on all collection wrappers. Default is nil.
+ mattr_accessor :collection_wrapper_class
+ @@collection_wrapper_class = nil
+
# You can wrap each item in a collection of radio/check boxes with a tag, defaulting to none.
mattr_accessor :item_wrapper_tag
@@item_wrapper_tag = :span
View
2  lib/simple_form/action_view_extensions/builder.rb
@@ -147,7 +147,7 @@ def render_collection(attribute, collection, value_method, text_method, options=
item_wrapper_tag ? @template.content_tag(item_wrapper_tag, rendered_item) : rendered_item
end.join.html_safe
- collection_wrapper_tag ? @template.content_tag(collection_wrapper_tag, rendered_collection) : rendered_collection
+ collection_wrapper_tag ? @template.content_tag(collection_wrapper_tag, rendered_collection, :class => SimpleForm.collection_wrapper_class) : rendered_collection
end
def value_for_collection(item, value) #:nodoc:
Please sign in to comment.
Something went wrong with that request. Please try again.