administrate-field-nested_has_many 1.3.0 → 2.0.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 +1 -1
- data/.ruby-version +1 -1
- data/Appraisals +2 -10
- data/CHANGELOG.md +23 -0
- data/CODE_OF_CONDUCT.md +6 -0
- data/CONTRIBUTING.md +38 -0
- data/LICENSE.md +21 -0
- data/README.md +38 -1
- data/SECURITY.md +16 -0
- data/administrate-field-nested_has_many.gemspec +2 -3
- data/app/views/fields/nested_has_many/_show.html.erb +35 -6
- data/bin/build-changelog +24 -0
- data/bin/setup +13 -0
- data/config/locales/administrate-field-nested_has_many.de.yml +7 -0
- data/config/locales/administrate-field-nested_has_many.fr.yml +7 -0
- data/gemfiles/{administrate_0.13.gemfile → administrate_0.19.gemfile} +1 -1
- data/gemfiles/administrate_0.19.gemfile.lock +260 -0
- data/lib/administrate/field/nested_has_many.rb +28 -14
- data/spec/dummy/Rakefile +1 -1
- data/spec/dummy/app/dashboards/school_dashboard.rb +1 -1
- data/spec/dummy/bin/rails +2 -2
- data/spec/dummy/bin/rake +2 -2
- data/spec/dummy/bin/setup +6 -9
- data/spec/dummy/config/application.rb +12 -9
- data/spec/dummy/config/boot.rb +1 -1
- data/spec/dummy/config/environment.rb +1 -1
- data/spec/dummy/config/environments/development.rb +16 -4
- data/spec/dummy/config/environments/test.rb +19 -6
- data/spec/dummy/config/initializers/backtrace_silencers.rb +4 -3
- data/spec/dummy/config/initializers/content_security_policy.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +3 -1
- data/spec/dummy/config/initializers/permissions_policy.rb +11 -0
- data/spec/dummy/config/locales/en.yml +1 -1
- data/spec/dummy/config/puma.rb +13 -4
- data/spec/dummy/config.ru +2 -1
- data/spec/dummy/db/schema.rb +10 -6
- data/spec/features/has_many_spec.rb +10 -0
- metadata +21 -41
- data/app/views/fields/nested_has_many/_show_current.html.erb +0 -44
- data/app/views/fields/nested_has_many/_show_old.html.erb +0 -36
- data/gemfiles/administrate_0.10.gemfile +0 -8
- data/gemfiles/administrate_0.10.gemfile.lock +0 -214
- data/gemfiles/administrate_0.13.gemfile.lock +0 -207
- data/gemfiles/administrate_master.gemfile +0 -8
- data/gemfiles/administrate_master.gemfile.lock +0 -219
- data/spec/dummy/app/mailers/application_mailer.rb +0 -4
- data/spec/dummy/app/views/layouts/mailer.html.erb +0 -13
- data/spec/dummy/app/views/layouts/mailer.text.erb +0 -1
- data/spec/dummy/config/cable.yml +0 -10
- data/spec/dummy/config/storage.yml +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d33edd4a1e1c3c4170b7456ec5bf0cc4786fd034d6c6cb23a6f4e41d5b4c47ac
|
4
|
+
data.tar.gz: 4d31e5f64c770656674a05a1f985ca6ae73fc4264617b32e865b82712d0735d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a90171dfc15780d5005e247ef2c46c439aa8598bc39da3a23bb572a145d19f1cd1027a964c06f507daef85e4d6e5aa4b869dbbe1f0738f87955b65a6c0c11d2
|
7
|
+
data.tar.gz: 2f39cc39ac3e8d91ab5e415b9622a09cdbf3da226aad8dcfe1d9bee19822f66173d6853798d2e4693b4bce8683e8a34812f00bf868d07fb00c692c09ac96e8f6
|
data/.circleci/config.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-
|
1
|
+
ruby-3.3.0
|
data/Appraisals
CHANGED
@@ -1,13 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
appraise "administrate-0.
|
4
|
-
gem "administrate", "0.
|
5
|
-
end
|
6
|
-
|
7
|
-
appraise "administrate-0.13" do
|
8
|
-
gem "administrate", "0.13.0"
|
9
|
-
end
|
10
|
-
|
11
|
-
appraise "administrate-master" do
|
12
|
-
gem "administrate", git: "https://github.com/thoughtbot/administrate", branch: "master"
|
3
|
+
appraise "administrate-0.19" do
|
4
|
+
gem "administrate", "0.19.0"
|
13
5
|
end
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 2.0.0
|
4
|
+
|
5
|
+
* Add CONTRIBUTING (#78)
|
6
|
+
* Add the thoughtbot CoC (#76)
|
7
|
+
* Add SECURITY (#77)
|
8
|
+
* Add LICENSE (#75)
|
9
|
+
* Add a script to build the changelog (#74)
|
10
|
+
* Add a bin/setup script (#73)
|
11
|
+
* Drop Administrate support below v0.19.0 (#72)
|
12
|
+
* Upgrade Ruby to v3.3.0 (#67)
|
13
|
+
* Drop SQLite development dependency (#70)
|
14
|
+
* Refresh Appraisals (properly) (#71)
|
15
|
+
* Refresh Appraisals (#69)
|
16
|
+
* Pin Administrate below 0.20.0 (#68)
|
17
|
+
* Add German locale (#53)
|
18
|
+
* Align #show pagination with 0.16.0 (#52)
|
19
|
+
* Let Administrate figure out the associations (#44)
|
20
|
+
* Avoid having to add assets to the host manifest (#45)
|
21
|
+
* Add French locale (#51)
|
22
|
+
* Fix build to work with Rails 6.1 (#47)
|
23
|
+
* Remove old compatibility (#46)
|
24
|
+
* Remind users to declare accepts_nested_attributes_for (#48)
|
25
|
+
|
3
26
|
## 1.3.0
|
4
27
|
|
5
28
|
* Cover more test cases ([#43][])
|
data/CODE_OF_CONDUCT.md
ADDED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# Contributing Guide
|
2
|
+
|
3
|
+
## Code of Conduct
|
4
|
+
|
5
|
+
We welcome pull requests from everyone. By participating in this project, you
|
6
|
+
agree to abide by the thoughtbot [code of conduct].
|
7
|
+
|
8
|
+
We expect everyone to follow the code of conduct anywhere in thoughtbot's
|
9
|
+
project codebases, issue trackers, chat-rooms, and mailing lists.
|
10
|
+
|
11
|
+
[code of conduct]: https://thoughtbot.com/open-source-code-of-conduct
|
12
|
+
|
13
|
+
## Getting Started
|
14
|
+
|
15
|
+
`administrate-field-nested_has_many` is a field plugin for [Administrate][],
|
16
|
+
that allows for nested `has_many` forms.
|
17
|
+
|
18
|
+
To maintain compatibility with different dependency versions, we use
|
19
|
+
[Appraisal][].
|
20
|
+
|
21
|
+
[Administrate]: https://github.com/thoughtbot/administrate
|
22
|
+
[Appraisal]: https://github.com/thoughtbot/appraisal
|
23
|
+
|
24
|
+
### Opening a PR
|
25
|
+
|
26
|
+
1. Fork the repo,
|
27
|
+
2. Run `./bin/setup` to install the base dependencies and setup a local
|
28
|
+
database,
|
29
|
+
3. Run the test suite: `bundle exec rspec && bundle exec appraisal rspec`,
|
30
|
+
4. Make your changes,
|
31
|
+
5. Push your fork and open a pull request.
|
32
|
+
|
33
|
+
A good PR will solve the smallest problem it possibly can, have good test
|
34
|
+
coverage and (where necessary) have internationalisation support.
|
35
|
+
|
36
|
+
## Security
|
37
|
+
|
38
|
+
See the [security policy](./SECURITY.md).
|
data/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015-2024 thoughtbot, inc.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -2,6 +2,22 @@
|
|
2
2
|
|
3
3
|
A plugin for nested has_many forms in [Administrate].
|
4
4
|
|
5
|
+
[Administrate]: https://github.com/thoughtbot/administrate
|
6
|
+
|
7
|
+
## Compatibility
|
8
|
+
|
9
|
+
This gem depends on Administrate APIs that may change over time. For this reason,
|
10
|
+
some versions of this gem will be compatible only with some versions of Administrate.
|
11
|
+
|
12
|
+
This is a table of known compatibilities. It is accurate to the best of our knowledge.
|
13
|
+
Please let us know if you detect other incompatibilities:
|
14
|
+
|
15
|
+
| `nested_has_many` | Administrate |
|
16
|
+
|-------------------|---------------|
|
17
|
+
| v1.3.0 | up to v0.15 |
|
18
|
+
| `#726d8gc` | from v0.16 |
|
19
|
+
| `master` | up to v0.19.0 |
|
20
|
+
|
5
21
|
## Usage
|
6
22
|
|
7
23
|
Add to your `Gemfile`:
|
@@ -35,4 +51,25 @@ Otherwise, Administrate will try to render a field
|
|
35
51
|
for the order's `:customer` attribute,
|
36
52
|
which breaks the nested form logic.
|
37
53
|
|
38
|
-
|
54
|
+
## Troubleshooting
|
55
|
+
|
56
|
+
### `undefined method 'new_record?' for nil:NilClass`
|
57
|
+
|
58
|
+
This field assumes that your models are setup for nested assignment as per
|
59
|
+
Rails conventions. For example, if you have a `Recipe` that
|
60
|
+
`has_many :ingredients`, you would have something like this:
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
class Recipe < ApplicationRecord
|
64
|
+
has_many :ingredients
|
65
|
+
|
66
|
+
accepts_nested_attributes_for(
|
67
|
+
:ingredients,
|
68
|
+
reject_if: :all_blank,
|
69
|
+
allow_destroy: true
|
70
|
+
)
|
71
|
+
end
|
72
|
+
```
|
73
|
+
|
74
|
+
Specifically, you'll see this `new_record?` error if you forget the
|
75
|
+
`accepts_nested_attributes_for` declaration.
|
data/SECURITY.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# Security Policy
|
2
|
+
|
3
|
+
## Supported Versions
|
4
|
+
|
5
|
+
We only expect to support the latest version of Administrate (and it's related
|
6
|
+
projects) as a given time. If you find a security issue with an older version,
|
7
|
+
please try updating to the latest version first.
|
8
|
+
|
9
|
+
If for some reason you can't update to the latest version, please let us know
|
10
|
+
your reasons so that we can have a better understanding of your situation.
|
11
|
+
|
12
|
+
## Reporting a Vulnerability
|
13
|
+
|
14
|
+
For security inquiries or vulnerability reports, please email
|
15
|
+
<security@thoughtbot.com>.
|
16
|
+
If you'd like, you can use our PGP key when reporting vulnerabilities.
|
@@ -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 = "
|
5
|
+
gem.version = "2.0.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/" \
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.files = `git ls-files`.split("\n")
|
16
16
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
17
|
|
18
|
-
gem.add_dependency "administrate", "
|
18
|
+
gem.add_dependency "administrate", ">= 0.15", "< 0.20.0"
|
19
19
|
gem.add_dependency "cocoon", "~> 1.2", ">= 1.2.11"
|
20
20
|
|
21
21
|
gem.add_development_dependency "appraisal"
|
@@ -25,5 +25,4 @@ Gem::Specification.new do |gem|
|
|
25
25
|
gem.add_development_dependency "i18n-tasks"
|
26
26
|
gem.add_development_dependency "rake"
|
27
27
|
gem.add_development_dependency "rspec-rails"
|
28
|
-
gem.add_development_dependency "sqlite3"
|
29
28
|
end
|
@@ -1,9 +1,38 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
<%#
|
2
|
+
# HasMany Show Partial
|
3
|
+
|
4
|
+
This partial renders a has_many relationship,
|
5
|
+
to be displayed on a resource's show page.
|
6
|
+
|
7
|
+
By default, the relationship is rendered
|
8
|
+
as a table of the first few associated resources.
|
9
|
+
The columns of the table are taken
|
10
|
+
from the associated resource class's dashboard.
|
11
|
+
|
12
|
+
## Local variables:
|
13
|
+
|
14
|
+
- `field`:
|
15
|
+
An instance of [Administrate::Field::HasMany][1].
|
16
|
+
Contains methods to help display a table of associated resources.
|
17
|
+
|
18
|
+
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/HasMany
|
4
19
|
%>
|
5
|
-
|
6
|
-
|
20
|
+
|
21
|
+
<% if field.resources.any? %>
|
22
|
+
<% order = field.order_from_params(params.fetch(field.name, {})) %>
|
23
|
+
<% page_number = params.fetch(field.name, {}).fetch(:page, nil) %>
|
24
|
+
<%= render(
|
25
|
+
"collection",
|
26
|
+
collection_presenter: field.associated_collection(order),
|
27
|
+
collection_field_name: field.name,
|
28
|
+
page: page,
|
29
|
+
resources: field.resources(page_number, order),
|
30
|
+
table_title: field.name,
|
31
|
+
) %>
|
32
|
+
|
33
|
+
<% if field.more_than_limit? %>
|
34
|
+
<%= paginate field.resources(page_number), param_name: "#{field.name}[page]" %>
|
35
|
+
<% end %>
|
7
36
|
<% else %>
|
8
|
-
<%=
|
37
|
+
<%= t("administrate.fields.has_many.none", default: "–") %>
|
9
38
|
<% end %>
|
data/bin/build-changelog
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
set -e
|
4
|
+
|
5
|
+
if ! command -v gh > /dev/null; then
|
6
|
+
echo "Please install the GitHub CLI: https://cli.github.com/"
|
7
|
+
exit 1
|
8
|
+
fi
|
9
|
+
|
10
|
+
last_release=$(git describe --tag --abbrev=0)
|
11
|
+
|
12
|
+
revision_range="${last_release}..origin/main"
|
13
|
+
commit_format="--pretty=tformat:%h %s"
|
14
|
+
commits_since=$(git log --author="^(?!dependabot).*$" --perl-regexp "${revision_range}" "${commit_format}")
|
15
|
+
|
16
|
+
echo "$commits_since" | while read -r line; do
|
17
|
+
sha=$(echo "${line}" | awk '{print $1}')
|
18
|
+
commit_message=$(echo "${line}" | awk '{print substr($0, index($0, " ")+1)}')
|
19
|
+
|
20
|
+
pr_number=$(gh pr list --search "$sha" --state merged --json number --jq '.[].number')
|
21
|
+
trimmed_commit=$(echo "${commit_message}"| sed "s/ (\#$pr_number)//g")
|
22
|
+
|
23
|
+
echo "* ${trimmed_commit} (#${pr_number})"
|
24
|
+
done
|
data/bin/setup
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
set -e
|
4
|
+
|
5
|
+
gem install bundler --conservative
|
6
|
+
bundle check || bundle install
|
7
|
+
|
8
|
+
bundle exec appraisal install
|
9
|
+
|
10
|
+
bundle exec rake db:setup
|
11
|
+
|
12
|
+
# Add binstubs to PATH via export PATH=".git/safe/../../bin:$PATH" in ~/.zshenv
|
13
|
+
mkdir -p .git/safe
|
@@ -0,0 +1,260 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
administrate-field-nested_has_many (2.0.0)
|
5
|
+
administrate (>= 0.15, < 0.20.0)
|
6
|
+
cocoon (~> 1.2, >= 1.2.11)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actionpack (7.1.3)
|
12
|
+
actionview (= 7.1.3)
|
13
|
+
activesupport (= 7.1.3)
|
14
|
+
nokogiri (>= 1.8.5)
|
15
|
+
racc
|
16
|
+
rack (>= 2.2.4)
|
17
|
+
rack-session (>= 1.0.1)
|
18
|
+
rack-test (>= 0.6.3)
|
19
|
+
rails-dom-testing (~> 2.2)
|
20
|
+
rails-html-sanitizer (~> 1.6)
|
21
|
+
actionview (7.1.3)
|
22
|
+
activesupport (= 7.1.3)
|
23
|
+
builder (~> 3.1)
|
24
|
+
erubi (~> 1.11)
|
25
|
+
rails-dom-testing (~> 2.2)
|
26
|
+
rails-html-sanitizer (~> 1.6)
|
27
|
+
activemodel (7.1.3)
|
28
|
+
activesupport (= 7.1.3)
|
29
|
+
activerecord (7.1.3)
|
30
|
+
activemodel (= 7.1.3)
|
31
|
+
activesupport (= 7.1.3)
|
32
|
+
timeout (>= 0.4.0)
|
33
|
+
activesupport (7.1.3)
|
34
|
+
base64
|
35
|
+
bigdecimal
|
36
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
37
|
+
connection_pool (>= 2.2.5)
|
38
|
+
drb
|
39
|
+
i18n (>= 1.6, < 2)
|
40
|
+
minitest (>= 5.1)
|
41
|
+
mutex_m
|
42
|
+
tzinfo (~> 2.0)
|
43
|
+
addressable (2.8.6)
|
44
|
+
public_suffix (>= 2.0.2, < 6.0)
|
45
|
+
administrate (0.19.0)
|
46
|
+
actionpack (>= 5.0)
|
47
|
+
actionview (>= 5.0)
|
48
|
+
activerecord (>= 5.0)
|
49
|
+
jquery-rails (>= 4.0)
|
50
|
+
kaminari (>= 1.0)
|
51
|
+
sassc-rails (~> 2.1)
|
52
|
+
selectize-rails (~> 0.6)
|
53
|
+
appraisal (2.5.0)
|
54
|
+
bundler
|
55
|
+
rake
|
56
|
+
thor (>= 0.14.0)
|
57
|
+
ast (2.4.2)
|
58
|
+
base64 (0.2.0)
|
59
|
+
better_html (2.0.2)
|
60
|
+
actionview (>= 6.0)
|
61
|
+
activesupport (>= 6.0)
|
62
|
+
ast (~> 2.0)
|
63
|
+
erubi (~> 1.4)
|
64
|
+
parser (>= 2.4)
|
65
|
+
smart_properties
|
66
|
+
bigdecimal (3.1.6)
|
67
|
+
builder (3.2.4)
|
68
|
+
capybara (3.39.2)
|
69
|
+
addressable
|
70
|
+
matrix
|
71
|
+
mini_mime (>= 0.1.3)
|
72
|
+
nokogiri (~> 1.8)
|
73
|
+
rack (>= 1.6.0)
|
74
|
+
rack-test (>= 0.6.3)
|
75
|
+
regexp_parser (>= 1.5, < 3.0)
|
76
|
+
xpath (~> 3.2)
|
77
|
+
cocoon (1.2.15)
|
78
|
+
concurrent-ruby (1.2.3)
|
79
|
+
connection_pool (2.4.1)
|
80
|
+
crass (1.0.6)
|
81
|
+
diff-lcs (1.5.0)
|
82
|
+
drb (2.2.0)
|
83
|
+
ruby2_keywords
|
84
|
+
erubi (1.12.0)
|
85
|
+
factory_bot (6.4.5)
|
86
|
+
activesupport (>= 5.0.0)
|
87
|
+
ffi (1.16.3)
|
88
|
+
highline (3.0.1)
|
89
|
+
i18n (1.14.1)
|
90
|
+
concurrent-ruby (~> 1.0)
|
91
|
+
i18n-tasks (1.0.13)
|
92
|
+
activesupport (>= 4.0.2)
|
93
|
+
ast (>= 2.1.0)
|
94
|
+
better_html (>= 1.0, < 3.0)
|
95
|
+
erubi
|
96
|
+
highline (>= 2.0.0)
|
97
|
+
i18n
|
98
|
+
parser (>= 3.2.2.1)
|
99
|
+
rails-i18n
|
100
|
+
rainbow (>= 2.2.2, < 4.0)
|
101
|
+
terminal-table (>= 1.5.1)
|
102
|
+
io-console (0.7.2)
|
103
|
+
irb (1.11.1)
|
104
|
+
rdoc
|
105
|
+
reline (>= 0.4.2)
|
106
|
+
jquery-rails (4.6.0)
|
107
|
+
rails-dom-testing (>= 1, < 3)
|
108
|
+
railties (>= 4.2.0)
|
109
|
+
thor (>= 0.14, < 2.0)
|
110
|
+
kaminari (1.2.2)
|
111
|
+
activesupport (>= 4.1.0)
|
112
|
+
kaminari-actionview (= 1.2.2)
|
113
|
+
kaminari-activerecord (= 1.2.2)
|
114
|
+
kaminari-core (= 1.2.2)
|
115
|
+
kaminari-actionview (1.2.2)
|
116
|
+
actionview
|
117
|
+
kaminari-core (= 1.2.2)
|
118
|
+
kaminari-activerecord (1.2.2)
|
119
|
+
activerecord
|
120
|
+
kaminari-core (= 1.2.2)
|
121
|
+
kaminari-core (1.2.2)
|
122
|
+
loofah (2.22.0)
|
123
|
+
crass (~> 1.0.2)
|
124
|
+
nokogiri (>= 1.12.0)
|
125
|
+
matrix (0.4.2)
|
126
|
+
mini_mime (1.1.5)
|
127
|
+
minitest (5.21.2)
|
128
|
+
mutex_m (0.2.0)
|
129
|
+
nokogiri (1.16.0-aarch64-linux)
|
130
|
+
racc (~> 1.4)
|
131
|
+
nokogiri (1.16.0-arm-linux)
|
132
|
+
racc (~> 1.4)
|
133
|
+
nokogiri (1.16.0-arm64-darwin)
|
134
|
+
racc (~> 1.4)
|
135
|
+
nokogiri (1.16.0-x86-linux)
|
136
|
+
racc (~> 1.4)
|
137
|
+
nokogiri (1.16.0-x86_64-darwin)
|
138
|
+
racc (~> 1.4)
|
139
|
+
nokogiri (1.16.0-x86_64-linux)
|
140
|
+
racc (~> 1.4)
|
141
|
+
parser (3.3.0.5)
|
142
|
+
ast (~> 2.4.1)
|
143
|
+
racc
|
144
|
+
pg (1.5.4)
|
145
|
+
psych (5.1.2)
|
146
|
+
stringio
|
147
|
+
public_suffix (5.0.4)
|
148
|
+
racc (1.7.3)
|
149
|
+
rack (3.0.8)
|
150
|
+
rack-session (2.0.0)
|
151
|
+
rack (>= 3.0.0)
|
152
|
+
rack-test (2.1.0)
|
153
|
+
rack (>= 1.3)
|
154
|
+
rackup (2.1.0)
|
155
|
+
rack (>= 3)
|
156
|
+
webrick (~> 1.8)
|
157
|
+
rails-dom-testing (2.2.0)
|
158
|
+
activesupport (>= 5.0.0)
|
159
|
+
minitest
|
160
|
+
nokogiri (>= 1.6)
|
161
|
+
rails-html-sanitizer (1.6.0)
|
162
|
+
loofah (~> 2.21)
|
163
|
+
nokogiri (~> 1.14)
|
164
|
+
rails-i18n (7.0.8)
|
165
|
+
i18n (>= 0.7, < 2)
|
166
|
+
railties (>= 6.0.0, < 8)
|
167
|
+
railties (7.1.3)
|
168
|
+
actionpack (= 7.1.3)
|
169
|
+
activesupport (= 7.1.3)
|
170
|
+
irb
|
171
|
+
rackup (>= 1.0.0)
|
172
|
+
rake (>= 12.2)
|
173
|
+
thor (~> 1.0, >= 1.2.2)
|
174
|
+
zeitwerk (~> 2.6)
|
175
|
+
rainbow (3.1.1)
|
176
|
+
rake (13.1.0)
|
177
|
+
rdoc (6.6.2)
|
178
|
+
psych (>= 4.0.0)
|
179
|
+
regexp_parser (2.9.0)
|
180
|
+
reline (0.4.2)
|
181
|
+
io-console (~> 0.5)
|
182
|
+
rexml (3.2.6)
|
183
|
+
rspec-core (3.12.2)
|
184
|
+
rspec-support (~> 3.12.0)
|
185
|
+
rspec-expectations (3.12.3)
|
186
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
187
|
+
rspec-support (~> 3.12.0)
|
188
|
+
rspec-mocks (3.12.6)
|
189
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
190
|
+
rspec-support (~> 3.12.0)
|
191
|
+
rspec-rails (6.1.1)
|
192
|
+
actionpack (>= 6.1)
|
193
|
+
activesupport (>= 6.1)
|
194
|
+
railties (>= 6.1)
|
195
|
+
rspec-core (~> 3.12)
|
196
|
+
rspec-expectations (~> 3.12)
|
197
|
+
rspec-mocks (~> 3.12)
|
198
|
+
rspec-support (~> 3.12)
|
199
|
+
rspec-support (3.12.1)
|
200
|
+
ruby2_keywords (0.0.5)
|
201
|
+
rubyzip (2.3.2)
|
202
|
+
sassc (2.4.0)
|
203
|
+
ffi (~> 1.9)
|
204
|
+
sassc-rails (2.1.2)
|
205
|
+
railties (>= 4.0.0)
|
206
|
+
sassc (>= 2.0)
|
207
|
+
sprockets (> 3.0)
|
208
|
+
sprockets-rails
|
209
|
+
tilt
|
210
|
+
selectize-rails (0.12.6)
|
211
|
+
selenium-webdriver (4.17.0)
|
212
|
+
base64 (~> 0.2)
|
213
|
+
rexml (~> 3.2, >= 3.2.5)
|
214
|
+
rubyzip (>= 1.2.2, < 3.0)
|
215
|
+
websocket (~> 1.0)
|
216
|
+
smart_properties (1.17.0)
|
217
|
+
sprockets (4.2.1)
|
218
|
+
concurrent-ruby (~> 1.0)
|
219
|
+
rack (>= 2.2.4, < 4)
|
220
|
+
sprockets-rails (3.4.2)
|
221
|
+
actionpack (>= 5.2)
|
222
|
+
activesupport (>= 5.2)
|
223
|
+
sprockets (>= 3.0.0)
|
224
|
+
stringio (3.1.0)
|
225
|
+
terminal-table (3.0.2)
|
226
|
+
unicode-display_width (>= 1.1.1, < 3)
|
227
|
+
thor (1.3.0)
|
228
|
+
tilt (2.3.0)
|
229
|
+
timeout (0.4.1)
|
230
|
+
tzinfo (2.0.6)
|
231
|
+
concurrent-ruby (~> 1.0)
|
232
|
+
unicode-display_width (2.5.0)
|
233
|
+
webrick (1.8.1)
|
234
|
+
websocket (1.2.10)
|
235
|
+
xpath (3.2.0)
|
236
|
+
nokogiri (~> 1.8)
|
237
|
+
zeitwerk (2.6.12)
|
238
|
+
|
239
|
+
PLATFORMS
|
240
|
+
aarch64-linux
|
241
|
+
arm-linux
|
242
|
+
arm64-darwin
|
243
|
+
x86-linux
|
244
|
+
x86_64-darwin
|
245
|
+
x86_64-linux
|
246
|
+
|
247
|
+
DEPENDENCIES
|
248
|
+
administrate (= 0.19.0)
|
249
|
+
administrate-field-nested_has_many!
|
250
|
+
appraisal
|
251
|
+
capybara
|
252
|
+
factory_bot
|
253
|
+
i18n-tasks
|
254
|
+
pg
|
255
|
+
rake
|
256
|
+
rspec-rails
|
257
|
+
selenium-webdriver
|
258
|
+
|
259
|
+
BUNDLED WITH
|
260
|
+
2.5.3
|
@@ -15,6 +15,13 @@ module Administrate
|
|
15
15
|
Administrate::Engine.add_stylesheet(
|
16
16
|
"administrate-field-nested_has_many/application",
|
17
17
|
)
|
18
|
+
|
19
|
+
initializer "administrate-field-nested_has_many.assets.precompile" do |app|
|
20
|
+
app.config.assets.precompile += [
|
21
|
+
"administrate-field-nested_has_many/application.js",
|
22
|
+
"administrate-field-nested_has_many/application.css",
|
23
|
+
]
|
24
|
+
end
|
18
25
|
end
|
19
26
|
|
20
27
|
DEFAULT_ATTRIBUTES = %i(id _destroy).freeze
|
@@ -44,32 +51,39 @@ module Administrate
|
|
44
51
|
data
|
45
52
|
end
|
46
53
|
|
47
|
-
def self.dashboard_for_resource(
|
48
|
-
|
49
|
-
"#{class_name}Dashboard".constantize
|
54
|
+
def self.dashboard_for_resource(resource_class, attr)
|
55
|
+
"#{associated_class_name(resource_class, attr)}Dashboard".constantize
|
50
56
|
end
|
51
57
|
|
52
|
-
def self.associated_attributes(
|
53
|
-
dashboard_class = dashboard_for_resource(
|
58
|
+
def self.associated_attributes(resource_class, attr)
|
59
|
+
dashboard_class = dashboard_for_resource(resource_class, attr)
|
54
60
|
DEFAULT_ATTRIBUTES + dashboard_class.new.permitted_attributes
|
55
61
|
end
|
56
62
|
|
57
|
-
def self.permitted_attribute(
|
63
|
+
def self.permitted_attribute(attr, options = {})
|
64
|
+
given_class_name = options[:class_name]
|
65
|
+
_resource_class =
|
66
|
+
if given_class_name
|
67
|
+
Administrate.warn_of_deprecated_option(:class_name)
|
68
|
+
given_class_name.classify
|
69
|
+
else
|
70
|
+
options[:resource_class]
|
71
|
+
end
|
72
|
+
|
58
73
|
{
|
59
|
-
"#{
|
60
|
-
|
74
|
+
"#{attr}_attributes".to_sym =>
|
75
|
+
associated_attributes(_resource_class, attr),
|
61
76
|
}
|
62
77
|
end
|
63
78
|
|
64
79
|
def associated_class_name
|
65
|
-
|
80
|
+
self.class.associated_class_name(resource.class, attribute)
|
66
81
|
end
|
67
82
|
|
68
83
|
def association_name
|
69
|
-
options.fetch(
|
70
|
-
|
71
|
-
|
72
|
-
)
|
84
|
+
options.fetch(:association_name) do
|
85
|
+
associated_class_name.underscore.pluralize[/([^\/]*)$/, 1]
|
86
|
+
end
|
73
87
|
end
|
74
88
|
|
75
89
|
def associated_form
|
@@ -79,7 +93,7 @@ module Administrate
|
|
79
93
|
private
|
80
94
|
|
81
95
|
def new_resource
|
82
|
-
@new_resource ||=
|
96
|
+
@new_resource ||= associated_class.new
|
83
97
|
end
|
84
98
|
|
85
99
|
def skipped_fields
|