nested_form 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +12 -0
- data/README.md +165 -0
- data/Rakefile +7 -0
- data/lib/nested_form/builder_mixin.rb +13 -1
- data/spec/dummy/app/assets/javascripts/jquery_events_test.js +19 -0
- data/spec/dummy/app/assets/javascripts/jquery_nested_form.js +42 -10
- data/spec/dummy/app/assets/javascripts/prototype_events_test.js +20 -0
- data/spec/dummy/app/assets/javascripts/prototype_nested_form.js +37 -32
- data/spec/dummy/app/models/project.rb +2 -0
- data/spec/dummy/app/models/project_task.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +8 -0
- data/spec/dummy/app/views/projects/new.html.erb +0 -6
- data/spec/dummy/app/views/projects/without_intermediate_inputs.html.erb +11 -0
- data/spec/dummy/config/routes.rb +3 -1
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20120819164528_add_association_with_class_name.rb +12 -0
- data/spec/dummy/db/schema.rb +6 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +91 -0
- data/spec/dummy/log/test.log +710 -25
- 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/dummy/tmp/capybara/capybara-201208212241496415482929.html +31 -0
- data/spec/events_spec.rb +60 -0
- data/spec/form_spec.rb +9 -0
- data/spec/nested_form/builder_spec.rb +67 -19
- data/vendor/assets/javascripts/jquery_nested_form.js +42 -10
- data/vendor/assets/javascripts/prototype_nested_form.js +37 -32
- metadata +102 -72
- data/README.rdoc +0 -101
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
|
@@ -0,0 +1,31 @@
|
|
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>
|
data/spec/events_spec.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Nested form', :js => true do
|
4
|
+
include Capybara::DSL
|
5
|
+
|
6
|
+
[:jquery, :prototype].each do |js_framework|
|
7
|
+
|
8
|
+
url = case js_framework
|
9
|
+
when :jquery then '/projects/new'
|
10
|
+
when :prototype then '/projects/new?type=prototype'
|
11
|
+
end
|
12
|
+
|
13
|
+
context "with #{js_framework}" do
|
14
|
+
context 'when field was added' do
|
15
|
+
it 'emits general add event' do
|
16
|
+
visit url
|
17
|
+
click_link 'Add new task'
|
18
|
+
|
19
|
+
page.should have_content 'Added some field'
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'emits add event for current association' do
|
23
|
+
visit url
|
24
|
+
click_link 'Add new task'
|
25
|
+
|
26
|
+
page.should have_content 'Added task field'
|
27
|
+
page.should_not have_content 'Added milestone field'
|
28
|
+
|
29
|
+
click_link 'Add new milestone'
|
30
|
+
|
31
|
+
page.should have_content 'Added milestone field'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'when field was removed' do
|
36
|
+
it 'emits general remove event' do
|
37
|
+
visit url
|
38
|
+
click_link 'Add new task'
|
39
|
+
click_link 'Remove'
|
40
|
+
|
41
|
+
page.should have_content 'Removed some field'
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'emits remove event for current association' do
|
45
|
+
visit url
|
46
|
+
2.times { click_link 'Add new task' }
|
47
|
+
click_link 'Remove'
|
48
|
+
|
49
|
+
page.should have_content 'Removed task field'
|
50
|
+
page.should_not have_content 'Removed milestone field'
|
51
|
+
|
52
|
+
click_link 'Add new milestone'
|
53
|
+
click_link 'Remove milestone'
|
54
|
+
|
55
|
+
page.should have_content 'Removed milestone field'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
data/spec/form_spec.rb
CHANGED
@@ -31,6 +31,15 @@ describe 'NestedForm' do
|
|
31
31
|
check_form
|
32
32
|
end
|
33
33
|
|
34
|
+
it 'works when there are no inputs for intermediate association', :js => true do
|
35
|
+
visit '/projects/without_intermediate_inputs'
|
36
|
+
click_link 'Add new task'
|
37
|
+
click_link 'Add new milestone'
|
38
|
+
click_link 'Add new milestone'
|
39
|
+
inputs = all('.fields .fields input[id$=name]')
|
40
|
+
inputs.first[:name].should_not eq(inputs.last[:name])
|
41
|
+
end
|
42
|
+
|
34
43
|
it 'generates correct name for the nested input', :js => true do
|
35
44
|
visit '/projects/new?type=jquery'
|
36
45
|
click_link 'Add new task'
|
@@ -2,31 +2,79 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
[NestedForm::Builder, NestedForm::SimpleBuilder, defined?(NestedForm::FormtasticBuilder) ? NestedForm::FormtasticBuilder : nil].compact.each do |builder|
|
4
4
|
describe builder do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
let(:project) do
|
6
|
+
Project.new
|
7
|
+
end
|
8
|
+
|
9
|
+
let(:template) do
|
10
|
+
template = ActionView::Base.new
|
11
|
+
template.output_buffer = ""
|
12
|
+
template
|
13
|
+
end
|
14
|
+
|
15
|
+
context "with no options" do
|
16
|
+
subject do
|
17
|
+
builder.new(:item, project, template, {}, proc {})
|
11
18
|
end
|
12
19
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
20
|
+
describe '#link_to_add' do
|
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>'
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'when missing association is provided' do
|
28
|
+
it 'raises Argument error' do
|
29
|
+
expect{ subject.link_to_add('Add', :bugs) }.to raise_error(ArgumentError,
|
30
|
+
'Failed to find Project association by name "bugs"')
|
31
|
+
end
|
32
|
+
end
|
17
33
|
end
|
34
|
+
|
35
|
+
describe '#link_to_remove' do
|
36
|
+
it "behaves similar to a Rails link_to" do
|
37
|
+
subject.link_to_remove("Remove").should == '<input id="item__destroy" name="item[_destroy]" type="hidden" value="false" /><a href="javascript:void(0)" class="remove_nested_fields">Remove</a>'
|
38
|
+
subject.link_to_remove("Remove", :class => "foo", :href => "url").should == '<input id="item__destroy" name="item[_destroy]" type="hidden" value="false" /><a href="url" class="foo remove_nested_fields">Remove</a>'
|
39
|
+
subject.link_to_remove { "Remove" }.should == '<input id="item__destroy" name="item[_destroy]" type="hidden" value="false" /><a href="javascript:void(0)" class="remove_nested_fields">Remove</a>'
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'has data-association attribute' do
|
43
|
+
project.tasks.build
|
44
|
+
subject.fields_for(:tasks, :builder => builder) do |tf|
|
45
|
+
tf.link_to_remove 'Remove'
|
46
|
+
end.should match '<a.+data-association="tasks">Remove</a>'
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'when association is declared in a model by the class_name' do
|
50
|
+
it 'properly detects association name' do
|
51
|
+
project.assignments.build
|
52
|
+
subject.fields_for(:assignments, :builder => builder) do |tf|
|
53
|
+
tf.link_to_remove 'Remove'
|
54
|
+
end.should match '<a.+data-association="assignments">Remove</a>'
|
55
|
+
end
|
56
|
+
end
|
18
57
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
58
|
+
context 'when there is more than one nested level' do
|
59
|
+
it 'properly detects association name' do
|
60
|
+
task = project.tasks.build
|
61
|
+
task.milestones.build
|
62
|
+
subject.fields_for(:tasks, :builder => builder) do |tf|
|
63
|
+
tf.fields_for(:milestones, :builder => builder) do |mf|
|
64
|
+
mf.link_to_remove 'Remove'
|
65
|
+
end
|
66
|
+
end.should match '<a.+data-association="milestones">Remove</a>'
|
67
|
+
end
|
68
|
+
end
|
23
69
|
end
|
24
70
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
71
|
+
describe '#fields_for' do
|
72
|
+
it "wraps nested fields each in a div with class" do
|
73
|
+
2.times { project.tasks.build }
|
74
|
+
subject.fields_for(:tasks) do
|
75
|
+
"Task"
|
76
|
+
end.should == '<div class="fields">Task</div><div class="fields">Task</div>'
|
77
|
+
end
|
30
78
|
end
|
31
79
|
|
32
80
|
it "should add task fields to hidden div after form" do
|
@@ -13,7 +13,7 @@ jQuery(function($) {
|
|
13
13
|
|
14
14
|
// Make the context correct by replacing new_<parents> with the generated ID
|
15
15
|
// of each of the parent objects
|
16
|
-
var context = ($(link).closest('.fields').
|
16
|
+
var context = ($(link).closest('.fields').closestChild('input, textarea').eq(0).attr('name') || '').replace(new RegExp('\[[a-z]+\]$'), '');
|
17
17
|
|
18
18
|
// context will be something like this for a brand new form:
|
19
19
|
// project[tasks_attributes][new_1255929127459][assignments_attributes][new_1255929128105]
|
@@ -42,7 +42,8 @@ jQuery(function($) {
|
|
42
42
|
content = content.replace(regexp, "new_" + new_id);
|
43
43
|
|
44
44
|
var field = this.insertFields(content, assoc, link);
|
45
|
-
|
45
|
+
// bubble up event upto document (through form)
|
46
|
+
field
|
46
47
|
.trigger({ type: 'nested:fieldAdded', field: field })
|
47
48
|
.trigger({ type: 'nested:fieldAdded:' + assoc, field: field });
|
48
49
|
return false;
|
@@ -51,16 +52,18 @@ jQuery(function($) {
|
|
51
52
|
return $(content).insertBefore(link);
|
52
53
|
},
|
53
54
|
removeFields: function(e) {
|
54
|
-
var link = e.currentTarget
|
55
|
-
|
55
|
+
var $link = $(e.currentTarget),
|
56
|
+
assoc = $link.data('association'); // Name of child to be removed
|
57
|
+
|
58
|
+
var hiddenField = $link.prev('input[type=hidden]');
|
56
59
|
hiddenField.val('1');
|
57
|
-
|
58
|
-
|
59
|
-
// hiddenField.value = '1';
|
60
|
-
// }
|
61
|
-
var field = $(link).closest('.fields');
|
60
|
+
|
61
|
+
var field = $link.closest('.fields');
|
62
62
|
field.hide();
|
63
|
-
|
63
|
+
|
64
|
+
field
|
65
|
+
.trigger({ type: 'nested:fieldRemoved', field: field })
|
66
|
+
.trigger({ type: 'nested:fieldRemoved:' + assoc, field: field });
|
64
67
|
return false;
|
65
68
|
}
|
66
69
|
};
|
@@ -69,3 +72,32 @@ jQuery(function($) {
|
|
69
72
|
$('form a.add_nested_fields').live('click', nestedFormEvents.addFields);
|
70
73
|
$('form a.remove_nested_fields').live('click', nestedFormEvents.removeFields);
|
71
74
|
});
|
75
|
+
// http://plugins.jquery.com/project/closestChild
|
76
|
+
/*
|
77
|
+
* Copyright 2011, Tobias Lindig
|
78
|
+
*
|
79
|
+
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
80
|
+
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
81
|
+
*
|
82
|
+
*/
|
83
|
+
(function($) {
|
84
|
+
$.fn.closestChild = function(selector) {
|
85
|
+
// breadth first search for the first matched node
|
86
|
+
if (selector && selector != '') {
|
87
|
+
var queue = [];
|
88
|
+
queue.push(this);
|
89
|
+
while(queue.length > 0) {
|
90
|
+
var node = queue.shift();
|
91
|
+
var children = node.children();
|
92
|
+
for(var i = 0; i < children.length; ++i) {
|
93
|
+
var child = $(children[i]);
|
94
|
+
if (child.is(selector)) {
|
95
|
+
return child; //well, we found one
|
96
|
+
}
|
97
|
+
queue.push(child);
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
101
|
+
return $();//nothing found
|
102
|
+
};
|
103
|
+
})(jQuery);
|
@@ -1,22 +1,22 @@
|
|
1
1
|
document.observe('click', function(e, el) {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
if (el = e.findElement('form a.add_nested_fields')) {
|
3
|
+
// Setup
|
4
|
+
var assoc = el.readAttribute('data-association'); // Name of child
|
5
|
+
var content = $(assoc + '_fields_blueprint').innerHTML; // Fields template
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
// Make the context correct by replacing new_<parents> with the generated ID
|
8
|
+
// of each of the parent objects
|
9
|
+
var context = (el.getOffsetParent('.fields').firstDescendant().readAttribute('name') || '').replace(new RegExp('\[[a-z]+\]$'), '');
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
// context will be something like this for a brand new form:
|
12
|
+
// project[tasks_attributes][new_1255929127459][assignments_attributes][new_1255929128105]
|
13
|
+
// or for an edit form:
|
14
|
+
// project[tasks_attributes][0][assignments_attributes][1]
|
15
|
+
if(context) {
|
16
|
+
var parent_names = context.match(/[a-z_]+_attributes/g) || [];
|
17
|
+
var parent_ids = context.match(/(new_)?[0-9]+/g) || [];
|
18
18
|
|
19
|
-
|
19
|
+
for(i = 0; i < parent_names.length; i++) {
|
20
20
|
if(parent_ids[i]) {
|
21
21
|
content = content.replace(
|
22
22
|
new RegExp('(_' + parent_names[i] + ')_.+?_', 'g'),
|
@@ -26,26 +26,31 @@ document.observe('click', function(e, el) {
|
|
26
26
|
new RegExp('(\\[' + parent_names[i] + '\\])\\[.+?\\]', 'g'),
|
27
27
|
'$1[' + parent_ids[i] + ']');
|
28
28
|
}
|
29
|
-
|
30
|
-
|
29
|
+
}
|
30
|
+
}
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
// Make a unique ID for the new child
|
33
|
+
var regexp = new RegExp('new_' + assoc, 'g');
|
34
|
+
var new_id = new Date().getTime();
|
35
|
+
content = content.replace(regexp, "new_" + new_id);
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
var field = el.insert({ before: content });
|
38
|
+
field.fire('nested:fieldAdded', {field: field});
|
39
|
+
field.fire('nested:fieldAdded:' + assoc, {field: field});
|
40
|
+
return false;
|
41
|
+
}
|
40
42
|
});
|
41
43
|
|
42
44
|
document.observe('click', function(e, el) {
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
45
|
+
if (el = e.findElement('form a.remove_nested_fields')) {
|
46
|
+
var hidden_field = el.previous(0),
|
47
|
+
assoc = el.readAttribute('data-association'); // Name of child to be removed
|
48
|
+
if(hidden_field) {
|
49
|
+
hidden_field.value = '1';
|
50
|
+
}
|
51
|
+
var field = el.up('.fields').hide();
|
52
|
+
field.fire('nested:fieldRemoved', {field: field});
|
53
|
+
field.fire('nested:fieldRemoved:' + assoc, {field: field});
|
54
|
+
return false;
|
55
|
+
}
|
51
56
|
});
|
metadata
CHANGED
@@ -1,88 +1,90 @@
|
|
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
|
+
hash: 17
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 3
|
10
|
+
version: 0.2.3
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Ryan Bates
|
9
14
|
- Andrea Singh
|
10
15
|
autorequire:
|
11
16
|
bindir: bin
|
12
17
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
18
|
+
|
19
|
+
date: 2012-08-23 00:00:00 +03:00
|
20
|
+
default_executable:
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
16
23
|
name: rake
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
|
-
requirements:
|
20
|
-
- - ! '>='
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: '0'
|
23
|
-
type: :development
|
24
24
|
prerelease: false
|
25
|
-
|
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
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
34
26
|
none: false
|
35
|
-
requirements:
|
36
|
-
- -
|
37
|
-
- !ruby/object:Gem::Version
|
38
|
-
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
31
|
+
segments:
|
32
|
+
- 0
|
33
|
+
version: "0"
|
39
34
|
type: :development
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: bundler
|
40
38
|
prerelease: false
|
41
|
-
|
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
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
50
40
|
none: false
|
51
|
-
requirements:
|
52
|
-
- -
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
version: "0"
|
55
48
|
type: :development
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: rspec-rails
|
56
52
|
prerelease: false
|
57
|
-
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
58
54
|
none: false
|
59
|
-
requirements:
|
55
|
+
requirements:
|
60
56
|
- - ~>
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
requirements:
|
68
|
-
- - ! '>='
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: '0'
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 15
|
59
|
+
segments:
|
60
|
+
- 2
|
61
|
+
- 6
|
62
|
+
version: "2.6"
|
71
63
|
type: :development
|
64
|
+
version_requirements: *id003
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: mocha
|
72
67
|
prerelease: false
|
73
|
-
|
68
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
74
69
|
none: false
|
75
|
-
requirements:
|
76
|
-
- -
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
|
79
|
-
|
80
|
-
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 3
|
74
|
+
segments:
|
75
|
+
- 0
|
76
|
+
version: "0"
|
77
|
+
type: :development
|
78
|
+
version_requirements: *id004
|
79
|
+
description: Gem to conveniently handle multiple models in a single form with Rails 3 and jQuery or Prototype.
|
81
80
|
email: ryan@railscasts.com
|
82
81
|
executables: []
|
82
|
+
|
83
83
|
extensions: []
|
84
|
+
|
84
85
|
extra_rdoc_files: []
|
85
|
-
|
86
|
+
|
87
|
+
files:
|
86
88
|
- lib/generators/nested_form/install_generator.rb
|
87
89
|
- lib/nested_form/builder_mixin.rb
|
88
90
|
- lib/nested_form/builders.rb
|
@@ -91,9 +93,11 @@ files:
|
|
91
93
|
- lib/nested_form.rb
|
92
94
|
- spec/dummy/app/assets/javascripts/application.js
|
93
95
|
- spec/dummy/app/assets/javascripts/jquery.js
|
96
|
+
- spec/dummy/app/assets/javascripts/jquery_events_test.js
|
94
97
|
- spec/dummy/app/assets/javascripts/jquery_nested_form.js
|
95
98
|
- spec/dummy/app/assets/javascripts/projects.js
|
96
99
|
- spec/dummy/app/assets/javascripts/prototype.js
|
100
|
+
- spec/dummy/app/assets/javascripts/prototype_events_test.js
|
97
101
|
- spec/dummy/app/assets/javascripts/prototype_nested_form.js
|
98
102
|
- spec/dummy/app/assets/stylesheets/application.css
|
99
103
|
- spec/dummy/app/assets/stylesheets/projects.css
|
@@ -103,9 +107,11 @@ files:
|
|
103
107
|
- spec/dummy/app/helpers/projects_helper.rb
|
104
108
|
- spec/dummy/app/models/milestone.rb
|
105
109
|
- spec/dummy/app/models/project.rb
|
110
|
+
- spec/dummy/app/models/project_task.rb
|
106
111
|
- spec/dummy/app/models/task.rb
|
107
112
|
- spec/dummy/app/views/layouts/application.html.erb
|
108
113
|
- spec/dummy/app/views/projects/new.html.erb
|
114
|
+
- spec/dummy/app/views/projects/without_intermediate_inputs.html.erb
|
109
115
|
- spec/dummy/config/application.rb
|
110
116
|
- spec/dummy/config/boot.rb
|
111
117
|
- spec/dummy/config/database.yml
|
@@ -122,9 +128,12 @@ files:
|
|
122
128
|
- spec/dummy/config/locales/en.yml
|
123
129
|
- spec/dummy/config/routes.rb
|
124
130
|
- spec/dummy/config.ru
|
131
|
+
- spec/dummy/db/development.sqlite3
|
125
132
|
- spec/dummy/db/migrate/20110710143903_initial_tables.rb
|
133
|
+
- spec/dummy/db/migrate/20120819164528_add_association_with_class_name.rb
|
126
134
|
- spec/dummy/db/schema.rb
|
127
135
|
- spec/dummy/db/test.sqlite3
|
136
|
+
- spec/dummy/log/development.log
|
128
137
|
- spec/dummy/log/test.log
|
129
138
|
- spec/dummy/public/404.html
|
130
139
|
- spec/dummy/public/422.html
|
@@ -137,15 +146,23 @@ files:
|
|
137
146
|
- spec/dummy/tmp/cache/assets/C99/4D0/sprockets%2F5e30a6b911437f1428dc32c3ae182123
|
138
147
|
- spec/dummy/tmp/cache/assets/C99/7D0/sprockets%2F79513e6956e0ee8624976e041fd5636d
|
139
148
|
- spec/dummy/tmp/cache/assets/CAA/C90/sprockets%2F1e6c8ee1258009385ccf5b84015424b3
|
149
|
+
- spec/dummy/tmp/cache/assets/CB2/CB0/sprockets%2F11cc8d161d71a716dd36f16849d90870
|
150
|
+
- spec/dummy/tmp/cache/assets/CB7/7F0/sprockets%2Fac97b043470f6fcc925c352f16956643
|
140
151
|
- spec/dummy/tmp/cache/assets/CDB/8A0/sprockets%2Faed2a2575c376263c26e93b56b57051d
|
152
|
+
- spec/dummy/tmp/cache/assets/D1F/A10/sprockets%2F60317e62cb324bfd9987e8da9636fd06
|
153
|
+
- spec/dummy/tmp/cache/assets/D49/870/sprockets%2F90896142645585acc8baf56ad57e3afb
|
154
|
+
- spec/dummy/tmp/cache/assets/D62/F00/sprockets%2F6ac03a007f26b1c18ed3d53498ad3eb8
|
141
155
|
- spec/dummy/tmp/cache/assets/D79/BC0/sprockets%2F85a1db977361cc5130fcefb4637ff67e
|
142
156
|
- spec/dummy/tmp/cache/assets/D87/1F0/sprockets%2F61c9ceafb877fb740c67416ff6f782a9
|
143
157
|
- spec/dummy/tmp/cache/assets/DAD/4F0/sprockets%2F765acd1bf68dc90f7d3e61da78b1e659
|
144
158
|
- spec/dummy/tmp/cache/assets/E03/3F0/sprockets%2F82b37ae9eccec44c1ef44cfdd07d8534
|
145
159
|
- spec/dummy/tmp/cache/assets/E0A/CA0/sprockets%2F7fe72ac1c0db1a7e8e7f59cf25e8a39e
|
160
|
+
- spec/dummy/tmp/cache/assets/E3A/A60/sprockets%2F7c72c96cfc66454caf5fc8ca0fedd4f3
|
146
161
|
- spec/dummy/tmp/cache/assets/E54/400/sprockets%2Fd0cbc16cc37efcf9dc41f242b5dbbf81
|
147
162
|
- spec/dummy/tmp/cache/assets/EB7/AB0/sprockets%2F801d29a5debdbfbfb4eef14d70d9bcdb
|
148
163
|
- spec/dummy/tmp/cache/assets/F48/5E0/sprockets%2F26cd6ffcffbebbe2fd6cd1a8f0c2debc
|
164
|
+
- spec/dummy/tmp/capybara/capybara-201208212241496415482929.html
|
165
|
+
- spec/events_spec.rb
|
149
166
|
- spec/form_spec.rb
|
150
167
|
- spec/nested_form/builder_spec.rb
|
151
168
|
- spec/nested_form/view_helper_spec.rb
|
@@ -156,29 +173,42 @@ files:
|
|
156
173
|
- Gemfile
|
157
174
|
- LICENSE
|
158
175
|
- Rakefile
|
159
|
-
- README.
|
176
|
+
- README.md
|
177
|
+
has_rdoc: true
|
160
178
|
homepage: http://github.com/ryanb/nested_form
|
161
179
|
licenses: []
|
180
|
+
|
162
181
|
post_install_message:
|
163
182
|
rdoc_options: []
|
164
|
-
|
183
|
+
|
184
|
+
require_paths:
|
165
185
|
- lib
|
166
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
186
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
167
187
|
none: false
|
168
|
-
requirements:
|
169
|
-
- -
|
170
|
-
- !ruby/object:Gem::Version
|
171
|
-
|
172
|
-
|
188
|
+
requirements:
|
189
|
+
- - ">="
|
190
|
+
- !ruby/object:Gem::Version
|
191
|
+
hash: 3
|
192
|
+
segments:
|
193
|
+
- 0
|
194
|
+
version: "0"
|
195
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
196
|
none: false
|
174
|
-
requirements:
|
175
|
-
- -
|
176
|
-
- !ruby/object:Gem::Version
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
hash: 19
|
201
|
+
segments:
|
202
|
+
- 1
|
203
|
+
- 3
|
204
|
+
- 4
|
177
205
|
version: 1.3.4
|
178
206
|
requirements: []
|
207
|
+
|
179
208
|
rubyforge_project: nested_form
|
180
|
-
rubygems_version: 1.
|
209
|
+
rubygems_version: 1.6.2
|
181
210
|
signing_key:
|
182
211
|
specification_version: 3
|
183
212
|
summary: Gem to conveniently handle multiple models in a single form.
|
184
213
|
test_files: []
|
214
|
+
|