nested_fields 0.2.2 → 0.3.0
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.
- data/VERSION +1 -1
- data/app/controllers/nested_fields_controller.rb +6 -2
- data/app/views/nested_fields/_add_nested_fields.html.erb +2 -1
- data/app/views/nested_fields/_nested_fieldset.html.erb +3 -3
- data/app/views/nested_fields/_singular_nested_fieldset.html.erb +1 -1
- data/config/routes.rb +1 -1
- data/nested_fields.gemspec +3 -4
- data/public/javascripts/nested_fields.js +2 -1
- metadata +5 -23
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
@@ -6,10 +6,14 @@ class NestedFieldsController < ActionController::Base
|
|
6
6
|
@nested_partial = params[:nested_partial]
|
7
7
|
@parent_form = params[:parent_form]
|
8
8
|
|
9
|
-
|
9
|
+
parent_class = params[:parent_class].constantize
|
10
|
+
|
11
|
+
@objects = params[:copy_parent_id] ?
|
12
|
+
parent_class.find(params[:copy_parent_id]).send(@association).reverse :
|
13
|
+
Array.new(1, parent_class.reflect_on_association(@association).klass.new)
|
10
14
|
|
11
15
|
respond_to do |format|
|
12
|
-
format.js { render :partial => 'nested_fields/add_nested_fields' }
|
16
|
+
format.js { render :partial => 'nested_fields/add_nested_fields', :collection => @objects, :as => :object }
|
13
17
|
end
|
14
18
|
end
|
15
19
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
-
<%= fields_for "#@parent_form[#{@association}_attributes][#@index]",
|
1
|
+
<%= fields_for "#@parent_form[#{@association}_attributes][#@index#{object_counter}]",
|
2
|
+
object, :builder => @builder do |f| %>
|
2
3
|
<%= render 'nested_fields/block', :f => f, :nested_partial => @nested_partial %>
|
3
4
|
<% end %>
|
@@ -1,11 +1,11 @@
|
|
1
1
|
<% if local_assigns[:positioned_by] %>
|
2
|
-
<fieldset class="nested_fieldset positioned" data-positioned-by="<%= positioned_by %>">
|
2
|
+
<fieldset class="nested_fieldset positioned <%= association %>" data-positioned-by="<%= positioned_by %>">
|
3
3
|
<% else %>
|
4
|
-
<fieldset class="nested_fieldset">
|
4
|
+
<fieldset class="nested_fieldset <%= association %>">
|
5
5
|
<% end %>
|
6
6
|
<legend><%= local_assigns[:legend] || association.to_s.titleize %></legend>
|
7
7
|
|
8
|
-
<%= yield %>
|
8
|
+
<%= yield add_url %>
|
9
9
|
|
10
10
|
<a href="#" class="add_nested_fields" data-url="<%= add_url %>">Add</a>
|
11
11
|
|
data/config/routes.rb
CHANGED
data/nested_fields.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{nested_fields}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jason Murad"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-02-13}
|
13
13
|
s.description = %q{Unobtrusive dynamic nested forms}
|
14
14
|
s.email = %q{jason@thriess.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -38,7 +38,7 @@ Gem::Specification.new do |s|
|
|
38
38
|
s.homepage = %q{http://github.com/jrmurad/nested_fields}
|
39
39
|
s.licenses = ["MIT"]
|
40
40
|
s.require_paths = ["lib"]
|
41
|
-
s.rubygems_version = %q{1.
|
41
|
+
s.rubygems_version = %q{1.5.0}
|
42
42
|
s.summary = %q{Unobtrusive dynamic nested forms}
|
43
43
|
s.test_files = [
|
44
44
|
"test/helper.rb",
|
@@ -46,7 +46,6 @@ Gem::Specification.new do |s|
|
|
46
46
|
]
|
47
47
|
|
48
48
|
if s.respond_to? :specification_version then
|
49
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
50
49
|
s.specification_version = 3
|
51
50
|
|
52
51
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
@@ -7,6 +7,7 @@ $(document).ready(function() {
|
|
7
7
|
$('.add_nested_fields').live('click', function() {
|
8
8
|
$.ajax({
|
9
9
|
context: this,
|
10
|
+
dataType: 'html',
|
10
11
|
url: this.getAttribute('data-url'),
|
11
12
|
success: function(content) {
|
12
13
|
$(this).after(content);
|
@@ -35,7 +36,7 @@ function reposition(nested_fieldset, pos_fld) {
|
|
35
36
|
});
|
36
37
|
}
|
37
38
|
|
38
|
-
$('.
|
39
|
+
$('fieldset.positioned').live('nested_fields_ready', function() {
|
39
40
|
var pos_fld = this.getAttribute('data-positioned-by');
|
40
41
|
|
41
42
|
if (pos_fld) {
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nested_fields
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 2
|
8
|
-
- 2
|
9
|
-
version: 0.2.2
|
4
|
+
prerelease:
|
5
|
+
version: 0.3.0
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Jason Murad
|
@@ -14,7 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date: 2011-
|
13
|
+
date: 2011-02-13 00:00:00 -05:00
|
18
14
|
default_executable:
|
19
15
|
dependencies:
|
20
16
|
- !ruby/object:Gem::Dependency
|
@@ -24,8 +20,6 @@ dependencies:
|
|
24
20
|
requirements:
|
25
21
|
- - ">="
|
26
22
|
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 0
|
29
23
|
version: "0"
|
30
24
|
type: :development
|
31
25
|
prerelease: false
|
@@ -37,10 +31,6 @@ dependencies:
|
|
37
31
|
requirements:
|
38
32
|
- - ~>
|
39
33
|
- !ruby/object:Gem::Version
|
40
|
-
segments:
|
41
|
-
- 1
|
42
|
-
- 0
|
43
|
-
- 0
|
44
34
|
version: 1.0.0
|
45
35
|
type: :development
|
46
36
|
prerelease: false
|
@@ -52,10 +42,6 @@ dependencies:
|
|
52
42
|
requirements:
|
53
43
|
- - ~>
|
54
44
|
- !ruby/object:Gem::Version
|
55
|
-
segments:
|
56
|
-
- 1
|
57
|
-
- 5
|
58
|
-
- 1
|
59
45
|
version: 1.5.1
|
60
46
|
type: :development
|
61
47
|
prerelease: false
|
@@ -67,8 +53,6 @@ dependencies:
|
|
67
53
|
requirements:
|
68
54
|
- - ">="
|
69
55
|
- !ruby/object:Gem::Version
|
70
|
-
segments:
|
71
|
-
- 0
|
72
56
|
version: "0"
|
73
57
|
type: :development
|
74
58
|
prerelease: false
|
@@ -114,7 +98,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
114
98
|
requirements:
|
115
99
|
- - ">="
|
116
100
|
- !ruby/object:Gem::Version
|
117
|
-
hash:
|
101
|
+
hash: -167820414298998814
|
118
102
|
segments:
|
119
103
|
- 0
|
120
104
|
version: "0"
|
@@ -123,13 +107,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
107
|
requirements:
|
124
108
|
- - ">="
|
125
109
|
- !ruby/object:Gem::Version
|
126
|
-
segments:
|
127
|
-
- 0
|
128
110
|
version: "0"
|
129
111
|
requirements: []
|
130
112
|
|
131
113
|
rubyforge_project:
|
132
|
-
rubygems_version: 1.
|
114
|
+
rubygems_version: 1.5.0
|
133
115
|
signing_key:
|
134
116
|
specification_version: 3
|
135
117
|
summary: Unobtrusive dynamic nested forms
|