activeadmin 2.1.0 → 2.2.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 +25 -1
- data/config/locales/ar.yml +3 -2
- data/config/locales/bg.yml +1 -0
- data/config/locales/bs.yml +1 -0
- data/config/locales/ca.yml +1 -0
- data/config/locales/cs.yml +1 -0
- data/config/locales/da.yml +1 -0
- data/config/locales/de-CH.yml +1 -0
- data/config/locales/de.yml +1 -0
- data/config/locales/el.yml +1 -0
- data/config/locales/en-CA.yml +1 -0
- data/config/locales/en-GB.yml +1 -0
- data/config/locales/en.yml +1 -0
- data/config/locales/eo.yml +1 -0
- data/config/locales/es-MX.yml +1 -0
- data/config/locales/es.yml +1 -0
- data/config/locales/fa.yml +1 -0
- data/config/locales/fi.yml +1 -0
- data/config/locales/fr.yml +2 -1
- data/config/locales/he.yml +1 -0
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +1 -0
- data/config/locales/id.yml +1 -0
- data/config/locales/it.yml +1 -0
- data/config/locales/ja.yml +1 -0
- data/config/locales/ko.yml +1 -0
- data/config/locales/lt.yml +1 -0
- data/config/locales/lv.yml +1 -0
- data/config/locales/mk.yml +134 -0
- data/config/locales/nb.yml +1 -0
- data/config/locales/nl.yml +1 -0
- data/config/locales/pl.yml +1 -0
- data/config/locales/pt-BR.yml +1 -0
- data/config/locales/pt-PT.yml +1 -0
- data/config/locales/ro.yml +1 -0
- data/config/locales/ru.yml +1 -0
- data/config/locales/sk.yml +1 -0
- data/config/locales/sv-SE.yml +1 -0
- data/config/locales/tr.yml +1 -0
- data/config/locales/uk.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-CN.yml +1 -0
- data/config/locales/zh-TW.yml +1 -0
- data/docs/12-arbre-components.md +13 -0
- data/docs/13-authorization-adapter.md +2 -2
- data/lib/active_admin/application.rb +11 -2
- data/lib/active_admin/batch_actions/resource_extension.rb +5 -1
- data/lib/active_admin/controller_action.rb +2 -1
- data/lib/active_admin/csv_builder.rb +3 -1
- data/lib/active_admin/dependency.rb +0 -4
- data/lib/active_admin/error.rb +3 -1
- data/lib/active_admin/filters/active_filter.rb +2 -3
- data/lib/active_admin/page_presenter.rb +2 -1
- data/lib/active_admin/pundit_adapter.rb +7 -3
- data/lib/active_admin/resource.rb +2 -1
- data/lib/active_admin/resource/belongs_to.rb +3 -1
- data/lib/active_admin/router.rb +2 -1
- data/lib/active_admin/scope.rb +7 -3
- data/lib/active_admin/sidebar_section.rb +3 -1
- data/lib/active_admin/version.rb +1 -1
- data/lib/active_admin/view_helpers/breadcrumb_helper.rb +2 -2
- data/lib/active_admin/view_helpers/display_helper.rb +3 -2
- data/lib/active_admin/views/components/status_tag.rb +5 -1
- data/lib/generators/active_admin/resource/templates/admin.rb.erb +38 -37
- data/lib/ransack_ext.rb +2 -2
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e70a90d683c4af1876248495c8c055e9eb21669bac351b42dcdeb175f9003c62
|
4
|
+
data.tar.gz: 9f8029a8686ff5dd00932a248f620b1481c1d493f4d10594dc4549de07d269a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdd5161de2dd77f1a01d4eae59f09c16c2f1aa356142a1add9fa7cfe8516bdff1676ebf98d0162c6ec736d0bdfaaba6a4f86b73664c734ac54b54a82d2808cd0
|
7
|
+
data.tar.gz: 4da12f46a43f27af9d4301520dfd337f31efe340890c8b255a0f11e92015996395d9a1f135a7f8a0f34534de493570ff065bff339b5e621837a06dcaf8985064
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,22 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
-
## 2.
|
5
|
+
## 2.2.0 [☰](https://github.com/activeadmin/activeadmin/compare/v2.1.0..v2.2.0)
|
6
|
+
|
7
|
+
### Enhancements
|
8
|
+
|
9
|
+
#### Minor
|
10
|
+
|
11
|
+
* The `status_tag` component now supports different labels for `false` and `nil` boolean cases through the locale. Both default to display "No" for backwards compatibility. [#5794] by [@javierjulio]
|
12
|
+
* Add Macedonian locale. [#5710] by [@violeta-p]
|
13
|
+
|
14
|
+
### Bug Fixes
|
15
|
+
|
16
|
+
* Fix pundit policy retrieving for static pages when the pundit namespace is :active_admin. [#5777] by [@kwent]
|
17
|
+
* Fix show page title not being properly escaped if title's content included HTML. [#5802] by [@deivid-rodriguez]
|
18
|
+
* Revert [21b6138f] from [#5740] since it actually caused the performance in development to regress. [#5801] by [@deivid-rodriguez]
|
19
|
+
|
20
|
+
## 2.1.0 [☰](https://github.com/activeadmin/activeadmin/compare/v2.0.0..v2.1.0)
|
6
21
|
|
7
22
|
### Bug Fixes
|
8
23
|
|
@@ -355,6 +370,8 @@ Please check [0-6-stable] for previous changes.
|
|
355
370
|
[#5043]: https://github.com/activeadmin/activeadmin/issues/5043
|
356
371
|
[#5198]: https://github.com/activeadmin/activeadmin/issues/5198
|
357
372
|
|
373
|
+
[21b6138f]: https://github.com/activeadmin/activeadmin/pull/5740/commits/21b6138fdcf58cd54c3f1d3f60cb1127b174b40f
|
374
|
+
|
358
375
|
[#3091]: https://github.com/activeadmin/activeadmin/pull/3091
|
359
376
|
[#3435]: https://github.com/activeadmin/activeadmin/pull/3435
|
360
377
|
[#4477]: https://github.com/activeadmin/activeadmin/pull/4477
|
@@ -449,11 +466,16 @@ Please check [0-6-stable] for previous changes.
|
|
449
466
|
[#5650]: https://github.com/activeadmin/activeadmin/pull/5650
|
450
467
|
[#5590]: https://github.com/activeadmin/activeadmin/pull/5590
|
451
468
|
[#5662]: https://github.com/activeadmin/activeadmin/pull/5662
|
469
|
+
[#5710]: https://github.com/activeadmin/activeadmin/pull/5710
|
452
470
|
[#5726]: https://github.com/activeadmin/activeadmin/pull/5726
|
453
471
|
[#5738]: https://github.com/activeadmin/activeadmin/pull/5738
|
454
472
|
[#5740]: https://github.com/activeadmin/activeadmin/pull/5740
|
455
473
|
[#5751]: https://github.com/activeadmin/activeadmin/pull/5751
|
456
474
|
[#5758]: https://github.com/activeadmin/activeadmin/pull/5758
|
475
|
+
[#5777]: https://github.com/activeadmin/activeadmin/pull/5777
|
476
|
+
[#5794]: https://github.com/activeadmin/activeadmin/pull/5794
|
477
|
+
[#5801]: https://github.com/activeadmin/activeadmin/pull/5801
|
478
|
+
[#5802]: https://github.com/activeadmin/activeadmin/pull/5802
|
457
479
|
|
458
480
|
[@5t111111]: https://github.com/5t111111
|
459
481
|
[@aarek]: https://github.com/aarek
|
@@ -490,6 +512,7 @@ Please check [0-6-stable] for previous changes.
|
|
490
512
|
[@johnnyshields]: https://github.com/johnnyshields
|
491
513
|
[@kjeldahl]: https://github.com/kjeldahl
|
492
514
|
[@kobeumut]: https://github.com/kobeumut
|
515
|
+
[@kwent]: https://github.com/kwent
|
493
516
|
[@leio10]: https://github.com/leio10
|
494
517
|
[@markstory]: https://github.com/markstory
|
495
518
|
[@mauriciopasquier]: https://github.com/mauriciopasquier
|
@@ -520,3 +543,4 @@ Please check [0-6-stable] for previous changes.
|
|
520
543
|
[@bartoszkopinski]: https://github.com/bartoszkopinski
|
521
544
|
[@panasyuk]: https://github.com/panasyuk
|
522
545
|
[@jscheid]: https://github.com/jscheid
|
546
|
+
[@violeta-p]: https://github.com/violeta-p
|
data/config/locales/ar.yml
CHANGED
@@ -37,8 +37,9 @@ ar:
|
|
37
37
|
current_filters: "المُرشحات الحاليّة:"
|
38
38
|
no_current_filters: "بدون"
|
39
39
|
status_tag:
|
40
|
-
|
41
|
-
|
40
|
+
"yes": "نعم"
|
41
|
+
"no": "لا"
|
42
|
+
"unset": "لا"
|
42
43
|
main_content: "الرجاء تنفيذ %{model}#main_content لعرض المحتوى."
|
43
44
|
logout: "تسجيل الخروج"
|
44
45
|
powered_by: "تنفيذ %{active_admin} %{version}"
|
data/config/locales/bg.yml
CHANGED
data/config/locales/bs.yml
CHANGED
data/config/locales/ca.yml
CHANGED
data/config/locales/cs.yml
CHANGED
data/config/locales/da.yml
CHANGED
data/config/locales/de-CH.yml
CHANGED
data/config/locales/de.yml
CHANGED
data/config/locales/el.yml
CHANGED
data/config/locales/en-CA.yml
CHANGED
data/config/locales/en-GB.yml
CHANGED
data/config/locales/en.yml
CHANGED
data/config/locales/eo.yml
CHANGED
data/config/locales/es-MX.yml
CHANGED
data/config/locales/es.yml
CHANGED
data/config/locales/fa.yml
CHANGED
data/config/locales/fi.yml
CHANGED
data/config/locales/fr.yml
CHANGED
@@ -18,7 +18,7 @@ fr:
|
|
18
18
|
previous: "Précédent"
|
19
19
|
next: "Suivant"
|
20
20
|
download: "Télécharger :"
|
21
|
-
has_many_new: "Ajouter un
|
21
|
+
has_many_new: "Ajouter un(e) %{model}"
|
22
22
|
has_many_delete: "Supprimer"
|
23
23
|
has_many_remove: "Enlever"
|
24
24
|
filters:
|
@@ -44,6 +44,7 @@ fr:
|
|
44
44
|
status_tag:
|
45
45
|
"yes": "Oui"
|
46
46
|
"no": "Non"
|
47
|
+
"unset": "Non"
|
47
48
|
main_content: "Veuillez implémenter %{model}#main_content pour afficher le contenu."
|
48
49
|
logout: "Déconnexion"
|
49
50
|
powered_by: "Propulsé par %{active_admin} %{version}"
|
data/config/locales/he.yml
CHANGED
data/config/locales/hr.yml
CHANGED
data/config/locales/hu.yml
CHANGED
data/config/locales/id.yml
CHANGED
data/config/locales/it.yml
CHANGED
data/config/locales/ja.yml
CHANGED
data/config/locales/ko.yml
CHANGED
data/config/locales/lt.yml
CHANGED
data/config/locales/lv.yml
CHANGED
@@ -0,0 +1,134 @@
|
|
1
|
+
mk:
|
2
|
+
activerecord:
|
3
|
+
models:
|
4
|
+
comment:
|
5
|
+
one: "Коментар"
|
6
|
+
other: "Коментари"
|
7
|
+
active_admin/comment:
|
8
|
+
one: "Коментар"
|
9
|
+
other: "Коментари"
|
10
|
+
active_admin:
|
11
|
+
dashboard: "Почетна"
|
12
|
+
dashboard_welcome:
|
13
|
+
welcome: "Добредојдовте во Active Admin. Ова е стандардна верзија на почетната страна."
|
14
|
+
call_to_action: "За да додадете секции на почетната страна, прегледајте го 'app/admin/dashboard.rb'."
|
15
|
+
view: "Прегледај"
|
16
|
+
edit: "Измени"
|
17
|
+
delete: "Избриши"
|
18
|
+
delete_confirmation: "Дали сте сигурни дека сакате да го избришете записот?"
|
19
|
+
create_another: "Креирај нов %{model}"
|
20
|
+
new_model: "Додај нов %{model}"
|
21
|
+
edit_model: "Измени %{model}"
|
22
|
+
delete_model: "Избриши %{model}"
|
23
|
+
details: "Детали за %{model}"
|
24
|
+
cancel: "Откажи"
|
25
|
+
empty: "Празно"
|
26
|
+
previous: "Претходно"
|
27
|
+
next: "Следно"
|
28
|
+
download: "Преземи во понудените формати:"
|
29
|
+
has_many_new: "Додај нов %{model}"
|
30
|
+
has_many_delete: "Избриши"
|
31
|
+
has_many_remove: "Отстрани"
|
32
|
+
move: "Премести"
|
33
|
+
filters:
|
34
|
+
buttons:
|
35
|
+
filter: "Пребарај"
|
36
|
+
clear: "Исчисти филтри"
|
37
|
+
predicates:
|
38
|
+
contains: "Содржи"
|
39
|
+
equals: "Е еднакво со"
|
40
|
+
starts_with: "Започнува со"
|
41
|
+
ends_with: "Завршува сo"
|
42
|
+
greater_than: "Е поголемо од"
|
43
|
+
less_than: "Е помало од"
|
44
|
+
gteq_datetime: "Е поголемо или еднакво со"
|
45
|
+
lteq_datetime: "Е помало или еднакво со"
|
46
|
+
from: "Од"
|
47
|
+
to: "До"
|
48
|
+
search_status:
|
49
|
+
headline: "Пронајдени резултати:"
|
50
|
+
current_filters: "Резултати врз основа на следниве филтри:"
|
51
|
+
no_current_filters: "Моментално нема филтри"
|
52
|
+
status_tag:
|
53
|
+
"yes": "Да"
|
54
|
+
"no": "Не"
|
55
|
+
"unset": "Не"
|
56
|
+
main_content: "Ве замолуваме имплементирајте %{model}#main_content за да прикажете содржина."
|
57
|
+
logout: "Одјави се"
|
58
|
+
powered_by: "Овозможено од %{active_admin} %{version}"
|
59
|
+
sidebars:
|
60
|
+
filters: "Филтри за пребарување"
|
61
|
+
search_status: "Резултати од пребарување"
|
62
|
+
pagination:
|
63
|
+
empty: "Нема пронајдени записи за %{model}"
|
64
|
+
one: "Прикажан <b>1</b> %{model}"
|
65
|
+
one_page: "Прикажани <b>сите %{n}</b> %{model}"
|
66
|
+
multiple: "Прикажани %{model} <b>%{from} - %{to}</b> од вкупно <b>%{total}</b>"
|
67
|
+
multiple_without_total: "Прикажани %{model} <b>%{from} - %{to}</b>"
|
68
|
+
per_page: "Прикази на записи по страна:"
|
69
|
+
entry:
|
70
|
+
one: "запис"
|
71
|
+
other: "записи"
|
72
|
+
any: "Било кој"
|
73
|
+
blank_slate:
|
74
|
+
content: "Не се креирани записи од типот на %{resource_name}."
|
75
|
+
link: "Креирај нов"
|
76
|
+
dropdown_actions:
|
77
|
+
button_label: "Активности"
|
78
|
+
batch_actions:
|
79
|
+
button_label: "Групни активности"
|
80
|
+
default_confirmation: "Дали сте сигурни?"
|
81
|
+
delete_confirmation: "Дали сте сигурни дека сакате да ги избришете %{plural_model}?"
|
82
|
+
succesfully_destroyed:
|
83
|
+
one: "Успешно е избришан 1 %{model}"
|
84
|
+
other: "Успешно се избришани %{count} %{plural_model}"
|
85
|
+
selection_toggle_explanation: "(Toggle Selection)"
|
86
|
+
action_label: "%{title} го селектираното"
|
87
|
+
labels:
|
88
|
+
destroy: "Избриши"
|
89
|
+
devise:
|
90
|
+
username:
|
91
|
+
title: "Корисничко име"
|
92
|
+
email:
|
93
|
+
title: "Е-маил"
|
94
|
+
password:
|
95
|
+
title: "Лозинка"
|
96
|
+
password_confirmation:
|
97
|
+
title: "Потврди Лозинка"
|
98
|
+
sign_up:
|
99
|
+
title: "Креирај профил"
|
100
|
+
submit: "Креирај"
|
101
|
+
login:
|
102
|
+
title: "Најави се"
|
103
|
+
remember_me: "Запомни ме"
|
104
|
+
submit: "Најави се"
|
105
|
+
reset_password:
|
106
|
+
title: "Ја заборавивте Вашата лозинка?"
|
107
|
+
submit: "Промени лозинка"
|
108
|
+
change_password:
|
109
|
+
title: "Променете ја лозинката"
|
110
|
+
submit: "Промени лозинка"
|
111
|
+
unlock:
|
112
|
+
title: "Повторно испраќање на инструкции за отклучување на профил"
|
113
|
+
submit: "Испрати инструкции"
|
114
|
+
resend_confirmation_instructions:
|
115
|
+
title: "Повторно испраќање на инструкции за потврдување на профил"
|
116
|
+
submit: "Инспрати инструкции"
|
117
|
+
links:
|
118
|
+
sign_up: "Креирај профил"
|
119
|
+
sign_in: "Најави се"
|
120
|
+
forgot_your_password: "Ја заборавивте Вашата лозинка?"
|
121
|
+
sign_in_with_omniauth_provider: "Најави се со %{provider}"
|
122
|
+
resend_unlock_instructions: "Повторно испрати инструкции за отклучување на профил"
|
123
|
+
resend_confirmation_instructions: "Повторно испрати инструкции за потврдување на профил"
|
124
|
+
unsupported_browser:
|
125
|
+
headline: "Ве замолуваме, имајте во предвид дека ActiveAdmin не нуди поддршка за Internet Explorer 8 верзијата или претходни верзии."
|
126
|
+
recommendation: "Ви порачуваме да го <a href=\"http://browsehappy.com/\"> ажурирате Вашиот пребарувач</a> за да си го подобрите пребарувањето."
|
127
|
+
turn_off_compatibility_view: "Доколку користите IE 9 или понова верзија, Ве замолуваме <a href=\"https://support.microsoft.com/en-us/help/17471\">да исклучите \"Compatibility View\"</a>."
|
128
|
+
access_denied:
|
129
|
+
message: "Немате овластување да ја извршите оваа активност."
|
130
|
+
index_list:
|
131
|
+
table: "Табела"
|
132
|
+
block: "Листа"
|
133
|
+
grid: "Грид"
|
134
|
+
blog: "Блог"
|
data/config/locales/nb.yml
CHANGED
data/config/locales/nl.yml
CHANGED
data/config/locales/pl.yml
CHANGED
data/config/locales/pt-BR.yml
CHANGED
data/config/locales/pt-PT.yml
CHANGED
data/config/locales/ro.yml
CHANGED
data/config/locales/ru.yml
CHANGED
data/config/locales/sk.yml
CHANGED
data/config/locales/sv-SE.yml
CHANGED
data/config/locales/tr.yml
CHANGED
data/config/locales/uk.yml
CHANGED
data/config/locales/vi.yml
CHANGED
data/config/locales/zh-CN.yml
CHANGED
data/config/locales/zh-TW.yml
CHANGED
data/docs/12-arbre-components.md
CHANGED
@@ -177,6 +177,19 @@ status_tag 'active', class: 'important', id: 'status_123', label: 'on'
|
|
177
177
|
# => <span class='status_tag active important' id='status_123'>on</span>
|
178
178
|
```
|
179
179
|
|
180
|
+
When providing a `true` or `false` value, the `status_tag` will display "Yes"
|
181
|
+
or "No". This can be configured through the `"en.active_admin.status_tag"`
|
182
|
+
locale.
|
183
|
+
|
184
|
+
```ruby
|
185
|
+
status_tag true
|
186
|
+
# => <span class='status_tag yes'>Yes</span>
|
187
|
+
```
|
188
|
+
|
189
|
+
In the case that a boolean field is `nil`, it will display "No" as a default.
|
190
|
+
But using the `"en.active_admin.status_tag.unset"` locale key, it can be
|
191
|
+
configured to display something else.
|
192
|
+
|
180
193
|
## Tabs
|
181
194
|
|
182
195
|
The Tabs component is helpful for saving page real estate. The first tab will be
|
@@ -244,7 +244,7 @@ To view more details about the API's, visit project pages of
|
|
244
244
|
## Using the Pundit Adapter
|
245
245
|
|
246
246
|
Active Admin also provides an adapter out of the box for
|
247
|
-
[Pundit](https://github.com/
|
247
|
+
[Pundit](https://github.com/varvet/pundit).
|
248
248
|
|
249
249
|
To use the Pundit adapter, update the configuration in the Active Admin
|
250
250
|
initializer:
|
@@ -255,7 +255,7 @@ config.authorization_adapter = ActiveAdmin::PunditAdapter
|
|
255
255
|
|
256
256
|
Once that's done, Active Admin will pick up your Pundit policies, and use
|
257
257
|
them for authorization. For more information about setting up Pundit, see
|
258
|
-
[their
|
258
|
+
[their documentation](https://github.com/varvet/pundit#installation).
|
259
259
|
|
260
260
|
Pundit also has [verify_authorized and/or verify_policy_scoped
|
261
261
|
methods](https://github.com/varvet/pundit#ensuring-policies-and-scopes-are-used)
|
@@ -187,8 +187,17 @@ module ActiveAdmin
|
|
187
187
|
# regenerate the routes as well.
|
188
188
|
def attach_reloader
|
189
189
|
Rails.application.config.after_initialize do |app|
|
190
|
-
|
191
|
-
|
190
|
+
unload_active_admin = -> { ActiveAdmin.application.unload! }
|
191
|
+
|
192
|
+
if app.config.reload_classes_only_on_change
|
193
|
+
# Rails is about to unload all the app files (e.g. models), so we
|
194
|
+
# should first unload the classes generated by Active Admin, otherwise
|
195
|
+
# they will contain references to the stale (unloaded) classes.
|
196
|
+
ActiveSupport::Reloader.to_prepare(prepend: true, &unload_active_admin)
|
197
|
+
else
|
198
|
+
# If the user has configured the app to always reload app files after
|
199
|
+
# each request, so we should unload the generated classes too.
|
200
|
+
ActiveSupport::Reloader.to_complete(&unload_active_admin)
|
192
201
|
end
|
193
202
|
|
194
203
|
admin_dirs = {}
|
@@ -112,7 +112,11 @@ module ActiveAdmin
|
|
112
112
|
# => You can pass a hash of options to `:form` that will be rendered as form input fields for the user to fill out.
|
113
113
|
#
|
114
114
|
def initialize(sym, title, options = {}, &block)
|
115
|
-
@sym
|
115
|
+
@sym = sym
|
116
|
+
@title = title
|
117
|
+
@options = options
|
118
|
+
@block = block
|
119
|
+
@confirm = options[:confirm]
|
116
120
|
@block ||= proc {}
|
117
121
|
end
|
118
122
|
|
@@ -32,7 +32,9 @@ module ActiveAdmin
|
|
32
32
|
|
33
33
|
def initialize(options = {}, &block)
|
34
34
|
@resource = options.delete(:resource)
|
35
|
-
@columns
|
35
|
+
@columns = []
|
36
|
+
@options = options
|
37
|
+
@block = block
|
36
38
|
end
|
37
39
|
|
38
40
|
def column(name, options = {}, &block)
|
data/lib/active_admin/error.rb
CHANGED
@@ -26,8 +26,7 @@ module ActiveAdmin
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def label
|
29
|
-
|
30
|
-
translated_predicate = predicate_name.mb_chars.downcase.to_s
|
29
|
+
translated_predicate = predicate_name.downcase
|
31
30
|
if filter_label && filter_label.is_a?(Proc)
|
32
31
|
"#{filter_label.call} #{translated_predicate}"
|
33
32
|
elsif filter_label
|
@@ -67,7 +66,7 @@ module ActiveAdmin
|
|
67
66
|
def filter_label
|
68
67
|
return unless filter
|
69
68
|
|
70
|
-
filter[:label]
|
69
|
+
filter[:label] || I18n.t(name, scope: ['formtastic', 'labels'], default: nil)
|
71
70
|
end
|
72
71
|
|
73
72
|
#@return Ransack::Nodes::Attribute
|
@@ -44,7 +44,7 @@ module ActiveAdmin
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def format_action(action, subject)
|
47
|
-
# https://github.com/
|
47
|
+
# https://github.com/varvet/pundit/blob/master/lib/generators/pundit/install/templates/application_policy.rb
|
48
48
|
case action
|
49
49
|
when Auth::CREATE then :create?
|
50
50
|
when Auth::UPDATE then :update?
|
@@ -57,8 +57,8 @@ module ActiveAdmin
|
|
57
57
|
private
|
58
58
|
|
59
59
|
def namespace(object)
|
60
|
-
if
|
61
|
-
[
|
60
|
+
if default_policy_namespace && !object.class.to_s.include?(default_policy_namespace.to_s.camelize)
|
61
|
+
[default_policy_namespace.to_sym, object]
|
62
62
|
else
|
63
63
|
object
|
64
64
|
end
|
@@ -72,6 +72,10 @@ module ActiveAdmin
|
|
72
72
|
default_policy_class.new(user, subject)
|
73
73
|
end
|
74
74
|
|
75
|
+
def default_policy_namespace
|
76
|
+
ActiveAdmin.application.pundit_policy_namespace
|
77
|
+
end
|
78
|
+
|
75
79
|
end
|
76
80
|
|
77
81
|
end
|
@@ -15,7 +15,9 @@ module ActiveAdmin
|
|
15
15
|
attr_reader :owner
|
16
16
|
|
17
17
|
def initialize(owner, target_name, options = {})
|
18
|
-
@owner
|
18
|
+
@owner = owner
|
19
|
+
@target_name = target_name
|
20
|
+
@options = options
|
19
21
|
end
|
20
22
|
|
21
23
|
# Returns the target resource class or raises an exception if it doesn't exist
|
data/lib/active_admin/router.rb
CHANGED
data/lib/active_admin/scope.rb
CHANGED
@@ -28,7 +28,8 @@ module ActiveAdmin
|
|
28
28
|
# # => Scope with the group :status
|
29
29
|
#
|
30
30
|
def initialize(name, method = nil, options = {}, &block)
|
31
|
-
@name
|
31
|
+
@name = name
|
32
|
+
@scope_method = method.try(:to_sym)
|
32
33
|
|
33
34
|
if name.is_a? Proc
|
34
35
|
raise "A string/symbol is required as the second argument if your label is a proc." unless method
|
@@ -38,8 +39,11 @@ module ActiveAdmin
|
|
38
39
|
@id = name.to_s.parameterize(separator: "_")
|
39
40
|
end
|
40
41
|
|
41
|
-
@scope_method
|
42
|
-
|
42
|
+
@scope_method = nil if @scope_method == :all
|
43
|
+
if block_given?
|
44
|
+
@scope_method = nil
|
45
|
+
@scope_block = block
|
46
|
+
end
|
43
47
|
|
44
48
|
@localizer = options[:localizer]
|
45
49
|
@show_count = options.fetch(:show_count, true)
|
data/lib/active_admin/version.rb
CHANGED
@@ -12,9 +12,9 @@ module ActiveAdmin
|
|
12
12
|
# 1. try using `display_name` if we can locate a DB object
|
13
13
|
# 2. try using the model name translation
|
14
14
|
# 3. default to calling `titlecase` on the URL fragment
|
15
|
-
if part =~ /\A(\d+|[a-f0-9]{24}|(?:[a-f0-9]{8}-(?:[a-f0-9]{4}-){3}[a-f0-9]{12}))\z/ && parts[index-1]
|
15
|
+
if part =~ /\A(\d+|[a-f0-9]{24}|(?:[a-f0-9]{8}-(?:[a-f0-9]{4}-){3}[a-f0-9]{12}))\z/ && parts[index - 1]
|
16
16
|
parent = active_admin_config.belongs_to_config.try :target
|
17
|
-
config = parent && parent.resource_name.route_key == parts[index-1] ? parent : active_admin_config
|
17
|
+
config = parent && parent.resource_name.route_key == parts[index - 1] ? parent : active_admin_config
|
18
18
|
name = display_name config.find_resource part
|
19
19
|
end
|
20
20
|
name ||= I18n.t "activerecord.models.#{part.singularize}", count: ::ActiveAdmin::Helpers::I18n::PLURAL_MANY_COUNT, default: part.titlecase
|
@@ -3,7 +3,8 @@ module ActiveAdmin
|
|
3
3
|
module DisplayHelper
|
4
4
|
|
5
5
|
DISPLAY_NAME_FALLBACK = -> {
|
6
|
-
name
|
6
|
+
name = ""
|
7
|
+
klass = self.class
|
7
8
|
name << klass.model_name.human if klass.respond_to? :model_name
|
8
9
|
name << " ##{send(klass.primary_key)}" if klass.respond_to? :primary_key
|
9
10
|
name.present? ? name : to_s
|
@@ -15,7 +16,7 @@ module ActiveAdmin
|
|
15
16
|
# Attempts to call any known display name methods on the resource.
|
16
17
|
# See the setting in `application.rb` for the list of methods and their priority.
|
17
18
|
def display_name(resource)
|
18
|
-
|
19
|
+
ERB::Util.html_escape(render_in_context(resource, display_name_method_for(resource))) unless resource.nil?
|
19
20
|
end
|
20
21
|
|
21
22
|
# Looks up and caches the first available display name method.
|
@@ -51,8 +51,10 @@ module ActiveAdmin
|
|
51
51
|
case status
|
52
52
|
when true, 'true'
|
53
53
|
'Yes'
|
54
|
-
when false, 'false'
|
54
|
+
when false, 'false'
|
55
55
|
'No'
|
56
|
+
when nil
|
57
|
+
'Unset'
|
56
58
|
else
|
57
59
|
status
|
58
60
|
end
|
@@ -60,6 +62,8 @@ module ActiveAdmin
|
|
60
62
|
|
61
63
|
def status_to_class(status)
|
62
64
|
case status
|
65
|
+
when 'Unset'
|
66
|
+
'unset no'
|
63
67
|
when String, Symbol
|
64
68
|
status.to_s.titleize.gsub(/\s/, '').underscore
|
65
69
|
else
|
@@ -1,43 +1,44 @@
|
|
1
1
|
ActiveAdmin.register <%= class_name %> do
|
2
|
-
# See permitted parameters documentation:
|
3
|
-
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
|
4
|
-
#
|
5
|
-
# permit_params :list, :of, :attributes, :on, :model
|
6
|
-
#
|
7
|
-
# or
|
8
|
-
#
|
9
|
-
# permit_params do
|
10
|
-
# permitted = [:permitted, :attributes]
|
11
|
-
# permitted << :other if params[:action] == 'create' && current_user.admin?
|
12
|
-
# permitted
|
13
|
-
# end
|
14
|
-
<% if options.include_boilerplate? %>
|
15
|
-
# Limit actions available to your users by adding them to the 'except' array
|
16
|
-
# actions :all, except: []
|
17
2
|
|
18
|
-
#
|
19
|
-
#
|
20
|
-
|
3
|
+
# See permitted parameters documentation:
|
4
|
+
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
|
5
|
+
#
|
6
|
+
# permit_params :list, :of, :attributes, :on, :model
|
7
|
+
#
|
8
|
+
# or
|
9
|
+
#
|
10
|
+
# permit_params do
|
11
|
+
# permitted = [:permitted, :attributes]
|
12
|
+
# permitted << :other if params[:action] == 'create' && current_user.admin?
|
13
|
+
# permitted
|
14
|
+
# end
|
15
|
+
<% if options.include_boilerplate? %>
|
16
|
+
# Limit actions available to your users by adding them to the 'except' array
|
17
|
+
# actions :all, except: []
|
21
18
|
|
22
|
-
# Add or remove
|
23
|
-
#
|
24
|
-
|
25
|
-
# id_column
|
26
|
-
<%= @boilerplate.columns %>
|
27
|
-
# actions
|
28
|
-
# end
|
19
|
+
# Add or remove filters (you can use any ActiveRecord scope) to toggle their
|
20
|
+
# visibility in the sidebar
|
21
|
+
<%= @boilerplate.filters %>
|
29
22
|
|
30
|
-
# Add or remove
|
31
|
-
#
|
32
|
-
|
33
|
-
#
|
23
|
+
# Add or remove columns to toggle their visiblity in the index action
|
24
|
+
# index do
|
25
|
+
# selectable_column
|
26
|
+
# id_column
|
27
|
+
<%= @boilerplate.columns %>
|
28
|
+
# actions
|
29
|
+
# end
|
34
30
|
|
35
|
-
# Add or remove
|
36
|
-
#
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
#
|
41
|
-
#
|
42
|
-
|
31
|
+
# Add or remove rows to toggle their visiblity in the show action
|
32
|
+
# show do |<%= class_name.downcase %>|
|
33
|
+
<%= @boilerplate.rows %>
|
34
|
+
# end
|
35
|
+
|
36
|
+
# Add or remove fields to toggle their visibility in the form
|
37
|
+
# form do |f|
|
38
|
+
# f.inputs do
|
39
|
+
<%= @boilerplate.form_inputs %>
|
40
|
+
# end
|
41
|
+
# f.actions
|
42
|
+
# end
|
43
|
+
<% end %>
|
43
44
|
end
|
data/lib/ransack_ext.rb
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# identically to the versions given in Ransack.
|
3
3
|
#
|
4
4
|
Ransack.configure do |config|
|
5
|
-
{ 'contains'=>'cont', 'starts_with'=>'start', 'ends_with'=>'end' }.each do |old, current|
|
5
|
+
{ 'contains' => 'cont', 'starts_with' => 'start', 'ends_with' => 'end' }.each do |old, current|
|
6
6
|
config.add_predicate old, Ransack::Constants::DERIVED_PREDICATES.detect { |q, _| q == current }[1]
|
7
7
|
end
|
8
8
|
|
9
|
-
{ 'equals'=>'eq', 'greater_than'=>'gt', 'less_than'=>'lt' }.each do |old, current|
|
9
|
+
{ 'equals' => 'eq', 'greater_than' => 'gt', 'less_than' => 'lt' }.each do |old, current|
|
10
10
|
config.add_predicate old, arel_predicate: current
|
11
11
|
end
|
12
12
|
|
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.2.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-07-15 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: arbre
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
version: '5.0'
|
123
123
|
- - "<"
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: '6.
|
125
|
+
version: '6.1'
|
126
126
|
type: :runtime
|
127
127
|
prerelease: false
|
128
128
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -132,7 +132,7 @@ dependencies:
|
|
132
132
|
version: '5.0'
|
133
133
|
- - "<"
|
134
134
|
- !ruby/object:Gem::Version
|
135
|
-
version: '6.
|
135
|
+
version: '6.1'
|
136
136
|
- !ruby/object:Gem::Dependency
|
137
137
|
name: ransack
|
138
138
|
requirement: !ruby/object:Gem::Requirement
|
@@ -331,6 +331,7 @@ files:
|
|
331
331
|
- config/locales/ko.yml
|
332
332
|
- config/locales/lt.yml
|
333
333
|
- config/locales/lv.yml
|
334
|
+
- config/locales/mk.yml
|
334
335
|
- config/locales/nb.yml
|
335
336
|
- config/locales/nl.yml
|
336
337
|
- config/locales/pl.yml
|
@@ -606,7 +607,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
606
607
|
- !ruby/object:Gem::Version
|
607
608
|
version: '0'
|
608
609
|
requirements: []
|
609
|
-
rubygems_version: 3.0.
|
610
|
+
rubygems_version: 3.0.4
|
610
611
|
signing_key:
|
611
612
|
specification_version: 4
|
612
613
|
summary: Active Admin is a Ruby on Rails plugin for generating administration style
|