activeadmin 2.2.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activeadmin might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +52 -6
- data/CONTRIBUTING.md +3 -5
- data/README.md +8 -1
- data/app/assets/javascripts/active_admin/lib/batch_actions.es6 +5 -1
- data/app/views/kaminari/active_admin_countless/_first_page.html.erb +11 -0
- data/app/views/kaminari/active_admin_countless/_gap.html.erb +8 -0
- data/app/views/kaminari/active_admin_countless/_next_page.html.erb +11 -0
- data/app/views/kaminari/active_admin_countless/_page.html.erb +12 -0
- data/app/views/kaminari/active_admin_countless/_paginator.html.erb +24 -0
- data/app/views/kaminari/active_admin_countless/_prev_page.html.erb +11 -0
- data/config/locales/ca.yml +0 -1
- data/config/locales/de.yml +18 -0
- data/config/locales/sk.yml +59 -0
- data/docs/2-resource-customization.md +1 -1
- data/docs/3-index-pages/index-as-table.md +7 -0
- data/docs/Gemfile +0 -1
- data/docs/Gemfile.lock +4 -5
- data/docs/_config.yml +2 -0
- data/docs/_includes/top-menu.html +2 -2
- data/docs/index.html +108 -7
- data/docs/stylesheets/main.css +29 -0
- data/lib/active_admin/csv_builder.rb +1 -2
- data/lib/active_admin/filters/resource_extension.rb +24 -0
- data/lib/active_admin/generators/boilerplate.rb +12 -4
- data/lib/active_admin/namespace_settings.rb +13 -0
- data/lib/active_admin/order_clause.rb +1 -1
- data/lib/active_admin/resource.rb +13 -0
- data/lib/active_admin/resource/belongs_to.rb +3 -0
- data/lib/active_admin/resource/model.rb +15 -0
- data/lib/active_admin/resource/routes.rb +11 -3
- data/lib/active_admin/resource_controller.rb +2 -0
- data/lib/active_admin/resource_controller/decorators.rb +2 -2
- data/lib/active_admin/resource_controller/polymorphic_routes.rb +36 -0
- data/lib/active_admin/version.rb +1 -1
- data/lib/active_admin/views/components/paginated_collection.rb +2 -2
- data/lib/active_admin/views/index_as_table.rb +7 -0
- data/lib/generators/active_admin/install/templates/active_admin.rb.erb +14 -1
- data/lib/generators/active_admin/resource/templates/admin.rb.erb +4 -2
- metadata +11 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddd5ccf937ae176b3ba0e13d2af256758dbde0c4aafe9b966c752bb1bb411ea8
|
4
|
+
data.tar.gz: fa4bbd86cf444fb150d6cd624ed8a3125144481878001de32461f5256e30b835
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84c708ca4b0aa8580a3181de153dd698f39c427e9c28adca8c7b3d1f75ff09ba41fa9955d84c6eeb3beccd174db2147a54980123302093cb0d51dd22a021ff40
|
7
|
+
data.tar.gz: 95fc6f7f92134b18270a2ccfdb05c1c55e9151bde9390bbd752f3735633f494c4145674534c1f2bc964687dc513aeb925a5427c8678ea3380340b89859431ebe
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,36 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## 2.4.0 [☰](https://github.com/activeadmin/activeadmin/compare/v2.3.1..v2.4.0)
|
6
|
+
|
7
|
+
### Enhancements
|
8
|
+
|
9
|
+
* Make optimization to not use expensive COUNT queries also work for decorated actions. [#5811] by [@irmela]
|
10
|
+
* Render a text filter instead of a select for large associations (opt-in) [#5548] by [@DanielHeath]
|
11
|
+
* Improve German translations [#5874] by [@juril33t]
|
12
|
+
|
13
|
+
## 2.3.1 [☰](https://github.com/activeadmin/activeadmin/compare/v2.3.0..v2.3.1)
|
14
|
+
|
15
|
+
### Bug Fixes
|
16
|
+
|
17
|
+
* Revert ransack version pinning because 2.3 has an outstanding bug that affects quite a lot of users. See [this ransack issue](https://github.com/activerecord-hackery/ransack/issues/1039) for more information. [#5854] by [@deivid-rodriguez]
|
18
|
+
|
19
|
+
## 2.3.0 [☰](https://github.com/activeadmin/activeadmin/compare/v2.2.0..v2.3.0)
|
20
|
+
|
21
|
+
### Enhancements
|
22
|
+
|
23
|
+
#### Minor
|
24
|
+
|
25
|
+
* Bump minimum ransack requirement to make sure everyone gets a version that works ok with all supported versions of Rails. [#5831] by [@deivid-rodriguez]
|
26
|
+
|
27
|
+
### Bug Fixes
|
28
|
+
|
29
|
+
* Fix CSVBuilder not respecting `ActiveAdmin.application.csv_options = { humanize_name: false }` setting. [#5800] by [@HappyKadaver]
|
30
|
+
* Fix crash when displaying current filters after filtering by a nested resource. [#5816] by [@deivid-rodriguez]
|
31
|
+
* Fix pagination when `pagination_total` is false to not show a "Last" link, since it's incorrect because we don't have the total pages information. [#5822] by [@deivid-rodriguez]
|
32
|
+
* Fix optional nested resources causing incorrect routes to be generated, when renamed resources (through `:as` option) are involved. [#5826] by [@ndbroadbent], [@Kris-LIBIS] and [@deivid-rodriguez]
|
33
|
+
* Fix double modal issue in applications using turbolinks 5. [#5842] by [@sgara]
|
34
|
+
|
5
35
|
## 2.2.0 [☰](https://github.com/activeadmin/activeadmin/compare/v2.1.0..v2.2.0)
|
6
36
|
|
7
37
|
### Enhancements
|
@@ -474,8 +504,18 @@ Please check [0-6-stable] for previous changes.
|
|
474
504
|
[#5758]: https://github.com/activeadmin/activeadmin/pull/5758
|
475
505
|
[#5777]: https://github.com/activeadmin/activeadmin/pull/5777
|
476
506
|
[#5794]: https://github.com/activeadmin/activeadmin/pull/5794
|
507
|
+
[#5800]: https://github.com/activeadmin/activeadmin/pull/5800
|
477
508
|
[#5801]: https://github.com/activeadmin/activeadmin/pull/5801
|
478
509
|
[#5802]: https://github.com/activeadmin/activeadmin/pull/5802
|
510
|
+
[#5811]: https://github.com/activeadmin/activeadmin/pull/5811
|
511
|
+
[#5816]: https://github.com/activeadmin/activeadmin/pull/5816
|
512
|
+
[#5822]: https://github.com/activeadmin/activeadmin/pull/5822
|
513
|
+
[#5826]: https://github.com/activeadmin/activeadmin/pull/5826
|
514
|
+
[#5831]: https://github.com/activeadmin/activeadmin/pull/5831
|
515
|
+
[#5548]: https://github.com/activeadmin/activeadmin/pull/5548
|
516
|
+
[#5842]: https://github.com/activeadmin/activeadmin/pull/5842
|
517
|
+
[#5854]: https://github.com/activeadmin/activeadmin/pull/5854
|
518
|
+
[#5874]: https://github.com/activeadmin/activeadmin/pull/5874
|
479
519
|
|
480
520
|
[@5t111111]: https://github.com/5t111111
|
481
521
|
[@aarek]: https://github.com/aarek
|
@@ -484,10 +524,12 @@ Please check [0-6-stable] for previous changes.
|
|
484
524
|
[@amiel]: https://github.com/amiel
|
485
525
|
[@amiuhle]: https://github.com/amiuhle
|
486
526
|
[@andreslemik]: https://github.com/andreslemik
|
527
|
+
[@bartoszkopinski]: https://github.com/bartoszkopinski
|
487
528
|
[@blocknotes]: https://github.com/blocknotes
|
488
529
|
[@bolshakov]: https://github.com/bolshakov
|
489
530
|
[@buren]: https://github.com/buren
|
490
531
|
[@chancancode]: https://github.com/chancancode
|
532
|
+
[@chrp]: https://github.com/chrp
|
491
533
|
[@chumakoff]: https://github.com/chumakoff
|
492
534
|
[@craigmcnamara]: https://github.com/craigmcnamara
|
493
535
|
[@DanielHeath]: https://github.com/DanielHeath
|
@@ -503,21 +545,28 @@ Please check [0-6-stable] for previous changes.
|
|
503
545
|
[@Fivell]: https://github.com/Fivell
|
504
546
|
[@glebtv]: https://github.com/glebtv
|
505
547
|
[@gonzedge]: https://github.com/gonzedge
|
548
|
+
[@HappyKadaver]: https://github.com/HappyKadaver
|
506
549
|
[@innparusu95]: https://github.com/innparusu95
|
507
550
|
[@ionut998]: https://github.com/ionut998
|
551
|
+
[@irmela]: https://github.com/irmela
|
508
552
|
[@jasl]: https://github.com/jasl
|
509
553
|
[@javierjulio]: https://github.com/javierjulio
|
510
554
|
[@jawa]: https://github.com/jawa
|
511
555
|
[@JiiHu]: https://github.com/JiiHu
|
512
556
|
[@johnnyshields]: https://github.com/johnnyshields
|
557
|
+
[@jscheid]: https://github.com/jscheid
|
558
|
+
[@juril33t]: https://github.com/juril33t
|
513
559
|
[@kjeldahl]: https://github.com/kjeldahl
|
514
560
|
[@kobeumut]: https://github.com/kobeumut
|
561
|
+
[@Kris-LIBIS]: https://github.com/Kris-LIBIS
|
515
562
|
[@kwent]: https://github.com/kwent
|
516
563
|
[@leio10]: https://github.com/leio10
|
517
564
|
[@markstory]: https://github.com/markstory
|
518
565
|
[@mauriciopasquier]: https://github.com/mauriciopasquier
|
519
566
|
[@mconiglio]: https://github.com/mconiglio
|
567
|
+
[@ndbroadbent]: https://github.com/ndbroadbent
|
520
568
|
[@Nguyenanh]: https://github.com/Nguyenanh
|
569
|
+
[@panasyuk]: https://github.com/panasyuk
|
521
570
|
[@PChambino]: https://github.com/PChambino
|
522
571
|
[@potatosalad]: https://github.com/potatosalad
|
523
572
|
[@pranas]: https://github.com/pranas
|
@@ -525,6 +574,7 @@ Please check [0-6-stable] for previous changes.
|
|
525
574
|
[@RobinvanderVliet]: https://github.com/RobinvanderVliet
|
526
575
|
[@rogerkk]: https://github.com/rogerkk
|
527
576
|
[@seanlinsley]: https://github.com/seanlinsley
|
577
|
+
[@sgara]: https://github.com/sgara
|
528
578
|
[@ShallmentMo]: https://github.com/ShallmentMo
|
529
579
|
[@shekibobo]: https://github.com/shekibobo
|
530
580
|
[@shouya]: https://github.com/shouya
|
@@ -534,13 +584,9 @@ Please check [0-6-stable] for previous changes.
|
|
534
584
|
[@timoschilling]: https://github.com/timoschilling
|
535
585
|
[@TimPetricola]: https://github.com/TimPetricola
|
536
586
|
[@varyonic]: https://github.com/varyonic
|
537
|
-
[@
|
587
|
+
[@violeta-p]: https://github.com/violeta-p
|
538
588
|
[@WaKeMaTTa]: https://github.com/WaKeMaTTa
|
589
|
+
[@wasifhossain]: https://github.com/wasifhossain
|
539
590
|
[@Wowu]: https://github.com/Wowu
|
540
591
|
[@wspurgin]: https://github.com/wspurgin
|
541
592
|
[@zorab47]: https://github.com/zorab47
|
542
|
-
[@chrp]: https://github.com/chrp
|
543
|
-
[@bartoszkopinski]: https://github.com/bartoszkopinski
|
544
|
-
[@panasyuk]: https://github.com/panasyuk
|
545
|
-
[@jscheid]: https://github.com/jscheid
|
546
|
-
[@violeta-p]: https://github.com/violeta-p
|
data/CONTRIBUTING.md
CHANGED
@@ -26,8 +26,7 @@ git checkout -b 325-add-japanese-translations
|
|
26
26
|
Make sure you're using a recent ruby and have the `bundler` gem installed, at
|
27
27
|
least version `1.14.3`.
|
28
28
|
|
29
|
-
You'll also need chrome
|
30
|
-
scenarios.
|
29
|
+
You'll also need chrome installed in order to run cucumber scenarios.
|
31
30
|
|
32
31
|
Now install the development dependencies:
|
33
32
|
|
@@ -41,7 +40,7 @@ Now you should be able to run the entire suite using:
|
|
41
40
|
bin/rake
|
42
41
|
```
|
43
42
|
|
44
|
-
The test run will generate a sample Rails application in `tmp/
|
43
|
+
The test run will generate a sample Rails application in `tmp/test_apps` to run the
|
45
44
|
tests against.
|
46
45
|
|
47
46
|
If your tests are passing locally but they're failing on CircleCI, it's probably
|
@@ -95,7 +94,7 @@ bin/rake local server
|
|
95
94
|
```
|
96
95
|
|
97
96
|
This will automatically create a Rails app if none already exists, and store it
|
98
|
-
in the
|
97
|
+
in the `tmp/development_apps` folder.
|
99
98
|
|
100
99
|
You should now be able to open <http://localhost:3000/admin> in your browser.
|
101
100
|
You can log in using:
|
@@ -204,7 +203,6 @@ Maintainers need to do the following to push out a release:
|
|
204
203
|
* `bin/rake release`
|
205
204
|
|
206
205
|
[chandler]: https://github.com/mattbrictson/chandler#2-configure-credentials
|
207
|
-
[chromedriver]: https://sites.google.com/a/chromium.org/chromedriver/getting-started
|
208
206
|
[mailing list]: http://groups.google.com/group/activeadmin
|
209
207
|
[Stack Overflow]: http://stackoverflow.com/questions/tagged/activeadmin
|
210
208
|
[search the issue tracker]: https://github.com/activeadmin/activeadmin/issues?q=something
|
data/README.md
CHANGED
@@ -21,6 +21,11 @@ creating elegant backends for website administration.
|
|
21
21
|
* Try the [live demo][demo].
|
22
22
|
* The [wiki] includes links to tutorials, articles and sample projects.
|
23
23
|
|
24
|
+
## For enterprise
|
25
|
+
|
26
|
+
Active Admin for enterprise is available via the Tidelift subscription. [Learn
|
27
|
+
More][tidelift_enterprise].
|
28
|
+
|
24
29
|
## Need help?
|
25
30
|
|
26
31
|
Please use [StackOverflow][stackoverflow] for help requests and how-to questions.
|
@@ -39,7 +44,7 @@ to ask.
|
|
39
44
|
## Want to support us?
|
40
45
|
|
41
46
|
If you want to support us financially, you can [help fund the project
|
42
|
-
through a Tidelift subscription][
|
47
|
+
through a Tidelift subscription][tidelift_support]. By buying a Tidelift subscription
|
43
48
|
you make sure your whole dependency stack is properly maintained, while also
|
44
49
|
getting a comprehensive view of outdated dependencies, new releases, security
|
45
50
|
alerts, and licensing compatibility issues.
|
@@ -96,6 +101,8 @@ Thanks to [Open Collective][opencollective contributors] and all our Open Collec
|
|
96
101
|
[inch]: http://inch-ci.org/github/activeadmin/activeadmin
|
97
102
|
[tidelift_badge]: https://tidelift.com/badges/github/activeadmin/activeadmin
|
98
103
|
[tidelift]: https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=readme
|
104
|
+
[tidelift_enterprise]: https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=referral&utm_campaign=github&utm_content=enterprise
|
105
|
+
[tidelift_support]: https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=referral&utm_campaign=github&utm_content=support
|
99
106
|
|
100
107
|
[docs]: http://activeadmin.info/0-installation.html
|
101
108
|
[demo]: http://demo.activeadmin.info/admin
|
@@ -1,9 +1,13 @@
|
|
1
1
|
const onDOMReady = function() {
|
2
|
+
// Detach any previously attached handlers before re-attaching them.
|
3
|
+
// This avoids double-registered handlers when Turbolinks is enabled
|
4
|
+
$('.batch_actions_selector li a').off('click confirm:complete');
|
5
|
+
|
2
6
|
//
|
3
7
|
// Use ActiveAdmin.modal_dialog to prompt user if
|
4
8
|
// confirmation is required for current Batch Action
|
5
9
|
//
|
6
|
-
$('.batch_actions_selector li a').click
|
10
|
+
$('.batch_actions_selector li a').on('click', function(event){
|
7
11
|
let message;
|
8
12
|
event.stopPropagation(); // prevent Rails UJS click event
|
9
13
|
event.preventDefault();
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%# Link to the "First" page
|
2
|
+
- available local variables
|
3
|
+
url: url to the first page
|
4
|
+
current_page: a page object for the currently displayed page
|
5
|
+
total_pages: total number of pages
|
6
|
+
per_page: number of items to fetch per page
|
7
|
+
remote: data-remote
|
8
|
+
-%>
|
9
|
+
<span class="first">
|
10
|
+
<%= link_to_unless current_page.first?, t('views.pagination.first').html_safe, url, remote: remote %>
|
11
|
+
</span>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%# Non-link tag that stands for skipped pages...
|
2
|
+
- available local variables
|
3
|
+
current_page: a page object for the currently displayed page
|
4
|
+
total_pages: total number of pages
|
5
|
+
per_page: number of items to fetch per page
|
6
|
+
remote: data-remote
|
7
|
+
-%>
|
8
|
+
<span class="page gap"><%= t('views.pagination.truncate').html_safe %></span>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%# Link to the "Next" page
|
2
|
+
- available local variables
|
3
|
+
url: url to the next page
|
4
|
+
current_page: a page object for the currently displayed page
|
5
|
+
total_pages: total number of pages
|
6
|
+
per_page: number of items to fetch per page
|
7
|
+
remote: data-remote
|
8
|
+
-%>
|
9
|
+
<span class="next">
|
10
|
+
<%= link_to_unless current_page.last?, t('views.pagination.next').html_safe, url, rel: 'next', remote: remote %>
|
11
|
+
</span>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%# Link showing page number
|
2
|
+
- available local variables
|
3
|
+
page: a page object for "this" page
|
4
|
+
url: url to this page
|
5
|
+
current_page: a page object for the currently displayed page
|
6
|
+
total_pages: total number of pages
|
7
|
+
per_page: number of items to fetch per page
|
8
|
+
remote: data-remote
|
9
|
+
-%>
|
10
|
+
<span class="page<%= ' current' if page.current? %>">
|
11
|
+
<%= link_to_unless page.current?, page, url, {remote: remote, rel: page.rel} %>
|
12
|
+
</span>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<%# The container tag
|
2
|
+
- available local variables
|
3
|
+
current_page: a page object for the currently displayed page
|
4
|
+
total_pages: total number of pages
|
5
|
+
per_page: number of items to fetch per page
|
6
|
+
remote: data-remote
|
7
|
+
paginator: the paginator that renders the pagination tags inside
|
8
|
+
-%>
|
9
|
+
<%= paginator.render do -%>
|
10
|
+
<nav class="pagination">
|
11
|
+
<%= first_page_tag unless current_page.first? %>
|
12
|
+
<%= prev_page_tag unless current_page.first? %>
|
13
|
+
<% each_page do |page| -%>
|
14
|
+
<% if page.display_tag? -%>
|
15
|
+
<%= page_tag page %>
|
16
|
+
<% elsif !page.was_truncated? -%>
|
17
|
+
<%= gap_tag %>
|
18
|
+
<% end -%>
|
19
|
+
<% end -%>
|
20
|
+
<% unless current_page.out_of_range? %>
|
21
|
+
<%= next_page_tag unless current_page.last? %>
|
22
|
+
<% end %>
|
23
|
+
</nav>
|
24
|
+
<% end -%>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%# Link to the "Previous" page
|
2
|
+
- available local variables
|
3
|
+
url: url to the previous page
|
4
|
+
current_page: a page object for the currently displayed page
|
5
|
+
total_pages: total number of pages
|
6
|
+
per_page: number of items to fetch per page
|
7
|
+
remote: data-remote
|
8
|
+
-%>
|
9
|
+
<span class="prev">
|
10
|
+
<%= link_to_unless current_page.first?, t('views.pagination.previous').html_safe, url, rel: 'prev', remote: remote %>
|
11
|
+
</span>
|
data/config/locales/ca.yml
CHANGED
data/config/locales/de.yml
CHANGED
@@ -1,4 +1,20 @@
|
|
1
1
|
de:
|
2
|
+
activerecord:
|
3
|
+
models:
|
4
|
+
comment:
|
5
|
+
one: "Kommentar"
|
6
|
+
other: "Kommentare"
|
7
|
+
active_admin/comment:
|
8
|
+
one: "Kommentar"
|
9
|
+
other: "Kommentare"
|
10
|
+
attributes:
|
11
|
+
active_admin/comment:
|
12
|
+
author_type: "Autortyp"
|
13
|
+
body: "Inhalt"
|
14
|
+
created_at: "Erstellt"
|
15
|
+
namespace: "Namensraum"
|
16
|
+
resource_type: "Ressourcentyp"
|
17
|
+
updated_at: "Aktualisiert"
|
2
18
|
active_admin:
|
3
19
|
dashboard: Übersicht
|
4
20
|
dashboard_welcome:
|
@@ -37,6 +53,8 @@ de:
|
|
37
53
|
lteq_datetime: "Kleiner gleich"
|
38
54
|
from: "Von"
|
39
55
|
to: "Bis"
|
56
|
+
scopes:
|
57
|
+
all: "Alle"
|
40
58
|
search_status:
|
41
59
|
headline: "Filter"
|
42
60
|
current_scope: "Anwendungsbereich:"
|
data/config/locales/sk.yml
CHANGED
@@ -1,4 +1,24 @@
|
|
1
1
|
sk:
|
2
|
+
activerecord:
|
3
|
+
models:
|
4
|
+
comment:
|
5
|
+
one: "Komentár"
|
6
|
+
few: "Komentáre"
|
7
|
+
many: "Komentárov"
|
8
|
+
other: "Komentáre"
|
9
|
+
active_admin/comment:
|
10
|
+
one: "Komentár"
|
11
|
+
few: "Komentáre"
|
12
|
+
many: "Komentárov"
|
13
|
+
other: "Komentáre"
|
14
|
+
attributes:
|
15
|
+
active_admin/comment:
|
16
|
+
author_type: "Typ autora"
|
17
|
+
body: "Telo"
|
18
|
+
created_at: "Vytvorený"
|
19
|
+
namespace: "Namespace"
|
20
|
+
resource_type: "Typ komentovanej položky"
|
21
|
+
updated_at: "Upravený"
|
2
22
|
active_admin:
|
3
23
|
dashboard: Úvod
|
4
24
|
dashboard_welcome:
|
@@ -8,6 +28,7 @@ sk:
|
|
8
28
|
edit: "Upraviť"
|
9
29
|
delete: "Zmazať"
|
10
30
|
delete_confirmation: "Ste si istí, že chcete túto položku zmazať?"
|
31
|
+
create_another: "Vytvoriť ďalší %{model}"
|
11
32
|
new_model: "Vytvoriť"
|
12
33
|
edit_model: "Upraviť"
|
13
34
|
delete_model: "Zmazať"
|
@@ -20,6 +41,7 @@ sk:
|
|
20
41
|
has_many_new: "Pridať nový"
|
21
42
|
has_many_delete: "Zmazať"
|
22
43
|
has_many_remove: "Odstrániť"
|
44
|
+
move: "Presunúť"
|
23
45
|
filters:
|
24
46
|
buttons:
|
25
47
|
filter: "Filtrovať"
|
@@ -31,6 +53,17 @@ sk:
|
|
31
53
|
ends_with: "Končí na"
|
32
54
|
greater_than: "Väčší ako"
|
33
55
|
less_than: "Menší ako"
|
56
|
+
gteq_datetime: "Od"
|
57
|
+
lteq_datetime: "Do"
|
58
|
+
from: "Od"
|
59
|
+
to: "Do"
|
60
|
+
scopes:
|
61
|
+
all: "Všetko"
|
62
|
+
search_status:
|
63
|
+
headline: "Stav vyhľadávania:"
|
64
|
+
current_scope: "Scope:"
|
65
|
+
current_filters: "Filtre:"
|
66
|
+
no_current_filters: "Žiadne"
|
34
67
|
status_tag:
|
35
68
|
"yes": "Áno"
|
36
69
|
"no": "Nie"
|
@@ -40,6 +73,7 @@ sk:
|
|
40
73
|
powered_by: "%{active_admin} %{version}"
|
41
74
|
sidebars:
|
42
75
|
filters: "Filtre"
|
76
|
+
search_status: "Stav vyhľadávania"
|
43
77
|
pagination:
|
44
78
|
empty: "Nenájdený."
|
45
79
|
one: "Zobrazená <b>1</b> položka"
|
@@ -70,11 +104,14 @@ sk:
|
|
70
104
|
labels:
|
71
105
|
destroy: "Vymazať"
|
72
106
|
comments:
|
107
|
+
created_at: "Vytvorený"
|
73
108
|
resource_type: "Typ zdroja"
|
74
109
|
author_type: "Typ autora"
|
75
110
|
body: "Telo"
|
76
111
|
author: "Autor"
|
77
112
|
add: "Pridať komentár"
|
113
|
+
delete: "Zmazať komentár"
|
114
|
+
delete_confirmation: "Naozaj chcete zmazať tento komentár?"
|
78
115
|
resource: "Zdroj"
|
79
116
|
no_comments_yet: "Žiadny komentár"
|
80
117
|
author_missing: "Anonymný"
|
@@ -82,6 +119,19 @@ sk:
|
|
82
119
|
errors:
|
83
120
|
empty_text: "Komentár nebol uložený, je prázdny."
|
84
121
|
devise:
|
122
|
+
username:
|
123
|
+
title: "Užívateľské meno"
|
124
|
+
email:
|
125
|
+
title: "Email"
|
126
|
+
subdomain:
|
127
|
+
title: "Subdoména"
|
128
|
+
password:
|
129
|
+
title: "Heslo"
|
130
|
+
password_confirmation:
|
131
|
+
title: "Potvrdenie hesla"
|
132
|
+
sign_up:
|
133
|
+
title: "Registrácia"
|
134
|
+
submit: "Registrovať"
|
85
135
|
login:
|
86
136
|
title: "Prihlásenie"
|
87
137
|
remember_me: "Zapamätať si ma"
|
@@ -95,11 +145,20 @@ sk:
|
|
95
145
|
unlock:
|
96
146
|
title: "Zaslanie inštrukcií k odomknutiu účtu"
|
97
147
|
submit: "Zaslať inštrukcií k odomknutiu účtu"
|
148
|
+
resend_confirmation_instructions:
|
149
|
+
title: "Preposlanie potvrdzovacie inštrukcie"
|
150
|
+
submit: "Preposlať potvrdzovacie inštrukcie"
|
98
151
|
links:
|
99
152
|
sign_in: "Prihlásiť sa"
|
100
153
|
sign_up: "Registrovať sa"
|
101
154
|
forgot_your_password: "Zabudli ste heslo?"
|
102
155
|
sign_in_with_omniauth_provider: "Prihlásiť sa cez %{provider}"
|
156
|
+
resend_unlock_instructions: "Poslať znovu inštrukcie na odomknutie účtu"
|
157
|
+
resend_confirmation_instructions: "Preposlať potvrdzovacie inštrukcie"
|
158
|
+
unsupported_browser:
|
159
|
+
headline: "ActiveAdmin nepodporuje Internet Explorer vo verzii <= 8."
|
160
|
+
recommendation: "Odporúčame <a href=\"http://browsehappy.com/\">aktualizovať Váš prehliadač</a>."
|
161
|
+
turn_off_compatibility_view: "Ak používate Internet Explorer vo verzii >= 9, uistite sa, že <a href=\"https://support.microsoft.com/en-us/help/17471\">\"režim kompatibility\" je vypnutý</a>"
|
103
162
|
access_denied:
|
104
163
|
message: "Nemáte oprávnenie k vykonaniu tejto akcie."
|
105
164
|
index_list:
|
@@ -355,7 +355,7 @@ end
|
|
355
355
|
```
|
356
356
|
|
357
357
|
If you need to completely replace the record retrieving code (e.g., you have a
|
358
|
-
custom `to_param` implementation in your models), override the `
|
358
|
+
custom `to_param` implementation in your models), override the `find_resource` method
|
359
359
|
on the controller:
|
360
360
|
|
361
361
|
```ruby
|
@@ -193,6 +193,13 @@ controller do
|
|
193
193
|
end
|
194
194
|
```
|
195
195
|
|
196
|
+
You can also define associated objects to include outside of the
|
197
|
+
`scoped_collection` method:
|
198
|
+
|
199
|
+
```ruby
|
200
|
+
includes :publisher
|
201
|
+
```
|
202
|
+
|
196
203
|
Then it's simple to sort by any Publisher attribute from within the index table:
|
197
204
|
|
198
205
|
```ruby
|
data/docs/Gemfile
CHANGED
data/docs/Gemfile.lock
CHANGED
@@ -198,15 +198,15 @@ GEM
|
|
198
198
|
rb-inotify (~> 0.9, >= 0.9.7)
|
199
199
|
ruby_dep (~> 1.2)
|
200
200
|
mercenary (0.3.6)
|
201
|
-
mini_portile2 (2.
|
201
|
+
mini_portile2 (2.4.0)
|
202
202
|
minima (2.5.0)
|
203
203
|
jekyll (~> 3.5)
|
204
204
|
jekyll-feed (~> 0.9)
|
205
205
|
jekyll-seo-tag (~> 2.1)
|
206
206
|
minitest (5.11.3)
|
207
207
|
multipart-post (2.0.0)
|
208
|
-
nokogiri (1.
|
209
|
-
mini_portile2 (~> 2.
|
208
|
+
nokogiri (1.10.4)
|
209
|
+
mini_portile2 (~> 2.4.0)
|
210
210
|
octokit (4.12.0)
|
211
211
|
sawyer (~> 0.8.0, >= 0.5.3)
|
212
212
|
pathutil (0.16.1)
|
@@ -219,7 +219,7 @@ GEM
|
|
219
219
|
ruby-enum (0.7.2)
|
220
220
|
i18n
|
221
221
|
ruby_dep (1.5.0)
|
222
|
-
rubyzip (
|
222
|
+
rubyzip (2.0.0)
|
223
223
|
safe_yaml (1.0.4)
|
224
224
|
sass (3.6.0)
|
225
225
|
sass-listen (~> 4.0.0)
|
@@ -243,7 +243,6 @@ PLATFORMS
|
|
243
243
|
|
244
244
|
DEPENDENCIES
|
245
245
|
github-pages
|
246
|
-
jekyll-redirect-from
|
247
246
|
|
248
247
|
BUNDLED WITH
|
249
248
|
1.16.5
|
data/docs/_config.yml
CHANGED
@@ -8,9 +8,9 @@
|
|
8
8
|
</div>
|
9
9
|
|
10
10
|
<div id="tidelift">
|
11
|
-
<a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=
|
11
|
+
<a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=homepage" target="_blank">
|
12
12
|
<span class="cta">
|
13
|
-
|
13
|
+
Active Admin for enterprise available via Tidelift
|
14
14
|
</span>
|
15
15
|
</a>
|
16
16
|
</div>
|
data/docs/index.html
CHANGED
@@ -10,81 +10,101 @@
|
|
10
10
|
<p class="intro">
|
11
11
|
The <strong>administration framework</strong> for business critical <strong>Ruby on Rails</strong> applications.
|
12
12
|
</p>
|
13
|
+
|
13
14
|
<p>
|
14
15
|
Active Admin is a Ruby on Rails plugin for generating administration style interfaces. It abstracts common business application patterns to make it simple for developers to implement beautiful and elegant interfaces with very little effort.
|
15
16
|
</p>
|
17
|
+
|
16
18
|
<h2>
|
17
19
|
A beautiful interface designed for real people.
|
18
20
|
</h2>
|
21
|
+
|
19
22
|
<div id="features">
|
20
23
|
<div id="features-left">
|
21
24
|
<h3 class="first">
|
22
25
|
Global Navigation
|
23
26
|
</h3>
|
27
|
+
|
24
28
|
<p>
|
25
29
|
Customizable global navigation allows you to create usable admin interfaces for your business.
|
26
30
|
</p>
|
31
|
+
|
27
32
|
<h3>
|
28
33
|
Scopes
|
29
34
|
</h3>
|
35
|
+
|
30
36
|
<p>
|
31
37
|
Use scopes to create sections of mutually exclusive resources for quick navigation and reporting.
|
32
38
|
</p>
|
39
|
+
|
33
40
|
<h3>
|
34
41
|
Index Styles
|
35
42
|
</h3>
|
43
|
+
|
36
44
|
<p>
|
37
45
|
Index screens are available in many styles. The default, shown here, is a table view, but Active Admin also supports Grids, Blocks and a Blog view.
|
38
46
|
</p>
|
47
|
+
|
39
48
|
<h3>
|
40
49
|
<span class="caps">API</span> & Downloads
|
41
50
|
</h3>
|
51
|
+
|
42
52
|
<p>
|
43
53
|
Each resource that is registered wtih Active Admin becomes available as <span class="caps">JSON</span>, <span class="caps">XML</span> and <span class="caps">CSV</span> download. Customize the output to meet your requirements.
|
44
54
|
</p>
|
45
55
|
</div>
|
56
|
+
|
46
57
|
<div id="features-right">
|
47
58
|
<h3 class="first">
|
48
59
|
User Authentication
|
49
60
|
</h3>
|
61
|
+
|
50
62
|
<p>
|
51
63
|
Use the bundled Devise configuration or implement your own authorization using the provided hooks.
|
52
64
|
</p>
|
65
|
+
|
53
66
|
<h3>
|
54
67
|
Action Items
|
55
68
|
</h3>
|
69
|
+
|
56
70
|
<p>
|
57
71
|
Add buttons, links or other content in the “Action Items” section on each screen.
|
58
72
|
</p>
|
73
|
+
|
59
74
|
<h3>
|
60
75
|
Filters
|
61
76
|
</h3>
|
77
|
+
|
62
78
|
<p>
|
63
79
|
Allow users to filter resources by searching strings, text fields, dates, and numeric values.
|
64
80
|
</p>
|
81
|
+
|
65
82
|
<h3>
|
66
83
|
Sidebar Sections
|
67
84
|
</h3>
|
85
|
+
|
68
86
|
<p>
|
69
87
|
Customize the sidebar sections with a simple <span class="caps">DSL</span> built in to Active Admin.
|
70
88
|
</p>
|
71
89
|
</div>
|
72
90
|
</div>
|
91
|
+
|
73
92
|
<p>
|
74
93
|
Active Admin’s interface was designed from the ground up for non-technical users. It makes it easy for developers to build highly usable interfaces that customers will actually enjoy using.
|
75
94
|
</p>
|
95
|
+
|
76
96
|
<h2>
|
77
97
|
An elegant <span class="caps">DSL</span> built for developer productivity.
|
78
98
|
</h2>
|
99
|
+
|
79
100
|
<p>
|
80
101
|
Get started with one line of code or customize the entire interface with the provided <span class="caps">DSL</span>.
|
81
102
|
</p>
|
103
|
+
|
82
104
|
<div id="dsl">
|
83
105
|
<div class="highlight">
|
84
|
-
<pre>
|
85
|
-
<code class="ruby"><span class="c1"># app/admin/products.rb</span>
|
106
|
+
<pre><code class="ruby"><span class="c1"># app/admin/products.rb</span>
|
86
107
|
<span class="no">ActiveAdmin</span><span class="o">.</span><span class="n">register</span> <span class="no">Product</span> <span class="k">do</span>
|
87
|
-
|
88
108
|
<span class="c1"># Create sections on the index screen</span>
|
89
109
|
<span class="n">scope</span> <span class="ss">:all</span><span class="p">,</span> <span class="ss">default:</span> <span class="kp">true</span>
|
90
110
|
<span class="n">scope</span> <span class="ss">:available</span>
|
@@ -104,12 +124,93 @@
|
|
104
124
|
<span class="k">end</span>
|
105
125
|
<span class="n">actions</span>
|
106
126
|
<span class="k">end</span>
|
107
|
-
|
108
|
-
<span class="k">end</span>
|
109
|
-
</code>
|
110
|
-
</pre>
|
127
|
+
<span class="k">end</span></code></pre>
|
111
128
|
</div>
|
112
129
|
</div>
|
130
|
+
|
131
|
+
<h2>
|
132
|
+
Active Admin for enterprise
|
133
|
+
</h2>
|
134
|
+
|
135
|
+
<p>
|
136
|
+
<a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=homepage">
|
137
|
+
Available as part of the Tidelift Subscription
|
138
|
+
</a>
|
139
|
+
</p>
|
140
|
+
|
141
|
+
<p>
|
142
|
+
Active Admin and the maintainers of thousands of other packages are
|
143
|
+
working with Tidelift to deliver one enterprise subscription that
|
144
|
+
covers all of the open source you use.
|
145
|
+
</p>
|
146
|
+
|
147
|
+
<p>
|
148
|
+
If you want the flexibility of open source and the confidence of
|
149
|
+
commercial-grade software, this is for you.
|
150
|
+
</p>
|
151
|
+
|
152
|
+
<div class="tidelift-buttons">
|
153
|
+
<a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=referral" target="_blank">
|
154
|
+
<span>LEARN MORE</span>
|
155
|
+
</a>
|
156
|
+
|
157
|
+
<a href="https://tidelift.com/subscription/request-a-demo?utm_source=rubygems-activeadmin&utm_medium=referral" target="_blank">
|
158
|
+
<span>REQUEST A DEMO</span>
|
159
|
+
</a>
|
160
|
+
</div>
|
161
|
+
|
162
|
+
<h3>
|
163
|
+
The Tidelift Subscription manages your dependencies for you.
|
164
|
+
</h3>
|
165
|
+
|
166
|
+
<ul>
|
167
|
+
<li>
|
168
|
+
Get the tools you need to continuously catalog and understand the open source software that your application depends on.
|
169
|
+
</li>
|
170
|
+
|
171
|
+
<li>
|
172
|
+
Your subscription helps pay the open source maintainers of the exact
|
173
|
+
packages you use to ensure they meet the standards you require.
|
174
|
+
</li>
|
175
|
+
|
176
|
+
<li>
|
177
|
+
Address issues proactively, with tools that scan for new security,
|
178
|
+
licensing, and maintenance issues, and alert our participating open
|
179
|
+
source maintainers so they can resolve them on your behalf.
|
180
|
+
</li>
|
181
|
+
|
182
|
+
<li>
|
183
|
+
Measure and improve your open source dependencies' health—which
|
184
|
+
improves your app’s health—and get a short list of high-impact steps
|
185
|
+
your team can take to improve them even more.
|
186
|
+
</li>
|
187
|
+
|
188
|
+
<li>
|
189
|
+
Get commercial assurances that don't come for free with open source
|
190
|
+
packages, like intellectual property indemnification and support
|
191
|
+
under a service level agreement. You expect these guarantees from
|
192
|
+
proprietary software, and you can have them when using open source
|
193
|
+
as well.
|
194
|
+
</li>
|
195
|
+
</ul>
|
196
|
+
|
197
|
+
<p>
|
198
|
+
The end result? All of the capabilities you expect from
|
199
|
+
commercial-grade software, for the full breadth of open source you
|
200
|
+
use. That means less time grappling with esoteric open source trivia,
|
201
|
+
and more time building your own applications—and your business.
|
202
|
+
</p>
|
203
|
+
|
204
|
+
<div class="tidelift-buttons">
|
205
|
+
<a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=referral" target="_blank">
|
206
|
+
<span>LEARN MORE</span>
|
207
|
+
</a>
|
208
|
+
|
209
|
+
<a href="https://tidelift.com/subscription/request-a-demo?utm_source=rubygems-activeadmin&utm_medium=referral" target="_blank">
|
210
|
+
<span>REQUEST A DEMO</span>
|
211
|
+
</a>
|
212
|
+
</div>
|
213
|
+
|
113
214
|
<h2 class="getting-started-heading">
|
114
215
|
3 Ways to Get Started:
|
115
216
|
</h2>
|
data/docs/stylesheets/main.css
CHANGED
@@ -615,6 +615,35 @@ body #tidelift a .cta {
|
|
615
615
|
padding-left: 30px;
|
616
616
|
}
|
617
617
|
|
618
|
+
body .tidelift-buttons a {
|
619
|
+
display: table;
|
620
|
+
width: 200px;
|
621
|
+
border: 2px solid #407985;
|
622
|
+
border-radius: 4px;
|
623
|
+
text-decoration: none;
|
624
|
+
font-family: 'Yanone Kaffeesatz', 'Helvetica Neue', Arial, Helvetica, sans-serif;
|
625
|
+
font-size: 18px;
|
626
|
+
letter-spacing: 1px;
|
627
|
+
margin: 0 10px;
|
628
|
+
}
|
629
|
+
|
630
|
+
body .tidelift-buttons a:first-child {
|
631
|
+
float: left;
|
632
|
+
color: #407985;
|
633
|
+
background: #FFF;
|
634
|
+
}
|
635
|
+
|
636
|
+
body .tidelift-buttons a:last-child {
|
637
|
+
color: #FFF;
|
638
|
+
background: #407985;
|
639
|
+
}
|
640
|
+
|
641
|
+
body .tidelift-buttons a span {
|
642
|
+
display: table-cell;
|
643
|
+
vertical-align: middle;
|
644
|
+
text-align: center;
|
645
|
+
}
|
646
|
+
|
618
647
|
body .clear {
|
619
648
|
clear: both;
|
620
649
|
}
|
@@ -33,7 +33,7 @@ module ActiveAdmin
|
|
33
33
|
def initialize(options = {}, &block)
|
34
34
|
@resource = options.delete(:resource)
|
35
35
|
@columns = []
|
36
|
-
@options = options
|
36
|
+
@options = ActiveAdmin.application.csv_options.merge options
|
37
37
|
@block = block
|
38
38
|
end
|
39
39
|
|
@@ -44,7 +44,6 @@ module ActiveAdmin
|
|
44
44
|
def build(controller, csv)
|
45
45
|
@collection = controller.send :find_collection, except: :pagination
|
46
46
|
columns = exec_columns controller.view_context
|
47
|
-
options = ActiveAdmin.application.csv_options.merge self.options
|
48
47
|
bom = options.delete :byte_order_mark
|
49
48
|
column_names = options.delete(:column_names) { true }
|
50
49
|
csv_options = options.except :encoding_options, :humanize_name
|
@@ -129,12 +129,36 @@ module ActiveAdmin
|
|
129
129
|
not_poly.reject! { |r| r.chain.length > 2 }
|
130
130
|
|
131
131
|
filters = poly.map(&:foreign_type) + not_poly.map(&:name)
|
132
|
+
|
133
|
+
# Check high-arity associations for filterable columns
|
134
|
+
max = namespace.maximum_association_filter_arity
|
135
|
+
if max != :unlimited
|
136
|
+
high_arity, low_arity = not_poly.partition do |r|
|
137
|
+
r.klass.reorder(nil).limit(max + 1).count > max
|
138
|
+
end
|
139
|
+
|
140
|
+
# Remove high-arity associations with no searchable column
|
141
|
+
high_arity = high_arity.select(&method(:searchable_column_for))
|
142
|
+
|
143
|
+
high_arity = high_arity.map { |r| r.name.to_s + "_" + searchable_column_for(r) + namespace.filter_method_for_large_association }
|
144
|
+
|
145
|
+
filters = poly.map(&:foreign_type) + low_arity.map(&:name) + high_arity
|
146
|
+
end
|
147
|
+
|
132
148
|
filters.map &:to_sym
|
133
149
|
else
|
134
150
|
[]
|
135
151
|
end
|
136
152
|
end
|
137
153
|
|
154
|
+
def search_columns
|
155
|
+
@search_columns ||= namespace.filter_columns_for_large_association.map(&:to_s)
|
156
|
+
end
|
157
|
+
|
158
|
+
def searchable_column_for(relation)
|
159
|
+
relation.klass.column_names.find { |name| search_columns.include?(name) }
|
160
|
+
end
|
161
|
+
|
138
162
|
def add_filters_sidebar_section
|
139
163
|
self.sidebar_sections << filters_sidebar_section
|
140
164
|
end
|
@@ -9,8 +9,16 @@ module ActiveAdmin
|
|
9
9
|
@class_name.constantize.new.attributes.keys
|
10
10
|
end
|
11
11
|
|
12
|
+
def assignable_attributes
|
13
|
+
attributes - %w(id created_at updated_at)
|
14
|
+
end
|
15
|
+
|
16
|
+
def permit_params
|
17
|
+
assignable_attributes.map { |a| a.to_sym.inspect }.join(', ')
|
18
|
+
end
|
19
|
+
|
12
20
|
def rows
|
13
|
-
attributes.map { |a| row(a) }.join("\n")
|
21
|
+
attributes.map { |a| row(a) }.join("\n ")
|
14
22
|
end
|
15
23
|
|
16
24
|
def row(name)
|
@@ -18,7 +26,7 @@ module ActiveAdmin
|
|
18
26
|
end
|
19
27
|
|
20
28
|
def columns
|
21
|
-
attributes.map { |a| column(a) }.join("\n")
|
29
|
+
attributes.map { |a| column(a) }.join("\n ")
|
22
30
|
end
|
23
31
|
|
24
32
|
def column(name)
|
@@ -26,7 +34,7 @@ module ActiveAdmin
|
|
26
34
|
end
|
27
35
|
|
28
36
|
def filters
|
29
|
-
attributes.map { |a| filter(a) }.join("\n")
|
37
|
+
attributes.map { |a| filter(a) }.join("\n ")
|
30
38
|
end
|
31
39
|
|
32
40
|
def filter(name)
|
@@ -34,7 +42,7 @@ module ActiveAdmin
|
|
34
42
|
end
|
35
43
|
|
36
44
|
def form_inputs
|
37
|
-
|
45
|
+
assignable_attributes.map { |a| form_input(a) }.join("\n ")
|
38
46
|
end
|
39
47
|
|
40
48
|
def form_input(name)
|
@@ -106,5 +106,18 @@ module ActiveAdmin
|
|
106
106
|
|
107
107
|
# Include association filters by default
|
108
108
|
register :include_default_association_filters, true
|
109
|
+
|
110
|
+
register :maximum_association_filter_arity, :unlimited
|
111
|
+
|
112
|
+
register :filter_columns_for_large_association, [
|
113
|
+
:display_name,
|
114
|
+
:full_name,
|
115
|
+
:name,
|
116
|
+
:username,
|
117
|
+
:login,
|
118
|
+
:title,
|
119
|
+
:email,
|
120
|
+
]
|
121
|
+
register :filter_method_for_large_association, '_starts_with'
|
109
122
|
end
|
110
123
|
end
|
@@ -12,6 +12,7 @@ require 'active_admin/resource/scope_to'
|
|
12
12
|
require 'active_admin/resource/sidebars'
|
13
13
|
require 'active_admin/resource/belongs_to'
|
14
14
|
require 'active_admin/resource/ordering'
|
15
|
+
require 'active_admin/resource/model'
|
15
16
|
|
16
17
|
module ActiveAdmin
|
17
18
|
|
@@ -104,6 +105,10 @@ module ActiveAdmin
|
|
104
105
|
ActiveSupport::Dependencies.constantize(decorator_class_name) if decorator_class_name
|
105
106
|
end
|
106
107
|
|
108
|
+
def resource_name_extension
|
109
|
+
@resource_name_extension ||= define_resource_name_extension(self)
|
110
|
+
end
|
111
|
+
|
107
112
|
def resource_table_name
|
108
113
|
resource_class.quoted_table_name
|
109
114
|
end
|
@@ -133,6 +138,7 @@ module ActiveAdmin
|
|
133
138
|
def belongs_to(target, options = {})
|
134
139
|
@belongs_to = Resource::BelongsTo.new(self, target, options)
|
135
140
|
self.menu_item_options = false if @belongs_to.required?
|
141
|
+
options[:class_name] ||= @belongs_to.resource.resource_class_name if @belongs_to.resource
|
136
142
|
controller.send :belongs_to, target, options.dup
|
137
143
|
end
|
138
144
|
|
@@ -203,5 +209,12 @@ module ActiveAdmin
|
|
203
209
|
@default_csv_builder ||= CSVBuilder.default_for_resource(self)
|
204
210
|
end
|
205
211
|
|
212
|
+
def define_resource_name_extension(resource)
|
213
|
+
Module.new do
|
214
|
+
define_method :model_name do
|
215
|
+
resource.resource_name
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
206
219
|
end # class Resource
|
207
220
|
end # module ActiveAdmin
|
@@ -110,7 +110,7 @@ module ActiveAdmin
|
|
110
110
|
# @return params to pass to instance path
|
111
111
|
def route_instance_params(instance)
|
112
112
|
if nested?
|
113
|
-
[instance.public_send(
|
113
|
+
[instance.public_send(belongs_to_target_name).to_param, instance.to_param]
|
114
114
|
else
|
115
115
|
instance.to_param
|
116
116
|
end
|
@@ -123,11 +123,19 @@ module ActiveAdmin
|
|
123
123
|
end
|
124
124
|
|
125
125
|
def nested?
|
126
|
-
resource.belongs_to? &&
|
126
|
+
resource.belongs_to? && belongs_to_config.required?
|
127
|
+
end
|
128
|
+
|
129
|
+
def belongs_to_target_name
|
130
|
+
belongs_to_config.target_name
|
127
131
|
end
|
128
132
|
|
129
133
|
def belongs_to_name
|
130
|
-
|
134
|
+
belongs_to_config.target.resource_name.singular
|
135
|
+
end
|
136
|
+
|
137
|
+
def belongs_to_config
|
138
|
+
resource.belongs_to_config
|
131
139
|
end
|
132
140
|
|
133
141
|
def routes
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'active_admin/resource_controller/action_builder'
|
2
2
|
require 'active_admin/resource_controller/data_access'
|
3
3
|
require 'active_admin/resource_controller/decorators'
|
4
|
+
require 'active_admin/resource_controller/polymorphic_routes'
|
4
5
|
require 'active_admin/resource_controller/scoping'
|
5
6
|
require 'active_admin/resource_controller/streaming'
|
6
7
|
require 'active_admin/resource_controller/sidebars'
|
@@ -18,6 +19,7 @@ module ActiveAdmin
|
|
18
19
|
include ActionBuilder
|
19
20
|
include Decorators
|
20
21
|
include DataAccess
|
22
|
+
include PolymorphicRoutes
|
21
23
|
include Scoping
|
22
24
|
include Streaming
|
23
25
|
include Sidebars
|
@@ -67,8 +67,8 @@ module ActiveAdmin
|
|
67
67
|
def self.wrap!(parent, name)
|
68
68
|
::Class.new parent do
|
69
69
|
delegate :reorder, :page, :current_page, :total_pages, :limit_value,
|
70
|
-
:total_count, :total_pages, :
|
71
|
-
:find_each, :ransack
|
70
|
+
:total_count, :total_pages, :offset, :to_key, :group_values,
|
71
|
+
:except, :find_each, :ransack
|
72
72
|
|
73
73
|
define_singleton_method(:name) { name }
|
74
74
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require "active_admin/resource"
|
2
|
+
require "active_admin/resource/model"
|
3
|
+
|
4
|
+
module ActiveAdmin
|
5
|
+
class ResourceController < BaseController
|
6
|
+
module PolymorphicRoutes
|
7
|
+
def polymorphic_url(record_or_hash_or_array, options = {})
|
8
|
+
super(map_named_resources_for(record_or_hash_or_array), options)
|
9
|
+
end
|
10
|
+
|
11
|
+
def polymorphic_path(record_or_hash_or_array, options = {})
|
12
|
+
super(map_named_resources_for(record_or_hash_or_array), options)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def map_named_resources_for(record_or_hash_or_array)
|
18
|
+
return record_or_hash_or_array unless record_or_hash_or_array.is_a?(Array)
|
19
|
+
|
20
|
+
record_or_hash_or_array.map { |record| to_named_resource(record) }
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_named_resource(record)
|
24
|
+
if record.is_a?(resource_class)
|
25
|
+
return ActiveAdmin::Model.new(active_admin_config, record)
|
26
|
+
end
|
27
|
+
|
28
|
+
if record.is_a?(parent.class)
|
29
|
+
return ActiveAdmin::Model.new(active_admin_config.belongs_to_config.resource, record)
|
30
|
+
end
|
31
|
+
|
32
|
+
record
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/active_admin/version.rb
CHANGED
@@ -92,11 +92,11 @@ module ActiveAdmin
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def build_pagination
|
95
|
-
options = { theme: 'active_admin' }
|
95
|
+
options = { theme: @display_total ? 'active_admin' : 'active_admin_countless' }
|
96
96
|
options[:params] = @params if @params
|
97
97
|
options[:param_name] = @param_name if @param_name
|
98
98
|
|
99
|
-
if !@display_total
|
99
|
+
if !@display_total
|
100
100
|
# The #paginate method in kaminari will query the resource with a
|
101
101
|
# count(*) to determine how many pages there should be unless
|
102
102
|
# you pass in the :total_pages option. We issue a query to determine
|
@@ -192,6 +192,13 @@ module ActiveAdmin
|
|
192
192
|
# end
|
193
193
|
# ```
|
194
194
|
#
|
195
|
+
# You can also define associated objects to include outside of the
|
196
|
+
# `scoped_collection` method:
|
197
|
+
#
|
198
|
+
# ```ruby
|
199
|
+
# includes :publisher
|
200
|
+
# ```
|
201
|
+
#
|
195
202
|
# Then it's simple to sort by any Publisher attribute from within the index table:
|
196
203
|
#
|
197
204
|
# ```ruby
|
@@ -286,12 +286,25 @@ ActiveAdmin.setup do |config|
|
|
286
286
|
# config.filters = true
|
287
287
|
#
|
288
288
|
# By default the filters include associations in a select, which means
|
289
|
-
# that every record will be loaded for each association
|
289
|
+
# that every record will be loaded for each association (up
|
290
|
+
# to the value of config.maximum_association_filter_arity).
|
290
291
|
# You can enabled or disable the inclusion
|
291
292
|
# of those filters by default here.
|
292
293
|
#
|
293
294
|
# config.include_default_association_filters = true
|
294
295
|
|
296
|
+
# config.maximum_association_filter_arity = 256 # default value of :unlimited will change to 256 in a future version
|
297
|
+
# config.filter_columns_for_large_association, [
|
298
|
+
# :display_name,
|
299
|
+
# :full_name,
|
300
|
+
# :name,
|
301
|
+
# :username,
|
302
|
+
# :login,
|
303
|
+
# :title,
|
304
|
+
# :email,
|
305
|
+
# ]
|
306
|
+
# config.filter_method_for_large_association, '_starts_with'
|
307
|
+
|
295
308
|
# == Head
|
296
309
|
#
|
297
310
|
# You can add your own content to the site head like analytics. Make sure
|
@@ -3,12 +3,14 @@ ActiveAdmin.register <%= class_name %> do
|
|
3
3
|
# See permitted parameters documentation:
|
4
4
|
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
|
5
5
|
#
|
6
|
-
#
|
6
|
+
# Uncomment all parameters which should be permitted for assignment
|
7
|
+
#
|
8
|
+
# permit_params <%= @boilerplate.permit_params %>
|
7
9
|
#
|
8
10
|
# or
|
9
11
|
#
|
10
12
|
# permit_params do
|
11
|
-
# permitted = [
|
13
|
+
# permitted = [<%= @boilerplate.permit_params %>]
|
12
14
|
# permitted << :other if params[:action] == 'create' && current_user.admin?
|
13
15
|
# permitted
|
14
16
|
# end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeadmin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charles Maresh
|
@@ -15,7 +15,7 @@ authors:
|
|
15
15
|
autorequire:
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
|
-
date: 2019-
|
18
|
+
date: 2019-10-03 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: arbre
|
@@ -302,6 +302,12 @@ files:
|
|
302
302
|
- app/views/kaminari/active_admin/_page.html.erb
|
303
303
|
- app/views/kaminari/active_admin/_paginator.html.erb
|
304
304
|
- app/views/kaminari/active_admin/_prev_page.html.erb
|
305
|
+
- app/views/kaminari/active_admin_countless/_first_page.html.erb
|
306
|
+
- app/views/kaminari/active_admin_countless/_gap.html.erb
|
307
|
+
- app/views/kaminari/active_admin_countless/_next_page.html.erb
|
308
|
+
- app/views/kaminari/active_admin_countless/_page.html.erb
|
309
|
+
- app/views/kaminari/active_admin_countless/_paginator.html.erb
|
310
|
+
- app/views/kaminari/active_admin_countless/_prev_page.html.erb
|
305
311
|
- app/views/layouts/active_admin.html.arb
|
306
312
|
- app/views/layouts/active_admin_logged_out.html.erb
|
307
313
|
- config/locales/ar.yml
|
@@ -471,6 +477,7 @@ files:
|
|
471
477
|
- lib/active_admin/resource/controllers.rb
|
472
478
|
- lib/active_admin/resource/includes.rb
|
473
479
|
- lib/active_admin/resource/menu.rb
|
480
|
+
- lib/active_admin/resource/model.rb
|
474
481
|
- lib/active_admin/resource/naming.rb
|
475
482
|
- lib/active_admin/resource/ordering.rb
|
476
483
|
- lib/active_admin/resource/page_presenters.rb
|
@@ -484,6 +491,7 @@ files:
|
|
484
491
|
- lib/active_admin/resource_controller/action_builder.rb
|
485
492
|
- lib/active_admin/resource_controller/data_access.rb
|
486
493
|
- lib/active_admin/resource_controller/decorators.rb
|
494
|
+
- lib/active_admin/resource_controller/polymorphic_routes.rb
|
487
495
|
- lib/active_admin/resource_controller/resource_class_methods.rb
|
488
496
|
- lib/active_admin/resource_controller/scoping.rb
|
489
497
|
- lib/active_admin/resource_controller/sidebars.rb
|
@@ -607,7 +615,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
607
615
|
- !ruby/object:Gem::Version
|
608
616
|
version: '0'
|
609
617
|
requirements: []
|
610
|
-
rubygems_version: 3.0.
|
618
|
+
rubygems_version: 3.0.3
|
611
619
|
signing_key:
|
612
620
|
specification_version: 4
|
613
621
|
summary: Active Admin is a Ruby on Rails plugin for generating administration style
|