nested_form_fields 0.8 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/README.md +2 -2
- data/lib/nested_form_fields.rb +6 -5
- data/lib/nested_form_fields/version.rb +1 -1
- data/nested_form_fields.gemspec +4 -2
- data/spec/spec_helper.rb +4 -0
- metadata +36 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56da1a0f390e6f027abca007ff8e4704ea777e4f
|
4
|
+
data.tar.gz: 0ab484a12f0baf27c4f9a544493689793b6075dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e25a78e217dfc990c4027a37cd09eb87ec142919b92aa71f16274451e4f526513ad71083a00517822877e98364ccc1372b92695c5737e6b140933f6c4627e58
|
7
|
+
data.tar.gz: 0b9ddcc66ddb5b65120c36e979398af8a8bced4d14aa814a726837aff2738cd21df5a3a28c61fec836309854f8eb064becd6bd4d7b47dac39ecea84765ca095b
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -191,10 +191,10 @@ $(document).on "fields_added.nested_form_fields", (event, param) ->
|
|
191
191
|
## Index replacement string
|
192
192
|
|
193
193
|
Sometimes your code needs to know what index it has when it is instantiated onto the page.
|
194
|
-
HTML data elements may need point to other form elements for instance.
|
194
|
+
HTML data elements may need to point to other form elements for instance. This is needed for integration
|
195
195
|
with rails3-jquery-autocomplete.
|
196
196
|
|
197
|
-
To enable string substitution with the current index use the magic string
|
197
|
+
To enable string substitution with the current index use the magic string `__nested_field_for_replace_with_index__`.
|
198
198
|
|
199
199
|
## Contributing
|
200
200
|
|
data/lib/nested_form_fields.rb
CHANGED
@@ -75,11 +75,12 @@ module ActionView::Helpers
|
|
75
75
|
wrapper_options[:style] = wrapper_options[:style] ? wrapper_options[:style] + ';' + 'display:none' : 'display:none'
|
76
76
|
output << destroy_hidden_field(association_name, index)
|
77
77
|
end
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
78
|
+
|
79
|
+
# Build the wrapper + content and do substitution with the current index allows JS functions to have proper references
|
80
|
+
wrapped_block = nested_fields_wrapper(association_name, options[:wrapper_tag], options[:legend], wrapper_options) do
|
81
|
+
fields_for_nested_model("#{name}[#{options[:child_index] || nested_child_index(name)}]", child, options, block)
|
82
82
|
end
|
83
|
+
output << wrapped_block.gsub('__nested_field_for_replace_with_index__', index.to_s).html_safe
|
83
84
|
end
|
84
85
|
|
85
86
|
output << nested_model_template(name, association_name, options, block)
|
@@ -115,7 +116,7 @@ module ActionView::Helpers
|
|
115
116
|
end
|
116
117
|
|
117
118
|
def association_path association_name
|
118
|
-
"#{object_name.gsub('][','_').gsub(/_attributes/,'').sub('[','_').sub(']','')}_#{association_name}"
|
119
|
+
"#{object_name.to_s.gsub('][','_').gsub(/_attributes/,'').sub('[','_').sub(']','')}_#{association_name}"
|
119
120
|
end
|
120
121
|
|
121
122
|
def index_placeholder association_name
|
data/nested_form_fields.gemspec
CHANGED
@@ -21,13 +21,15 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.add_dependency 'coffee-rails', '>= 3.2.1'
|
22
22
|
gem.add_dependency 'jquery-rails'
|
23
23
|
|
24
|
-
gem.add_development_dependency 'rspec-rails', '~>
|
24
|
+
gem.add_development_dependency 'rspec-rails', '~> 3.5'
|
25
|
+
gem.add_development_dependency 'nokogiri', '1.6.8.1'
|
25
26
|
gem.add_development_dependency 'assert_difference'
|
26
27
|
gem.add_development_dependency 'capybara'
|
27
|
-
gem.add_development_dependency 'selenium-webdriver'
|
28
|
+
gem.add_development_dependency 'selenium-webdriver', '2.53.4'
|
28
29
|
gem.add_development_dependency 'sqlite3'
|
29
30
|
gem.add_development_dependency 'haml', '>= 3.1.5'
|
30
31
|
gem.add_development_dependency 'haml-rails'
|
31
32
|
gem.add_development_dependency 'sass-rails', '~> 3.2.3'
|
32
33
|
gem.add_development_dependency 'test-unit', '1.2.3'
|
34
|
+
gem.add_development_dependency 'public_suffix', '~> 1.4.6'
|
33
35
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -9,6 +9,10 @@ ENV["RAILS_ENV"] = 'test'
|
|
9
9
|
require_relative "dummy/config/environment"
|
10
10
|
|
11
11
|
require 'rspec/rails'
|
12
|
+
|
13
|
+
# prevent Test::Unit's AutoRunner from executing during RSpec's rake task see https://github.com/rspec/rspec-rails/issues/1171
|
14
|
+
Test::Unit.run = true if defined?(Test::Unit) && Test::Unit.respond_to?(:run=)
|
15
|
+
|
12
16
|
require 'assert_difference'
|
13
17
|
require 'sqlite3'
|
14
18
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nested_form_fields
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nico Ritsche
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -58,14 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '3.5'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '3.5'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: nokogiri
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.6.8.1
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.6.8.1
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: assert_difference
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,16 +112,16 @@ dependencies:
|
|
98
112
|
name: selenium-webdriver
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- -
|
115
|
+
- - '='
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
117
|
+
version: 2.53.4
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
|
-
- -
|
122
|
+
- - '='
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
124
|
+
version: 2.53.4
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: sqlite3
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,6 +192,20 @@ dependencies:
|
|
178
192
|
- - '='
|
179
193
|
- !ruby/object:Gem::Version
|
180
194
|
version: 1.2.3
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: public_suffix
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - "~>"
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: 1.4.6
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - "~>"
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: 1.4.6
|
181
209
|
description: |-
|
182
210
|
Rails gem for dynamically adding and removing nested has_many association fields in a form.
|
183
211
|
Uses jQuery and supports multiple nesting levels. Requires Ruby 1.9+ and the asset pipeline.
|
@@ -194,8 +222,6 @@ files:
|
|
194
222
|
- LICENSE
|
195
223
|
- README.md
|
196
224
|
- Rakefile
|
197
|
-
- lib/assets/.DS_Store
|
198
|
-
- lib/assets/javascripts/.DS_Store
|
199
225
|
- lib/assets/javascripts/nested_form_fields.js.coffee
|
200
226
|
- lib/nested_form_fields.rb
|
201
227
|
- lib/nested_form_fields/version.rb
|