cool_nested_forms 1.0.1 → 1.0.2
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af501a2bfc55ecb63e39851038dfb7d0bba6614e
|
4
|
+
data.tar.gz: 594c8c6a3b576f6e836489ef47a53991e190d4b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5508c12b75229896af14311249e770ee2303e398e30d5b4c7101dc525a506f0ead853644e51a1d8560d705c4d1f50c996f8d41758d74aeeaab2a4280a51ad3ac
|
7
|
+
data.tar.gz: b2b35b327d07736004e495567c90b0fd35c7a13db4999f247b0ebdcb824f1ee3b48bf83ca3d3b9516f06a12e91ebebc1aa1849f3018d8237d9fa5c605a3cc523
|
@@ -10,7 +10,7 @@ $(function(){
|
|
10
10
|
var regexp_parent_new_field = new RegExp('new_' + association, 'g');
|
11
11
|
var new_id = new Date().getTime();
|
12
12
|
var Dest = (target == '') ? $(this).parent() : $('#'+target);
|
13
|
-
Dest.append(window[ template
|
13
|
+
Dest.append(window[ template ].replace(regexp, new_id).replace(regexp2, new_id));
|
14
14
|
for(var index in child_templates)
|
15
15
|
{
|
16
16
|
child_template = child_templates[index];
|
@@ -2,8 +2,8 @@ module CoolNestedFormsHelper
|
|
2
2
|
|
3
3
|
def new_fields_template(f,association,options={})
|
4
4
|
options[:object] ||= f.object.class.reflect_on_association(association).klass.new
|
5
|
-
options[:partial] ||= association.to_s.singularize
|
6
|
-
options[:template] ||= association.to_s
|
5
|
+
options[:partial] ||= association.to_s.singularize
|
6
|
+
options[:template] ||= association.to_s
|
7
7
|
options[:child_template_options] ||= []
|
8
8
|
options[:f] ||= f
|
9
9
|
|
@@ -14,13 +14,13 @@ module CoolNestedFormsHelper
|
|
14
14
|
options[:child_template_options].each do |child|
|
15
15
|
child_tmpl += new_fields_template(b,child[:association],child)
|
16
16
|
end
|
17
|
-
child_tmpl = child_tmpl.gsub /\r?\n|\r/, ' '
|
17
|
+
child_tmpl = child_tmpl.gsub( /\r?\n|\r/, ' ')
|
18
18
|
end
|
19
19
|
render(:partial=>options[:partial],:locals =>{:f => b})
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
tmpl = tmpl.gsub /\r?\n|\r/, ' '
|
23
|
+
tmpl = tmpl.gsub( /\r?\n|\r/, ' ')
|
24
24
|
script = "<script> var #{options[:template]} = '#{tmpl.to_s}'; </script>"
|
25
25
|
script += child_tmpl
|
26
26
|
return script.html_safe
|
data/lib/cool_nested_forms.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cool_nested_forms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Roque
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|