nested_form 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +18 -0
- data/CONTRIBUTING.md +11 -0
- data/Gemfile +1 -0
- data/README.md +3 -4
- data/lib/nested_form/builder_mixin.rb +38 -8
- data/lib/nested_form/builders.rb +8 -0
- data/lib/nested_form/view_helper.rb +7 -0
- data/spec/dummy/app/assets/javascripts/jquery_nested_form.js +13 -10
- data/spec/dummy/app/assets/javascripts/prototype_nested_form.js +8 -7
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +2322 -50
- data/spec/dummy/log/test.log +878 -422
- data/spec/dummy/tmp/cache/assets/C99/4D0/sprockets%2F5e30a6b911437f1428dc32c3ae182123 +0 -0
- data/spec/dummy/tmp/cache/assets/C99/7D0/sprockets%2F79513e6956e0ee8624976e041fd5636d +0 -0
- data/spec/dummy/tmp/cache/assets/CAA/C90/sprockets%2F1e6c8ee1258009385ccf5b84015424b3 +0 -0
- data/spec/dummy/tmp/cache/assets/CB2/CB0/sprockets%2F11cc8d161d71a716dd36f16849d90870 +0 -0
- data/spec/dummy/tmp/cache/assets/CB7/7F0/sprockets%2Fac97b043470f6fcc925c352f16956643 +0 -0
- data/spec/dummy/tmp/cache/assets/CDB/8A0/sprockets%2Faed2a2575c376263c26e93b56b57051d +0 -0
- data/spec/dummy/tmp/cache/assets/D1F/A10/sprockets%2F60317e62cb324bfd9987e8da9636fd06 +0 -0
- data/spec/dummy/tmp/cache/assets/D49/870/sprockets%2F90896142645585acc8baf56ad57e3afb +0 -0
- data/spec/dummy/tmp/cache/assets/D62/F00/sprockets%2F6ac03a007f26b1c18ed3d53498ad3eb8 +0 -0
- data/spec/dummy/tmp/cache/assets/D79/BC0/sprockets%2F85a1db977361cc5130fcefb4637ff67e +0 -0
- data/spec/dummy/tmp/cache/assets/D87/1F0/sprockets%2F61c9ceafb877fb740c67416ff6f782a9 +0 -0
- data/spec/dummy/tmp/cache/assets/DAD/4F0/sprockets%2F765acd1bf68dc90f7d3e61da78b1e659 +0 -0
- data/spec/dummy/tmp/cache/assets/E03/3F0/sprockets%2F82b37ae9eccec44c1ef44cfdd07d8534 +0 -0
- data/spec/dummy/tmp/cache/assets/E0A/CA0/sprockets%2F7fe72ac1c0db1a7e8e7f59cf25e8a39e +0 -0
- data/spec/dummy/tmp/cache/assets/E3A/A60/sprockets%2F7c72c96cfc66454caf5fc8ca0fedd4f3 +0 -0
- data/spec/dummy/tmp/cache/assets/E54/400/sprockets%2Fd0cbc16cc37efcf9dc41f242b5dbbf81 +0 -0
- data/spec/dummy/tmp/cache/assets/EB7/AB0/sprockets%2F801d29a5debdbfbfb4eef14d70d9bcdb +0 -0
- data/spec/dummy/tmp/cache/assets/F48/5E0/sprockets%2F26cd6ffcffbebbe2fd6cd1a8f0c2debc +0 -0
- data/spec/form_spec.rb +1 -1
- data/spec/nested_form/builder_spec.rb +55 -10
- data/spec/nested_form/view_helper_spec.rb +8 -0
- data/vendor/assets/javascripts/jquery_nested_form.js +13 -10
- data/vendor/assets/javascripts/prototype_nested_form.js +8 -7
- metadata +72 -87
- data/spec/dummy/tmp/capybara/capybara-201208212241496415482929.html +0 -31
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/spec/form_spec.rb
CHANGED
@@ -45,6 +45,6 @@ describe 'NestedForm' do
|
|
45
45
|
click_link 'Add new task'
|
46
46
|
click_link 'Add new milestone'
|
47
47
|
name = find('.fields .fields input[id$=name]')[:name]
|
48
|
-
name.should match(/\Aproject\[tasks_attributes\]\[
|
48
|
+
name.should match(/\Aproject\[tasks_attributes\]\[\d+\]\[milestones_attributes\]\[\d+\]\[name\]\z/)
|
49
49
|
end
|
50
50
|
end
|
@@ -19,9 +19,9 @@ require "spec_helper"
|
|
19
19
|
|
20
20
|
describe '#link_to_add' do
|
21
21
|
it "behaves similar to a Rails link_to" do
|
22
|
-
subject.link_to_add("Add", :tasks).should == '<a href="javascript:void(0)" class="add_nested_fields" data-association="tasks">Add</a>'
|
23
|
-
subject.link_to_add("Add", :tasks, :class => "foo", :href => "url").should == '<a href="url" class="foo add_nested_fields" data-association="tasks">Add</a>'
|
24
|
-
subject.link_to_add(:tasks) { "Add" }.should == '<a href="javascript:void(0)" class="add_nested_fields" data-association="tasks">Add</a>'
|
22
|
+
subject.link_to_add("Add", :tasks).should == '<a href="javascript:void(0)" class="add_nested_fields" data-association="tasks" data-blueprint-id="tasks_fields_blueprint">Add</a>'
|
23
|
+
subject.link_to_add("Add", :tasks, :class => "foo", :href => "url").should == '<a href="url" class="foo add_nested_fields" data-association="tasks" data-blueprint-id="tasks_fields_blueprint">Add</a>'
|
24
|
+
subject.link_to_add(:tasks) { "Add" }.should == '<a href="javascript:void(0)" class="add_nested_fields" data-association="tasks" data-blueprint-id="tasks_fields_blueprint">Add</a>'
|
25
25
|
end
|
26
26
|
|
27
27
|
context 'when missing association is provided' do
|
@@ -77,13 +77,58 @@ require "spec_helper"
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
-
it "
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
80
|
+
it "wraps nested fields marked for destruction with an additional class" do
|
81
|
+
task = project.tasks.build
|
82
|
+
task.mark_for_destruction
|
83
|
+
fields = subject.fields_for(:tasks) { 'Task' }
|
84
|
+
fields.should eq('<div class="fields marked_for_destruction">Task</div>')
|
85
|
+
end
|
86
|
+
|
87
|
+
it "puts blueprint into data-blueprint attribute" do
|
88
|
+
task = project.tasks.build
|
89
|
+
task.mark_for_destruction
|
90
|
+
subject.fields_for(:tasks) { 'Task' }
|
91
|
+
subject.link_to_add('Add', :tasks)
|
92
|
+
output = template.send(:after_nested_form_callbacks)
|
93
|
+
expected = ERB::Util.html_escape '<div class="fields">Task</div>'
|
94
|
+
output.should match(/div.+data-blueprint="#{expected}"/)
|
95
|
+
end
|
96
|
+
|
97
|
+
it "adds parent association name to the blueprint div id" do
|
98
|
+
task = project.tasks.build
|
99
|
+
task.milestones.build
|
100
|
+
subject.fields_for(:tasks, :builder => builder) do |tf|
|
101
|
+
tf.fields_for(:milestones, :builder => builder) { 'Milestone' }
|
102
|
+
tf.link_to_add('Add', :milestones)
|
103
|
+
end
|
104
|
+
output = template.send(:after_nested_form_callbacks)
|
105
|
+
output.should match(/div.+id="tasks_milestones_fields_blueprint"/)
|
106
|
+
end
|
107
|
+
|
108
|
+
it "doesn't render wrapper div" do
|
109
|
+
task = project.tasks.build
|
110
|
+
fields = subject.fields_for(:tasks, :wrapper => false) { 'Task' }
|
111
|
+
|
112
|
+
fields.should eq('Task')
|
113
|
+
|
114
|
+
subject.link_to_add 'Add', :tasks
|
115
|
+
output = template.send(:after_nested_form_callbacks)
|
116
|
+
|
117
|
+
output.should match(/div.+data-blueprint="Task"/)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
context "with options" do
|
122
|
+
subject { builder.new(:item, project, template, {}, proc {}) }
|
123
|
+
|
124
|
+
context "when model_object given" do
|
125
|
+
it "should use it instead of new generated" do
|
126
|
+
subject.fields_for(:tasks) {|f| f.object.name }
|
127
|
+
subject.link_to_add("Add", :tasks, :model_object => Task.new(:name => 'for check'))
|
128
|
+
output = template.send(:after_nested_form_callbacks)
|
129
|
+
expected = ERB::Util.html_escape '<div class="fields">for check</div>'
|
130
|
+
output.should match(/div.+data-blueprint="#{expected}"/)
|
131
|
+
end
|
87
132
|
end
|
88
133
|
end
|
89
134
|
end
|
@@ -37,6 +37,14 @@ describe NestedForm::ViewHelper do
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
+
if defined?(NestedForm::FormtasticBootstrapBuilder)
|
41
|
+
it "should pass instance of NestedForm::FormtasticBootstrapBuilder to semantic_bootstrap_nested_form_for block" do
|
42
|
+
_view.semantic_bootstrap_nested_form_for(Project.new) do |f|
|
43
|
+
f.should be_instance_of(NestedForm::FormtasticBootstrapBuilder)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
40
48
|
it "should append content to end of nested form" do
|
41
49
|
_view.after_nested_form(:tasks) { _view.concat("123") }
|
42
50
|
_view.after_nested_form(:milestones) { _view.concat("456") }
|
@@ -7,21 +7,22 @@ jQuery(function($) {
|
|
7
7
|
NestedFormEvents.prototype = {
|
8
8
|
addFields: function(e) {
|
9
9
|
// Setup
|
10
|
-
var link
|
11
|
-
var assoc
|
12
|
-
var
|
10
|
+
var link = e.currentTarget;
|
11
|
+
var assoc = $(link).data('association'); // Name of child
|
12
|
+
var blueprint = $('#' + $(link).data('blueprint-id'));
|
13
|
+
var content = blueprint.data('blueprint'); // Fields template
|
13
14
|
|
14
|
-
// Make the context correct by replacing
|
15
|
+
// Make the context correct by replacing <parents> with the generated ID
|
15
16
|
// of each of the parent objects
|
16
|
-
var context = ($(link).closest('.fields').closestChild('input, textarea').eq(0).attr('name') || '').replace(new RegExp('\[[a-
|
17
|
+
var context = ($(link).closest('.fields').closestChild('input, textarea, select').eq(0).attr('name') || '').replace(new RegExp('\[[a-z_]+\]$'), '');
|
17
18
|
|
18
19
|
// context will be something like this for a brand new form:
|
19
|
-
// project[tasks_attributes][
|
20
|
+
// project[tasks_attributes][1255929127459][assignments_attributes][1255929128105]
|
20
21
|
// or for an edit form:
|
21
22
|
// project[tasks_attributes][0][assignments_attributes][1]
|
22
23
|
if (context) {
|
23
24
|
var parentNames = context.match(/[a-z_]+_attributes/g) || [];
|
24
|
-
var parentIds = context.match(/
|
25
|
+
var parentIds = context.match(/[0-9]+/g) || [];
|
25
26
|
|
26
27
|
for(var i = 0; i < parentNames.length; i++) {
|
27
28
|
if(parentIds[i]) {
|
@@ -39,7 +40,7 @@ jQuery(function($) {
|
|
39
40
|
// Make a unique ID for the new child
|
40
41
|
var regexp = new RegExp('new_' + assoc, 'g');
|
41
42
|
var new_id = new Date().getTime();
|
42
|
-
content = content.replace(regexp,
|
43
|
+
content = content.replace(regexp, new_id);
|
43
44
|
|
44
45
|
var field = this.insertFields(content, assoc, link);
|
45
46
|
// bubble up event upto document (through form)
|
@@ -69,9 +70,11 @@ jQuery(function($) {
|
|
69
70
|
};
|
70
71
|
|
71
72
|
window.nestedFormEvents = new NestedFormEvents();
|
72
|
-
$(
|
73
|
-
|
73
|
+
$(document)
|
74
|
+
.delegate('form a.add_nested_fields', 'click', nestedFormEvents.addFields)
|
75
|
+
.delegate('form a.remove_nested_fields', 'click', nestedFormEvents.removeFields);
|
74
76
|
});
|
77
|
+
|
75
78
|
// http://plugins.jquery.com/project/closestChild
|
76
79
|
/*
|
77
80
|
* Copyright 2011, Tobias Lindig
|
@@ -1,20 +1,21 @@
|
|
1
1
|
document.observe('click', function(e, el) {
|
2
2
|
if (el = e.findElement('form a.add_nested_fields')) {
|
3
3
|
// Setup
|
4
|
-
var assoc
|
5
|
-
var
|
4
|
+
var assoc = el.readAttribute('data-association'); // Name of child
|
5
|
+
var blueprint = $(el.readAttribute('data-blueprint-id'));
|
6
|
+
var content = blueprint.readAttribute('data-blueprint'); // Fields template
|
6
7
|
|
7
|
-
// Make the context correct by replacing
|
8
|
+
// Make the context correct by replacing <parents> with the generated ID
|
8
9
|
// of each of the parent objects
|
9
|
-
var context = (el.getOffsetParent('.fields').firstDescendant().readAttribute('name') || '').replace(new RegExp('\[[a-
|
10
|
+
var context = (el.getOffsetParent('.fields').firstDescendant().readAttribute('name') || '').replace(new RegExp('\[[a-z_]+\]$'), '');
|
10
11
|
|
11
12
|
// context will be something like this for a brand new form:
|
12
|
-
// project[tasks_attributes][
|
13
|
+
// project[tasks_attributes][1255929127459][assignments_attributes][1255929128105]
|
13
14
|
// or for an edit form:
|
14
15
|
// project[tasks_attributes][0][assignments_attributes][1]
|
15
16
|
if(context) {
|
16
17
|
var parent_names = context.match(/[a-z_]+_attributes/g) || [];
|
17
|
-
var parent_ids = context.match(/
|
18
|
+
var parent_ids = context.match(/[0-9]+/g) || [];
|
18
19
|
|
19
20
|
for(i = 0; i < parent_names.length; i++) {
|
20
21
|
if(parent_ids[i]) {
|
@@ -32,7 +33,7 @@ document.observe('click', function(e, el) {
|
|
32
33
|
// Make a unique ID for the new child
|
33
34
|
var regexp = new RegExp('new_' + assoc, 'g');
|
34
35
|
var new_id = new Date().getTime();
|
35
|
-
content = content.replace(regexp,
|
36
|
+
content = content.replace(regexp, new_id);
|
36
37
|
|
37
38
|
var field = el.insert({ before: content });
|
38
39
|
field.fire('nested:fieldAdded', {field: field});
|
metadata
CHANGED
@@ -1,90 +1,88 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: nested_form
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 3
|
10
|
-
version: 0.2.3
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Ryan Bates
|
14
9
|
- Andrea Singh
|
15
10
|
autorequire:
|
16
11
|
bindir: bin
|
17
12
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
dependencies:
|
22
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2012-10-23 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
23
16
|
name: rake
|
24
|
-
|
25
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
26
18
|
none: false
|
27
|
-
requirements:
|
28
|
-
- -
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
|
31
|
-
segments:
|
32
|
-
- 0
|
33
|
-
version: "0"
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
34
23
|
type: :development
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: bundler
|
38
24
|
prerelease: false
|
39
|
-
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0'
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: bundler
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
40
34
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
version: "0"
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
48
39
|
type: :development
|
49
|
-
version_requirements: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: rspec-rails
|
52
40
|
prerelease: false
|
53
|
-
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rspec-rails
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
54
50
|
none: false
|
55
|
-
requirements:
|
51
|
+
requirements:
|
56
52
|
- - ~>
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
|
59
|
-
segments:
|
60
|
-
- 2
|
61
|
-
- 6
|
62
|
-
version: "2.6"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.6'
|
63
55
|
type: :development
|
64
|
-
version_requirements: *id003
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
name: mocha
|
67
56
|
prerelease: false
|
68
|
-
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ~>
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '2.6'
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: mocha
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
69
66
|
none: false
|
70
|
-
requirements:
|
71
|
-
- -
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
|
74
|
-
segments:
|
75
|
-
- 0
|
76
|
-
version: "0"
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
77
71
|
type: :development
|
78
|
-
|
79
|
-
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
description: Gem to conveniently handle multiple models in a single form with Rails
|
80
|
+
3 and jQuery or Prototype.
|
80
81
|
email: ryan@railscasts.com
|
81
82
|
executables: []
|
82
|
-
|
83
83
|
extensions: []
|
84
|
-
|
85
84
|
extra_rdoc_files: []
|
86
|
-
|
87
|
-
files:
|
85
|
+
files:
|
88
86
|
- lib/generators/nested_form/install_generator.rb
|
89
87
|
- lib/nested_form/builder_mixin.rb
|
90
88
|
- lib/nested_form/builders.rb
|
@@ -161,7 +159,6 @@ files:
|
|
161
159
|
- spec/dummy/tmp/cache/assets/E54/400/sprockets%2Fd0cbc16cc37efcf9dc41f242b5dbbf81
|
162
160
|
- spec/dummy/tmp/cache/assets/EB7/AB0/sprockets%2F801d29a5debdbfbfb4eef14d70d9bcdb
|
163
161
|
- spec/dummy/tmp/cache/assets/F48/5E0/sprockets%2F26cd6ffcffbebbe2fd6cd1a8f0c2debc
|
164
|
-
- spec/dummy/tmp/capybara/capybara-201208212241496415482929.html
|
165
162
|
- spec/events_spec.rb
|
166
163
|
- spec/form_spec.rb
|
167
164
|
- spec/nested_form/builder_spec.rb
|
@@ -170,45 +167,33 @@ files:
|
|
170
167
|
- vendor/assets/javascripts/jquery_nested_form.js
|
171
168
|
- vendor/assets/javascripts/prototype_nested_form.js
|
172
169
|
- CHANGELOG.rdoc
|
170
|
+
- CONTRIBUTING.md
|
173
171
|
- Gemfile
|
174
172
|
- LICENSE
|
175
173
|
- Rakefile
|
176
174
|
- README.md
|
177
|
-
has_rdoc: true
|
178
175
|
homepage: http://github.com/ryanb/nested_form
|
179
176
|
licenses: []
|
180
|
-
|
181
177
|
post_install_message:
|
182
178
|
rdoc_options: []
|
183
|
-
|
184
|
-
require_paths:
|
179
|
+
require_paths:
|
185
180
|
- lib
|
186
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
181
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
187
182
|
none: false
|
188
|
-
requirements:
|
189
|
-
- -
|
190
|
-
- !ruby/object:Gem::Version
|
191
|
-
|
192
|
-
|
193
|
-
- 0
|
194
|
-
version: "0"
|
195
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
183
|
+
requirements:
|
184
|
+
- - ! '>='
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '0'
|
187
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
188
|
none: false
|
197
|
-
requirements:
|
198
|
-
- -
|
199
|
-
- !ruby/object:Gem::Version
|
200
|
-
hash: 19
|
201
|
-
segments:
|
202
|
-
- 1
|
203
|
-
- 3
|
204
|
-
- 4
|
189
|
+
requirements:
|
190
|
+
- - ! '>='
|
191
|
+
- !ruby/object:Gem::Version
|
205
192
|
version: 1.3.4
|
206
193
|
requirements: []
|
207
|
-
|
208
194
|
rubyforge_project: nested_form
|
209
|
-
rubygems_version: 1.
|
195
|
+
rubygems_version: 1.8.23
|
210
196
|
signing_key:
|
211
197
|
specification_version: 3
|
212
198
|
summary: Gem to conveniently handle multiple models in a single form.
|
213
199
|
test_files: []
|
214
|
-
|
@@ -1,31 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html xmlns="http://www.w3.org/1999/xhtml"><head>
|
3
|
-
<title>Dummy</title>
|
4
|
-
|
5
|
-
<script type="text/javascript" src="/assets/jquery.js"></script>
|
6
|
-
<script type="text/javascript" src="/assets/jquery_nested_form.js"></script>
|
7
|
-
<script type="text/javascript" src="/assets/jquery_events_test.js"></script>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
|
11
|
-
<form method="post" id="new_project" class="new_project" action="/projects" accept-charset="UTF-8"><div style="margin:0;padding:0;display:inline"><input type="hidden" value="✓" name="utf8" /></div> <div class="fields"> <div class="fields">
|
12
|
-
<input type="text" size="30" name="project[tasks_attributes][new_1345578109395][milestones_attributes][new_1345578109485][name]" id="project_tasks_attributes_new_1345578109395_tasks_milestones_attributes_new_1345578109485_name" />
|
13
|
-
<input type="hidden" value="false" name="project[tasks_attributes][new_1345578109395][milestones_attributes][new_1345578109485][_destroy]" id="project_tasks_attributes_new_1345578109395_tasks_milestones_attributes_new_1345578109485__destroy" /><a data-association="milestones" class="remove_nested_fields" href="javascript:void(0)">Remove milestone</a>
|
14
|
-
</div><div class="fields">
|
15
|
-
<input type="text" size="30" name="project[tasks_attributes][new_1345578109395][milestones_attributes][new_1345578109485][name]" id="project_tasks_attributes_new_1345578109395_tasks_milestones_attributes_new_1345578109485_milestones_name" />
|
16
|
-
<input type="hidden" value="false" name="project[tasks_attributes][new_1345578109395][milestones_attributes][new_1345578109485][_destroy]" id="project_tasks_attributes_new_1345578109395_tasks_milestones_attributes_new_1345578109485_milestones__destroy" /><a data-association="milestones" class="remove_nested_fields" href="javascript:void(0)">Remove milestone</a>
|
17
|
-
</div><a data-association="milestones" class="add_nested_fields" href="javascript:void(0)">Add new milestone</a>
|
18
|
-
<input type="hidden" value="false" name="project[tasks_attributes][new_1345578109395][_destroy]" id="project_tasks_attributes_new_1345578109395__destroy" /><a data-association="tasks" class="remove_nested_fields" href="javascript:void(0)">Remove</a>
|
19
|
-
</div><a data-association="tasks" class="add_nested_fields" href="javascript:void(0)">Add new task</a>
|
20
|
-
</form><div style="display: none" id="tasks_fields_blueprint"><div class="fields"> <a data-association="milestones" class="add_nested_fields" href="javascript:void(0)">Add new milestone</a>
|
21
|
-
<input type="hidden" value="false" name="project[tasks_attributes][new_tasks][_destroy]" id="project_tasks_attributes_new_tasks__destroy" /><a data-association="tasks" class="remove_nested_fields" href="javascript:void(0)">Remove</a>
|
22
|
-
</div></div> <div style="display: none" id="milestones_fields_blueprint"><div class="fields">
|
23
|
-
<input type="text" size="30" name="project[tasks_attributes][new_tasks][milestones_attributes][new_milestones][name]" id="project_tasks_attributes_new_tasks_milestones_attributes_new_milestones_name" />
|
24
|
-
<input type="hidden" value="false" name="project[tasks_attributes][new_tasks][milestones_attributes][new_milestones][_destroy]" id="project_tasks_attributes_new_tasks_milestones_attributes_new_milestones__destroy" /><a data-association="milestones" class="remove_nested_fields" href="javascript:void(0)">Remove milestone</a>
|
25
|
-
</div></div>
|
26
|
-
|
27
|
-
<div id="console"><p>Added some field</p><p>Added task field</p><p>Added some field</p><p>Added milestone field</p><p>Added some field</p><p>Added milestone field</p></div>
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
</body></html>
|