nested_form_fields 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -67,6 +67,13 @@ module ActionView::Helpers
67
67
 
68
68
  def nested_model_template name, association_name, options, block
69
69
  for_template = self.options[:for_template]
70
+
71
+ # Render the outermost template in a script tag to avoid it from being submited with the form
72
+ # Render all deeper nested templates as hidden divs as nesting script tags messes up the html.
73
+ # When nested fields are added with javascript by using a template that contains nested templates,
74
+ # the outermost nested templates div's are replaced by script tags to prevent those nested templates
75
+ # fields from form subission.
76
+ #
70
77
  @template.content_tag( for_template ? :div : :script,
71
78
  type: for_template ? nil : 'text/html',
72
79
  id: template_id(association_name),
@@ -99,7 +106,7 @@ module ActionView::Helpers
99
106
 
100
107
 
101
108
  def nested_fields_wrapper association_name
102
- @template.content_tag :div, class: "nested_fields nested_#{association_path(association_name)}" do
109
+ @template.content_tag :fieldset, class: "nested_fields nested_#{association_path(association_name)}" do
103
110
  yield
104
111
  end
105
112
  end
@@ -1,3 +1,3 @@
1
1
  module NestedFormFields
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nested_form_fields
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: