administrate-field-nested_has_many 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +3 -2
- data/.ruby-version +1 -1
- data/Appraisals +4 -0
- data/CHANGELOG.md +14 -0
- data/administrate-field-nested_has_many.gemspec +1 -1
- data/gemfiles/administrate_0.13.gemfile +8 -0
- data/gemfiles/administrate_0.13.gemfile.lock +207 -0
- data/lib/administrate/field/nested_has_many.rb +6 -2
- data/spec/dummy/app/models/school.rb +1 -1
- data/spec/dummy/config/routes.rb +1 -0
- data/spec/features/has_many_spec.rb +27 -0
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b4e4495fbe9f39dff627f5b1ddf7d82bc89d5e3a05433cc318f12ab7f02d004
|
4
|
+
data.tar.gz: f328a1f6dea3d663ee0d80454bf04a4d55530b1d2a520f1c884c1c6d78b714e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c1a6222bc8d033f871610444425f7c90b015f5b05c9ff2c47187d1f96b0a787a75dbf4f4442335c5f24788713c33f0f67e5e1d6d2677952e5970524366578d1
|
7
|
+
data.tar.gz: cc1b62f1e2eb55ca307c7ed7e1f41d5e6f172d604a8e8a986c98d05c0fa3115bdd3f2603d2a339af8c726a6c7404689fed09c4a483e56a24d513b91e0f733f18
|
data/.circleci/config.yml
CHANGED
@@ -4,16 +4,17 @@ jobs:
|
|
4
4
|
build:
|
5
5
|
working_directory: ~/administrate-field-nested_has_many
|
6
6
|
docker:
|
7
|
-
- image: circleci/ruby:2.
|
7
|
+
- image: circleci/ruby:2.7.0-node-browsers
|
8
8
|
environment:
|
9
9
|
PGHOST: localhost
|
10
10
|
PGUSER: administrate-field-nested_has_many
|
11
|
+
PGPASSWORD: administrate-field-nested_has_many
|
11
12
|
RAILS_ENV: test
|
12
13
|
- image: postgres:11
|
13
14
|
environment:
|
14
15
|
POSTGRES_USER: administrate-field-nested_has_many
|
15
16
|
POSTGRES_DB: administrate-field-nested_has_many_test
|
16
|
-
POSTGRES_PASSWORD:
|
17
|
+
POSTGRES_PASSWORD: administrate-field-nested_has_many
|
17
18
|
steps:
|
18
19
|
- checkout
|
19
20
|
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.7.0
|
data/Appraisals
CHANGED
@@ -4,6 +4,10 @@ appraise "administrate-0.10" do
|
|
4
4
|
gem "administrate", "0.10.0"
|
5
5
|
end
|
6
6
|
|
7
|
+
appraise "administrate-0.13" do
|
8
|
+
gem "administrate", "0.13.0"
|
9
|
+
end
|
10
|
+
|
7
11
|
appraise "administrate-master" do
|
8
12
|
gem "administrate", git: "https://github.com/thoughtbot/administrate", branch: "master"
|
9
13
|
end
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 1.3.0
|
4
|
+
|
5
|
+
* Cover more test cases ([#43][])
|
6
|
+
* Update form constructor to avoid undefined method ([#34][])
|
7
|
+
* Upgrade Ruby to 2.7.0 ([#27][])
|
8
|
+
* We need to use a node-browsers to run features ([#30][])
|
9
|
+
* Fix CI by explicitly setting a Postgres password ([#29][])
|
10
|
+
|
11
|
+
[#43]: https://github.com/nickcharlton/administrate-field-nested_has_many/pull/43
|
12
|
+
[#34]: https://github.com/nickcharlton/administrate-field-nested_has_many/pull/34
|
13
|
+
[#27]: https://github.com/nickcharlton/administrate-field-nested_has_many/pull/27
|
14
|
+
[#30]: https://github.com/nickcharlton/administrate-field-nested_has_many/pull/30
|
15
|
+
[#29]: https://github.com/nickcharlton/administrate-field-nested_has_many/pull/29
|
16
|
+
|
3
17
|
## 1.2.0
|
4
18
|
|
5
19
|
* Add support for namespaced models ([#24][])
|
@@ -2,7 +2,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = "administrate-field-nested_has_many"
|
5
|
-
gem.version = "1.
|
5
|
+
gem.version = "1.3.0"
|
6
6
|
gem.authors = ["Nick Charlton", "Grayson Wright"]
|
7
7
|
gem.email = ["nick@nickcharlton.net", "wright.grayson@gmail.com"]
|
8
8
|
gem.homepage = "https://github.com/nickcharlton/" \
|
@@ -0,0 +1,207 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
administrate-field-nested_has_many (1.2.0)
|
5
|
+
administrate (> 0.8, < 1)
|
6
|
+
cocoon (~> 1.2, >= 1.2.11)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actionpack (6.0.2.1)
|
12
|
+
actionview (= 6.0.2.1)
|
13
|
+
activesupport (= 6.0.2.1)
|
14
|
+
rack (~> 2.0, >= 2.0.8)
|
15
|
+
rack-test (>= 0.6.3)
|
16
|
+
rails-dom-testing (~> 2.0)
|
17
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
18
|
+
actionview (6.0.2.1)
|
19
|
+
activesupport (= 6.0.2.1)
|
20
|
+
builder (~> 3.1)
|
21
|
+
erubi (~> 1.4)
|
22
|
+
rails-dom-testing (~> 2.0)
|
23
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
24
|
+
activemodel (6.0.2.1)
|
25
|
+
activesupport (= 6.0.2.1)
|
26
|
+
activerecord (6.0.2.1)
|
27
|
+
activemodel (= 6.0.2.1)
|
28
|
+
activesupport (= 6.0.2.1)
|
29
|
+
activesupport (6.0.2.1)
|
30
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
31
|
+
i18n (>= 0.7, < 2)
|
32
|
+
minitest (~> 5.1)
|
33
|
+
tzinfo (~> 1.1)
|
34
|
+
zeitwerk (~> 2.2)
|
35
|
+
addressable (2.7.0)
|
36
|
+
public_suffix (>= 2.0.2, < 5.0)
|
37
|
+
administrate (0.13.0)
|
38
|
+
actionpack (>= 4.2)
|
39
|
+
actionview (>= 4.2)
|
40
|
+
activerecord (>= 4.2)
|
41
|
+
autoprefixer-rails (>= 6.0)
|
42
|
+
datetime_picker_rails (~> 0.0.7)
|
43
|
+
jquery-rails (>= 4.0)
|
44
|
+
kaminari (>= 1.0)
|
45
|
+
momentjs-rails (~> 2.8)
|
46
|
+
sassc-rails (~> 2.1)
|
47
|
+
selectize-rails (~> 0.6)
|
48
|
+
appraisal (2.2.0)
|
49
|
+
bundler
|
50
|
+
rake
|
51
|
+
thor (>= 0.14.0)
|
52
|
+
ast (2.4.0)
|
53
|
+
autoprefixer-rails (9.7.4)
|
54
|
+
execjs
|
55
|
+
builder (3.2.4)
|
56
|
+
capybara (3.31.0)
|
57
|
+
addressable
|
58
|
+
mini_mime (>= 0.1.3)
|
59
|
+
nokogiri (~> 1.8)
|
60
|
+
rack (>= 1.6.0)
|
61
|
+
rack-test (>= 0.6.3)
|
62
|
+
regexp_parser (~> 1.5)
|
63
|
+
xpath (~> 3.2)
|
64
|
+
childprocess (3.0.0)
|
65
|
+
cocoon (1.2.14)
|
66
|
+
concurrent-ruby (1.1.6)
|
67
|
+
crass (1.0.6)
|
68
|
+
datetime_picker_rails (0.0.7)
|
69
|
+
momentjs-rails (>= 2.8.1)
|
70
|
+
diff-lcs (1.3)
|
71
|
+
erubi (1.9.0)
|
72
|
+
execjs (2.7.0)
|
73
|
+
factory_bot (5.1.1)
|
74
|
+
activesupport (>= 4.2.0)
|
75
|
+
ffi (1.12.2)
|
76
|
+
highline (2.0.3)
|
77
|
+
i18n (1.8.2)
|
78
|
+
concurrent-ruby (~> 1.0)
|
79
|
+
i18n-tasks (0.9.31)
|
80
|
+
activesupport (>= 4.0.2)
|
81
|
+
ast (>= 2.1.0)
|
82
|
+
erubi
|
83
|
+
highline (>= 2.0.0)
|
84
|
+
i18n
|
85
|
+
parser (>= 2.2.3.0)
|
86
|
+
rails-i18n
|
87
|
+
rainbow (>= 2.2.2, < 4.0)
|
88
|
+
terminal-table (>= 1.5.1)
|
89
|
+
jquery-rails (4.3.5)
|
90
|
+
rails-dom-testing (>= 1, < 3)
|
91
|
+
railties (>= 4.2.0)
|
92
|
+
thor (>= 0.14, < 2.0)
|
93
|
+
kaminari (1.2.0)
|
94
|
+
activesupport (>= 4.1.0)
|
95
|
+
kaminari-actionview (= 1.2.0)
|
96
|
+
kaminari-activerecord (= 1.2.0)
|
97
|
+
kaminari-core (= 1.2.0)
|
98
|
+
kaminari-actionview (1.2.0)
|
99
|
+
actionview
|
100
|
+
kaminari-core (= 1.2.0)
|
101
|
+
kaminari-activerecord (1.2.0)
|
102
|
+
activerecord
|
103
|
+
kaminari-core (= 1.2.0)
|
104
|
+
kaminari-core (1.2.0)
|
105
|
+
loofah (2.4.0)
|
106
|
+
crass (~> 1.0.2)
|
107
|
+
nokogiri (>= 1.5.9)
|
108
|
+
method_source (0.9.2)
|
109
|
+
mini_mime (1.0.2)
|
110
|
+
mini_portile2 (2.4.0)
|
111
|
+
minitest (5.14.0)
|
112
|
+
momentjs-rails (2.20.1)
|
113
|
+
railties (>= 3.1)
|
114
|
+
nokogiri (1.10.9)
|
115
|
+
mini_portile2 (~> 2.4.0)
|
116
|
+
parser (2.7.0.4)
|
117
|
+
ast (~> 2.4.0)
|
118
|
+
pg (1.2.2)
|
119
|
+
public_suffix (4.0.3)
|
120
|
+
rack (2.2.2)
|
121
|
+
rack-test (1.1.0)
|
122
|
+
rack (>= 1.0, < 3)
|
123
|
+
rails-dom-testing (2.0.3)
|
124
|
+
activesupport (>= 4.2.0)
|
125
|
+
nokogiri (>= 1.6)
|
126
|
+
rails-html-sanitizer (1.3.0)
|
127
|
+
loofah (~> 2.3)
|
128
|
+
rails-i18n (6.0.0)
|
129
|
+
i18n (>= 0.7, < 2)
|
130
|
+
railties (>= 6.0.0, < 7)
|
131
|
+
railties (6.0.2.1)
|
132
|
+
actionpack (= 6.0.2.1)
|
133
|
+
activesupport (= 6.0.2.1)
|
134
|
+
method_source
|
135
|
+
rake (>= 0.8.7)
|
136
|
+
thor (>= 0.20.3, < 2.0)
|
137
|
+
rainbow (3.0.0)
|
138
|
+
rake (13.0.1)
|
139
|
+
regexp_parser (1.7.0)
|
140
|
+
rspec-core (3.9.1)
|
141
|
+
rspec-support (~> 3.9.1)
|
142
|
+
rspec-expectations (3.9.1)
|
143
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
144
|
+
rspec-support (~> 3.9.0)
|
145
|
+
rspec-mocks (3.9.1)
|
146
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
147
|
+
rspec-support (~> 3.9.0)
|
148
|
+
rspec-rails (3.9.1)
|
149
|
+
actionpack (>= 3.0)
|
150
|
+
activesupport (>= 3.0)
|
151
|
+
railties (>= 3.0)
|
152
|
+
rspec-core (~> 3.9.0)
|
153
|
+
rspec-expectations (~> 3.9.0)
|
154
|
+
rspec-mocks (~> 3.9.0)
|
155
|
+
rspec-support (~> 3.9.0)
|
156
|
+
rspec-support (3.9.2)
|
157
|
+
rubyzip (2.3.0)
|
158
|
+
sassc (2.2.1)
|
159
|
+
ffi (~> 1.9)
|
160
|
+
sassc-rails (2.1.2)
|
161
|
+
railties (>= 4.0.0)
|
162
|
+
sassc (>= 2.0)
|
163
|
+
sprockets (> 3.0)
|
164
|
+
sprockets-rails
|
165
|
+
tilt
|
166
|
+
selectize-rails (0.12.6)
|
167
|
+
selenium-webdriver (3.142.7)
|
168
|
+
childprocess (>= 0.5, < 4.0)
|
169
|
+
rubyzip (>= 1.2.2)
|
170
|
+
sprockets (4.0.0)
|
171
|
+
concurrent-ruby (~> 1.0)
|
172
|
+
rack (> 1, < 3)
|
173
|
+
sprockets-rails (3.2.1)
|
174
|
+
actionpack (>= 4.0)
|
175
|
+
activesupport (>= 4.0)
|
176
|
+
sprockets (>= 3.0.0)
|
177
|
+
sqlite3 (1.4.2)
|
178
|
+
terminal-table (1.8.0)
|
179
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
180
|
+
thor (1.0.1)
|
181
|
+
thread_safe (0.3.6)
|
182
|
+
tilt (2.0.10)
|
183
|
+
tzinfo (1.2.6)
|
184
|
+
thread_safe (~> 0.1)
|
185
|
+
unicode-display_width (1.7.0)
|
186
|
+
xpath (3.2.0)
|
187
|
+
nokogiri (~> 1.8)
|
188
|
+
zeitwerk (2.3.0)
|
189
|
+
|
190
|
+
PLATFORMS
|
191
|
+
ruby
|
192
|
+
|
193
|
+
DEPENDENCIES
|
194
|
+
administrate (= 0.13.0)
|
195
|
+
administrate-field-nested_has_many!
|
196
|
+
appraisal
|
197
|
+
capybara
|
198
|
+
factory_bot
|
199
|
+
i18n-tasks
|
200
|
+
pg
|
201
|
+
rake
|
202
|
+
rspec-rails
|
203
|
+
selenium-webdriver
|
204
|
+
sqlite3
|
205
|
+
|
206
|
+
BUNDLED WITH
|
207
|
+
1.17.2
|
@@ -32,7 +32,7 @@ module Administrate
|
|
32
32
|
next if nested_field.resource.blank?
|
33
33
|
|
34
34
|
# inject current data into field
|
35
|
-
resource =
|
35
|
+
resource = data[form_builder.index]
|
36
36
|
nested_field.instance_variable_set(
|
37
37
|
"@data",
|
38
38
|
resource.send(nested_field.attribute),
|
@@ -73,11 +73,15 @@ module Administrate
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def associated_form
|
76
|
-
Administrate::Page::Form.new(associated_dashboard,
|
76
|
+
Administrate::Page::Form.new(associated_dashboard, new_resource)
|
77
77
|
end
|
78
78
|
|
79
79
|
private
|
80
80
|
|
81
|
+
def new_resource
|
82
|
+
@new_resource ||= associated_class_name.constantize.new
|
83
|
+
end
|
84
|
+
|
81
85
|
def skipped_fields
|
82
86
|
Array(options[:skip])
|
83
87
|
end
|
data/spec/dummy/config/routes.rb
CHANGED
@@ -38,4 +38,31 @@ feature "Has many" do
|
|
38
38
|
expect(page).to have_text("La Ferme du Bec Hellouin")
|
39
39
|
expect(page).to have_text("Sébastien")
|
40
40
|
end
|
41
|
+
|
42
|
+
scenario "edit" do
|
43
|
+
school = FactoryBot.create(:school)
|
44
|
+
FactoryBot.create_list(:student, 2, school: school)
|
45
|
+
visit edit_admin_school_path(school)
|
46
|
+
expect(page).to have_content("Edit #{school.name}")
|
47
|
+
end
|
48
|
+
|
49
|
+
scenario "update", js: true do
|
50
|
+
school = FactoryBot.create(:school)
|
51
|
+
student = FactoryBot.create(:student, school: school)
|
52
|
+
visit edit_admin_school_path(school)
|
53
|
+
click_link "Add Foo/Student"
|
54
|
+
|
55
|
+
within(all(".nested-fields").last) do
|
56
|
+
fill_in "Name", with: "Sébastien"
|
57
|
+
end
|
58
|
+
|
59
|
+
within(all(".nested-fields").first) do
|
60
|
+
click_link "Remove Foo/Student"
|
61
|
+
end
|
62
|
+
|
63
|
+
click_button "Update School"
|
64
|
+
|
65
|
+
expect(page).to have_text("Sébastien")
|
66
|
+
expect(page).not_to have_text(student.name)
|
67
|
+
end
|
41
68
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: administrate-field-nested_has_many
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Charlton
|
8
8
|
- Grayson Wright
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-02
|
12
|
+
date: 2020-07-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: administrate
|
@@ -197,6 +197,8 @@ files:
|
|
197
197
|
- config/locales/administrate-field-nested_has_many.ru.yml
|
198
198
|
- gemfiles/administrate_0.10.gemfile
|
199
199
|
- gemfiles/administrate_0.10.gemfile.lock
|
200
|
+
- gemfiles/administrate_0.13.gemfile
|
201
|
+
- gemfiles/administrate_0.13.gemfile.lock
|
200
202
|
- gemfiles/administrate_master.gemfile
|
201
203
|
- gemfiles/administrate_master.gemfile.lock
|
202
204
|
- lib/administrate/field/nested_has_many.rb
|
@@ -277,7 +279,7 @@ homepage: https://github.com/nickcharlton/administrate-field-nested_has_many
|
|
277
279
|
licenses:
|
278
280
|
- MIT
|
279
281
|
metadata: {}
|
280
|
-
post_install_message:
|
282
|
+
post_install_message:
|
281
283
|
rdoc_options: []
|
282
284
|
require_paths:
|
283
285
|
- lib
|
@@ -292,8 +294,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
292
294
|
- !ruby/object:Gem::Version
|
293
295
|
version: '0'
|
294
296
|
requirements: []
|
295
|
-
rubygems_version: 3.
|
296
|
-
signing_key:
|
297
|
+
rubygems_version: 3.1.2
|
298
|
+
signing_key:
|
297
299
|
specification_version: 4
|
298
300
|
summary: Plugin for nested has_many forms in Administrate
|
299
301
|
test_files:
|