bbenezech-nested_form 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc
CHANGED
@@ -11,10 +11,15 @@ jQuery(function($) {
|
|
11
11
|
var assoc = $(link).attr('data-association'); // Name of child
|
12
12
|
var content = $('#' + assoc + '_fields_blueprint').html(); // Fields template
|
13
13
|
|
14
|
+
// Make a unique ID for the new child
|
15
|
+
var regexp = new RegExp('new_' + assoc, 'g');
|
16
|
+
var new_id = new Date().getTime();
|
17
|
+
content = content.replace(regexp, "new_" + new_id);
|
18
|
+
|
14
19
|
// Make the context correct by replacing new_<parents> with the generated ID
|
15
20
|
// of each of the parent objects
|
16
21
|
var context = ($(link).closest('.fields').find('input:first').attr('name') || '').replace(new RegExp('\[[a-z]+\]$'), '');
|
17
|
-
|
22
|
+
|
18
23
|
// context will be something like this for a brand new form:
|
19
24
|
// project[tasks_attributes][new_1255929127459][assignments_attributes][new_1255929128105]
|
20
25
|
// or for an edit form:
|
@@ -36,11 +41,6 @@ jQuery(function($) {
|
|
36
41
|
}
|
37
42
|
}
|
38
43
|
|
39
|
-
// Make a unique ID for the new child
|
40
|
-
var regexp = new RegExp('new_' + assoc, 'g');
|
41
|
-
var new_id = new Date().getTime();
|
42
|
-
content = content.replace(regexp, "new_" + new_id);
|
43
|
-
|
44
44
|
var field = this.insertFields(content, assoc, link);
|
45
45
|
$(link).closest("form")
|
46
46
|
.trigger({ type: 'nested:fieldAdded', field: field })
|
@@ -11,10 +11,15 @@ jQuery(function($) {
|
|
11
11
|
var assoc = $(link).attr('data-association'); // Name of child
|
12
12
|
var content = $('#' + assoc + '_fields_blueprint').html(); // Fields template
|
13
13
|
|
14
|
+
// Make a unique ID for the new child
|
15
|
+
var regexp = new RegExp('new_' + assoc, 'g');
|
16
|
+
var new_id = new Date().getTime();
|
17
|
+
content = content.replace(regexp, "new_" + new_id);
|
18
|
+
|
14
19
|
// Make the context correct by replacing new_<parents> with the generated ID
|
15
20
|
// of each of the parent objects
|
16
21
|
var context = ($(link).closest('.fields').find('input:first').attr('name') || '').replace(new RegExp('\[[a-z]+\]$'), '');
|
17
|
-
|
22
|
+
|
18
23
|
// context will be something like this for a brand new form:
|
19
24
|
// project[tasks_attributes][new_1255929127459][assignments_attributes][new_1255929128105]
|
20
25
|
// or for an edit form:
|
@@ -36,11 +41,6 @@ jQuery(function($) {
|
|
36
41
|
}
|
37
42
|
}
|
38
43
|
|
39
|
-
// Make a unique ID for the new child
|
40
|
-
var regexp = new RegExp('new_' + assoc, 'g');
|
41
|
-
var new_id = new Date().getTime();
|
42
|
-
content = content.replace(regexp, "new_" + new_id);
|
43
|
-
|
44
44
|
var field = this.insertFields(content, assoc, link);
|
45
45
|
$(link).closest("form")
|
46
46
|
.trigger({ type: 'nested:fieldAdded', field: field })
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bbenezech-nested_form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ date: 2012-02-22 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec-rails
|
17
|
-
requirement: &
|
17
|
+
requirement: &70169599342280 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 2.6.0
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70169599342280
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: mocha
|
28
|
-
requirement: &
|
28
|
+
requirement: &70169599338560 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70169599338560
|
37
37
|
description: Gem to conveniently handle multiple models in a single form with Rails
|
38
38
|
3 and jQuery or Prototype. Version maintained by fxposter.
|
39
39
|
email: ryan@railscasts.com
|