nested_form_fields 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +2 -2
- data/lib/nested_form_fields/version.rb +1 -1
- data/lib/nested_form_fields.rb +3 -3
- metadata +1 -1
data/README.md
CHANGED
@@ -59,9 +59,9 @@ You can change the link text of *remove_nested_fields_link* and *add_nested_fiel
|
|
59
59
|
...
|
60
60
|
f.add_nested_fields_link :videos, 'Add another funtastic video'
|
61
61
|
|
62
|
-
You can change the type of the element wrapping the nested fields using the *
|
62
|
+
You can change the type of the element wrapping the nested fields using the *wrapper_tag* option:
|
63
63
|
|
64
|
-
= f.nested_fields_for :videos,
|
64
|
+
= f.nested_fields_for :videos, wrapper_tag: :div do |ff|
|
65
65
|
|
66
66
|
The default wrapper element is a fieldset.
|
67
67
|
|
data/lib/nested_form_fields.rb
CHANGED
@@ -15,7 +15,7 @@ module ActionView::Helpers
|
|
15
15
|
fields_options, record_object = record_object, nil if record_object.is_a?(Hash) && record_object.extractable_options?
|
16
16
|
fields_options[:builder] ||= options[:builder]
|
17
17
|
fields_options[:parent_builder] = self
|
18
|
-
fields_options[:
|
18
|
+
fields_options[:wrapper_tag] ||= :fieldset
|
19
19
|
fields_options[:namespace] = fields_options[:parent_builder].options[:namespace]
|
20
20
|
|
21
21
|
return fields_for_has_many_association_with_template(record_name, record_object, fields_options, block)
|
@@ -49,7 +49,7 @@ module ActionView::Helpers
|
|
49
49
|
|
50
50
|
output = ActiveSupport::SafeBuffer.new
|
51
51
|
association.each do |child|
|
52
|
-
output << nested_fields_wrapper(association_name, options[:
|
52
|
+
output << nested_fields_wrapper(association_name, options[:wrapper_tag]) do
|
53
53
|
fields_for_nested_model("#{name}[#{options[:child_index] || nested_child_index(name)}]", child, options, block)
|
54
54
|
end
|
55
55
|
end
|
@@ -73,7 +73,7 @@ module ActionView::Helpers
|
|
73
73
|
id: template_id(association_name),
|
74
74
|
class: for_template ? 'form_template' : nil,
|
75
75
|
style: for_template ? 'display:none' : nil ) do
|
76
|
-
nested_fields_wrapper(association_name, options[:
|
76
|
+
nested_fields_wrapper(association_name, options[:wrapper_tag]) do
|
77
77
|
fields_for_nested_model("#{name}[#{index_placeholder(association_name)}]",
|
78
78
|
association_name.to_s.classify.constantize.new,
|
79
79
|
options.merge(for_template: true), block)
|