activeadmin 2.7.0 → 2.8.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 +54 -8
- data/CONTRIBUTING.md +1 -17
- data/app/assets/javascripts/active_admin/base.js +13 -15
- data/app/assets/stylesheets/active_admin/components/_comments.scss +2 -2
- data/app/javascript/active_admin/initializers/per-page.js +1 -1
- data/app/javascript/active_admin/lib/checkbox-toggler.js +3 -3
- data/app/javascript/active_admin/lib/dropdown-menu.js +1 -1
- data/app/javascript/active_admin/lib/modal-dialog.js +7 -7
- data/app/javascript/active_admin/lib/per-page.js +1 -1
- data/app/javascript/active_admin/lib/table-checkbox-toggler.js +1 -1
- data/app/views/layouts/active_admin_logged_out.html.erb +2 -2
- data/config/locales/ar.yml +6 -6
- data/config/locales/es-MX.yml +2 -1
- data/config/locales/es.yml +2 -2
- data/config/locales/it.yml +18 -0
- data/config/locales/ja.yml +3 -3
- data/docs/11-decorators.md +16 -5
- data/docs/Gemfile.lock +36 -26
- data/lib/active_admin.rb +43 -43
- data/lib/active_admin/application.rb +6 -6
- data/lib/active_admin/authorization_adapter.rb +3 -3
- data/lib/active_admin/base_controller/authorization.rb +9 -9
- data/lib/active_admin/batch_actions/controller.rb +3 -3
- data/lib/active_admin/batch_actions/views/batch_action_form.rb +1 -1
- data/lib/active_admin/batch_actions/views/batch_action_selector.rb +5 -5
- data/lib/active_admin/collection_decorator.rb +31 -0
- data/lib/active_admin/csv_builder.rb +4 -4
- data/lib/active_admin/dependency.rb +7 -7
- data/lib/active_admin/filters.rb +1 -1
- data/lib/active_admin/filters/forms.rb +3 -3
- data/lib/active_admin/filters/resource_extension.rb +1 -1
- data/lib/active_admin/form_builder.rb +5 -5
- data/lib/active_admin/helpers/optional_display.rb +2 -2
- data/lib/active_admin/inputs/filters/base/search_method_select.rb +2 -2
- data/lib/active_admin/menu_item.rb +7 -7
- data/lib/active_admin/namespace.rb +7 -7
- data/lib/active_admin/orm/active_record/comments.rb +11 -11
- data/lib/active_admin/orm/active_record/comments/comment.rb +3 -3
- data/lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb +3 -3
- data/lib/active_admin/pundit_adapter.rb +4 -4
- data/lib/active_admin/resource/action_items.rb +1 -1
- data/lib/active_admin/resource/menu.rb +4 -4
- data/lib/active_admin/resource/naming.rb +3 -3
- data/lib/active_admin/resource/routes.rb +5 -5
- data/lib/active_admin/resource/scope_to.rb +7 -7
- data/lib/active_admin/resource_controller.rb +4 -3
- data/lib/active_admin/resource_controller/data_access.rb +1 -1
- data/lib/active_admin/resource_controller/decorators.rb +5 -25
- data/lib/active_admin/resource_dsl.rb +5 -5
- data/lib/active_admin/scope.rb +5 -5
- data/lib/active_admin/version.rb +1 -1
- data/lib/active_admin/view_factory.rb +16 -16
- data/lib/active_admin/view_helpers/breadcrumb_helper.rb +1 -1
- data/lib/active_admin/view_helpers/display_helper.rb +3 -3
- data/lib/active_admin/view_helpers/fields_for.rb +1 -1
- data/lib/active_admin/views/components/attributes_table.rb +2 -2
- data/lib/active_admin/views/components/dropdown_menu.rb +2 -2
- data/lib/active_admin/views/components/index_list.rb +1 -1
- data/lib/active_admin/views/components/menu_item.rb +1 -1
- data/lib/active_admin/views/components/paginated_collection.rb +14 -14
- data/lib/active_admin/views/components/table_for.rb +10 -10
- data/lib/active_admin/views/components/tabs.rb +1 -1
- data/lib/active_admin/views/index_as_table.rb +6 -6
- data/lib/active_admin/views/pages/base.rb +1 -1
- data/lib/active_admin/views/pages/index.rb +8 -8
- data/lib/generators/active_admin/assets/templates/active_admin.scss +2 -2
- data/lib/generators/active_admin/devise/devise_generator.rb +4 -4
- data/lib/generators/active_admin/install/templates/active_admin.rb.erb +2 -2
- data/lib/generators/active_admin/resource/resource_generator.rb +1 -1
- data/lib/generators/active_admin/webpacker/templates/active_admin.scss +2 -2
- metadata +15 -8
data/config/locales/es-MX.yml
CHANGED
@@ -86,7 +86,8 @@ es-MX:
|
|
86
86
|
title: "Cambie su contraseña"
|
87
87
|
submit: "Cambiar mi contraseña"
|
88
88
|
links:
|
89
|
-
sign_in: "
|
89
|
+
sign_in: "Iniciar Sesión"
|
90
|
+
sign_up: "Registrarse"
|
90
91
|
forgot_your_password: "¿Olvidó su contraseña?"
|
91
92
|
sign_in_with_omniauth_provider: "Conéctate con %{provider}"
|
92
93
|
index_list:
|
data/config/locales/es.yml
CHANGED
@@ -143,8 +143,8 @@ es:
|
|
143
143
|
title: "Reenviar instrucciones de confirmación"
|
144
144
|
submit: "Reenviar instrucciones de confirmación"
|
145
145
|
links:
|
146
|
-
sign_up: "
|
147
|
-
sign_in: "
|
146
|
+
sign_up: "Registrarse"
|
147
|
+
sign_in: "Iniciar Sesión"
|
148
148
|
forgot_your_password: "¿Olvidó su contraseña?"
|
149
149
|
sign_in_with_omniauth_provider: "Conéctate con %{provider}"
|
150
150
|
resend_unlock_instructions: "Reenviar instrucciones de desbloqueo"
|
data/config/locales/it.yml
CHANGED
@@ -1,4 +1,20 @@
|
|
1
1
|
it:
|
2
|
+
activerecord:
|
3
|
+
models:
|
4
|
+
comment:
|
5
|
+
one: "Commento"
|
6
|
+
other: "Commenti"
|
7
|
+
active_admin/comment:
|
8
|
+
one: "Commento"
|
9
|
+
other: "Commenti"
|
10
|
+
attributes:
|
11
|
+
active_admin/comment:
|
12
|
+
author_type: "Tipo di Autore"
|
13
|
+
body: "Corpo"
|
14
|
+
created_at: "Creato il"
|
15
|
+
namespace: "Namespace"
|
16
|
+
resource_type: "Tipo di risorsa"
|
17
|
+
updated_at: "Aggiornato il"
|
2
18
|
active_admin:
|
3
19
|
dashboard: Dashboard
|
4
20
|
dashboard_welcome:
|
@@ -37,6 +53,8 @@ it:
|
|
37
53
|
lteq_datetime: "Minore o uguale a"
|
38
54
|
from: "Da"
|
39
55
|
to: "A"
|
56
|
+
scopes:
|
57
|
+
all: "Tutti"
|
40
58
|
search_status:
|
41
59
|
headline: "Situazione filtri:"
|
42
60
|
current_scope: "Contesto selezionato:"
|
data/config/locales/ja.yml
CHANGED
@@ -8,7 +8,7 @@ ja:
|
|
8
8
|
edit: "編集"
|
9
9
|
delete: "削除"
|
10
10
|
delete_confirmation: "本当に削除しますか?"
|
11
|
-
create_another: "%{model}
|
11
|
+
create_another: "%{model} を続けて作成する"
|
12
12
|
new_model: "%{model} を作成する"
|
13
13
|
edit_model: "%{model} を編集する"
|
14
14
|
delete_model: "%{model} を削除する"
|
@@ -18,7 +18,7 @@ ja:
|
|
18
18
|
previous: "前"
|
19
19
|
next: "次"
|
20
20
|
download: "ダウンロード:"
|
21
|
-
has_many_new: "
|
21
|
+
has_many_new: "%{model} を追加する"
|
22
22
|
has_many_delete: "削除する"
|
23
23
|
has_many_remove: "削除する"
|
24
24
|
filters:
|
@@ -26,7 +26,7 @@ ja:
|
|
26
26
|
filter: "絞り込む"
|
27
27
|
clear: "条件を削除する"
|
28
28
|
predicates:
|
29
|
-
contains: "
|
29
|
+
contains: "を含む"
|
30
30
|
equals: "等しい"
|
31
31
|
starts_with: "で始まる"
|
32
32
|
ends_with: "で終わる"
|
data/docs/11-decorators.md
CHANGED
@@ -8,11 +8,6 @@ Active Admin allows you to use the decorator pattern to provide view-specific
|
|
8
8
|
versions of a resource. [Draper](https://github.com/drapergem/draper) is
|
9
9
|
recommended but not required.
|
10
10
|
|
11
|
-
To use decorator support without Draper, your decorator must support a variety
|
12
|
-
of collection methods to support pagination, filtering, etc. See
|
13
|
-
[this github issue discussion](https://github.com/activeadmin/activeadmin/issues/3600)
|
14
|
-
and [this gem](https://github.com/kiote/activeadmin-poro-decorator) for more details.
|
15
|
-
|
16
11
|
## Example usage
|
17
12
|
|
18
13
|
```ruby
|
@@ -42,6 +37,22 @@ ActiveAdmin.register Post do
|
|
42
37
|
end
|
43
38
|
```
|
44
39
|
|
40
|
+
You can pass any decorator class as an argument to `decorate_with`
|
41
|
+
as long as it accepts the record to be decorated as a parameter in
|
42
|
+
the initializer, and responds to all the necessary methods.
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
# app/decorators/post_decorator.rb
|
46
|
+
class PostDecorator
|
47
|
+
attr_reader :post
|
48
|
+
delegate_missing_to :post
|
49
|
+
|
50
|
+
def initialize(post)
|
51
|
+
@post = post
|
52
|
+
end
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
45
56
|
## Forms
|
46
57
|
|
47
58
|
By default, ActiveAdmin does *not* decorate the resource used to render forms.
|
data/docs/Gemfile.lock
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (6.0.2
|
4
|
+
activesupport (6.0.3.2)
|
5
5
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
6
6
|
i18n (>= 0.7, < 2)
|
7
7
|
minitest (~> 5.1)
|
8
8
|
tzinfo (~> 1.1)
|
9
|
-
zeitwerk (~> 2.2)
|
9
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
10
10
|
addressable (2.7.0)
|
11
11
|
public_suffix (>= 2.0.2, < 5.0)
|
12
12
|
coffee-script (2.4.1)
|
@@ -16,9 +16,9 @@ GEM
|
|
16
16
|
colorator (1.1.0)
|
17
17
|
commonmarker (0.17.13)
|
18
18
|
ruby-enum (~> 0.5)
|
19
|
-
concurrent-ruby (1.1.
|
20
|
-
dnsruby (1.61.
|
21
|
-
|
19
|
+
concurrent-ruby (1.1.6)
|
20
|
+
dnsruby (1.61.4)
|
21
|
+
simpleidn (~> 0.1)
|
22
22
|
em-websocket (0.5.1)
|
23
23
|
eventmachine (>= 0.12.9)
|
24
24
|
http_parser.rb (~> 0.6.0)
|
@@ -26,14 +26,14 @@ GEM
|
|
26
26
|
ffi (>= 1.3.0)
|
27
27
|
eventmachine (1.2.7)
|
28
28
|
execjs (2.7.0)
|
29
|
-
faraday (1.0.
|
29
|
+
faraday (1.0.1)
|
30
30
|
multipart-post (>= 1.2, < 3)
|
31
|
-
ffi (1.
|
31
|
+
ffi (1.13.1)
|
32
32
|
forwardable-extended (2.6.0)
|
33
33
|
gemoji (3.0.1)
|
34
|
-
github-pages (
|
34
|
+
github-pages (207)
|
35
35
|
github-pages-health-check (= 1.16.1)
|
36
|
-
jekyll (= 3.
|
36
|
+
jekyll (= 3.9.0)
|
37
37
|
jekyll-avatar (= 0.7.0)
|
38
38
|
jekyll-coffeescript (= 1.1.1)
|
39
39
|
jekyll-commonmark-ghpages (= 0.1.6)
|
@@ -67,12 +67,13 @@ GEM
|
|
67
67
|
jekyll-theme-time-machine (= 0.1.1)
|
68
68
|
jekyll-titles-from-headings (= 0.5.3)
|
69
69
|
jemoji (= 0.11.1)
|
70
|
-
kramdown (=
|
70
|
+
kramdown (= 2.3.0)
|
71
|
+
kramdown-parser-gfm (= 1.1.0)
|
71
72
|
liquid (= 4.0.3)
|
72
73
|
mercenary (~> 0.3)
|
73
74
|
minima (= 2.5.1)
|
74
75
|
nokogiri (>= 1.10.4, < 2.0)
|
75
|
-
rouge (= 3.
|
76
|
+
rouge (= 3.19.0)
|
76
77
|
terminal-table (~> 1.4)
|
77
78
|
github-pages-health-check (1.16.1)
|
78
79
|
addressable (~> 2.3)
|
@@ -80,20 +81,20 @@ GEM
|
|
80
81
|
octokit (~> 4.0)
|
81
82
|
public_suffix (~> 3.0)
|
82
83
|
typhoeus (~> 1.3)
|
83
|
-
html-pipeline (2.
|
84
|
+
html-pipeline (2.13.0)
|
84
85
|
activesupport (>= 2)
|
85
86
|
nokogiri (>= 1.4)
|
86
87
|
http_parser.rb (0.6.0)
|
87
88
|
i18n (0.9.5)
|
88
89
|
concurrent-ruby (~> 1.0)
|
89
|
-
jekyll (3.
|
90
|
+
jekyll (3.9.0)
|
90
91
|
addressable (~> 2.4)
|
91
92
|
colorator (~> 1.0)
|
92
93
|
em-websocket (~> 0.5)
|
93
94
|
i18n (~> 0.7)
|
94
95
|
jekyll-sass-converter (~> 1.0)
|
95
96
|
jekyll-watch (~> 2.0)
|
96
|
-
kramdown (
|
97
|
+
kramdown (>= 1.17, < 3)
|
97
98
|
liquid (~> 4.0)
|
98
99
|
mercenary (~> 0.3.3)
|
99
100
|
pathutil (~> 0.9)
|
@@ -191,7 +192,10 @@ GEM
|
|
191
192
|
gemoji (~> 3.0)
|
192
193
|
html-pipeline (~> 2.2)
|
193
194
|
jekyll (>= 3.0, < 5.0)
|
194
|
-
kramdown (
|
195
|
+
kramdown (2.3.0)
|
196
|
+
rexml
|
197
|
+
kramdown-parser-gfm (1.1.0)
|
198
|
+
kramdown (~> 2.0)
|
195
199
|
liquid (4.0.3)
|
196
200
|
listen (3.2.1)
|
197
201
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
@@ -202,23 +206,24 @@ GEM
|
|
202
206
|
jekyll (>= 3.5, < 5.0)
|
203
207
|
jekyll-feed (~> 0.9)
|
204
208
|
jekyll-seo-tag (~> 2.1)
|
205
|
-
minitest (5.14.
|
209
|
+
minitest (5.14.1)
|
206
210
|
multipart-post (2.1.1)
|
207
|
-
nokogiri (1.10.
|
211
|
+
nokogiri (1.10.10)
|
208
212
|
mini_portile2 (~> 2.4.0)
|
209
|
-
octokit (4.
|
213
|
+
octokit (4.18.0)
|
210
214
|
faraday (>= 0.9)
|
211
215
|
sawyer (~> 0.8.0, >= 0.5.3)
|
212
216
|
pathutil (0.16.2)
|
213
217
|
forwardable-extended (~> 2.6)
|
214
218
|
public_suffix (3.1.1)
|
215
|
-
rb-fsevent (0.10.
|
219
|
+
rb-fsevent (0.10.4)
|
216
220
|
rb-inotify (0.10.1)
|
217
221
|
ffi (~> 1.0)
|
218
|
-
|
219
|
-
|
222
|
+
rexml (3.2.4)
|
223
|
+
rouge (3.19.0)
|
224
|
+
ruby-enum (0.8.0)
|
220
225
|
i18n
|
221
|
-
rubyzip (2.
|
226
|
+
rubyzip (2.3.0)
|
222
227
|
safe_yaml (1.0.5)
|
223
228
|
sass (3.7.4)
|
224
229
|
sass-listen (~> 4.0.0)
|
@@ -228,15 +233,20 @@ GEM
|
|
228
233
|
sawyer (0.8.2)
|
229
234
|
addressable (>= 2.3.5)
|
230
235
|
faraday (> 0.8, < 2.0)
|
236
|
+
simpleidn (0.1.1)
|
237
|
+
unf (~> 0.1.4)
|
231
238
|
terminal-table (1.8.0)
|
232
239
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
233
240
|
thread_safe (0.3.6)
|
234
|
-
typhoeus (1.
|
241
|
+
typhoeus (1.4.0)
|
235
242
|
ethon (>= 0.9.0)
|
236
|
-
tzinfo (1.2.
|
243
|
+
tzinfo (1.2.7)
|
237
244
|
thread_safe (~> 0.1)
|
238
|
-
|
239
|
-
|
245
|
+
unf (0.1.4)
|
246
|
+
unf_ext
|
247
|
+
unf_ext (0.0.7.7)
|
248
|
+
unicode-display_width (1.7.0)
|
249
|
+
zeitwerk (2.4.0)
|
240
250
|
|
241
251
|
PLATFORMS
|
242
252
|
ruby
|
data/lib/active_admin.rb
CHANGED
@@ -15,44 +15,44 @@ require 'active_admin/helpers/i18n'
|
|
15
15
|
|
16
16
|
module ActiveAdmin
|
17
17
|
|
18
|
-
autoload :VERSION,
|
19
|
-
autoload :Application,
|
20
|
-
autoload :AssetRegistration,
|
21
|
-
autoload :Authorization,
|
22
|
-
autoload :AuthorizationAdapter,
|
23
|
-
autoload :Callbacks,
|
24
|
-
autoload :Component,
|
25
|
-
autoload :BaseController,
|
26
|
-
autoload :CanCanAdapter,
|
27
|
-
autoload :ControllerAction,
|
28
|
-
autoload :CSVBuilder,
|
29
|
-
autoload :Dependency,
|
30
|
-
autoload :Deprecation,
|
31
|
-
autoload :Devise,
|
32
|
-
autoload :DSL,
|
33
|
-
autoload :FormBuilder,
|
34
|
-
autoload :Inputs,
|
35
|
-
autoload :Localizers,
|
36
|
-
autoload :Menu,
|
37
|
-
autoload :MenuCollection,
|
38
|
-
autoload :MenuItem,
|
39
|
-
autoload :Namespace,
|
40
|
-
autoload :OrderClause,
|
41
|
-
autoload :Page,
|
42
|
-
autoload :PagePresenter,
|
43
|
-
autoload :PageController,
|
44
|
-
autoload :PageDSL,
|
45
|
-
autoload :PunditAdapter,
|
46
|
-
autoload :Resource,
|
47
|
-
autoload :ResourceController,
|
48
|
-
autoload :ResourceDSL,
|
49
|
-
autoload :Scope,
|
50
|
-
autoload :ScopeChain,
|
51
|
-
autoload :SidebarSection,
|
52
|
-
autoload :TableBuilder,
|
53
|
-
autoload :ViewFactory,
|
54
|
-
autoload :ViewHelpers,
|
55
|
-
autoload :Views,
|
18
|
+
autoload :VERSION, 'active_admin/version'
|
19
|
+
autoload :Application, 'active_admin/application'
|
20
|
+
autoload :AssetRegistration, 'active_admin/asset_registration'
|
21
|
+
autoload :Authorization, 'active_admin/authorization_adapter'
|
22
|
+
autoload :AuthorizationAdapter, 'active_admin/authorization_adapter'
|
23
|
+
autoload :Callbacks, 'active_admin/callbacks'
|
24
|
+
autoload :Component, 'active_admin/component'
|
25
|
+
autoload :BaseController, 'active_admin/base_controller'
|
26
|
+
autoload :CanCanAdapter, 'active_admin/cancan_adapter'
|
27
|
+
autoload :ControllerAction, 'active_admin/controller_action'
|
28
|
+
autoload :CSVBuilder, 'active_admin/csv_builder'
|
29
|
+
autoload :Dependency, 'active_admin/dependency'
|
30
|
+
autoload :Deprecation, 'active_admin/deprecation'
|
31
|
+
autoload :Devise, 'active_admin/devise'
|
32
|
+
autoload :DSL, 'active_admin/dsl'
|
33
|
+
autoload :FormBuilder, 'active_admin/form_builder'
|
34
|
+
autoload :Inputs, 'active_admin/inputs'
|
35
|
+
autoload :Localizers, 'active_admin/localizers'
|
36
|
+
autoload :Menu, 'active_admin/menu'
|
37
|
+
autoload :MenuCollection, 'active_admin/menu_collection'
|
38
|
+
autoload :MenuItem, 'active_admin/menu_item'
|
39
|
+
autoload :Namespace, 'active_admin/namespace'
|
40
|
+
autoload :OrderClause, 'active_admin/order_clause'
|
41
|
+
autoload :Page, 'active_admin/page'
|
42
|
+
autoload :PagePresenter, 'active_admin/page_presenter'
|
43
|
+
autoload :PageController, 'active_admin/page_controller'
|
44
|
+
autoload :PageDSL, 'active_admin/page_dsl'
|
45
|
+
autoload :PunditAdapter, 'active_admin/pundit_adapter'
|
46
|
+
autoload :Resource, 'active_admin/resource'
|
47
|
+
autoload :ResourceController, 'active_admin/resource_controller'
|
48
|
+
autoload :ResourceDSL, 'active_admin/resource_dsl'
|
49
|
+
autoload :Scope, 'active_admin/scope'
|
50
|
+
autoload :ScopeChain, 'active_admin/helpers/scope_chain'
|
51
|
+
autoload :SidebarSection, 'active_admin/sidebar_section'
|
52
|
+
autoload :TableBuilder, 'active_admin/table_builder'
|
53
|
+
autoload :ViewFactory, 'active_admin/view_factory'
|
54
|
+
autoload :ViewHelpers, 'active_admin/view_helpers'
|
55
|
+
autoload :Views, 'active_admin/views'
|
56
56
|
|
57
57
|
class << self
|
58
58
|
|
@@ -69,11 +69,11 @@ module ActiveAdmin
|
|
69
69
|
application.prepare!
|
70
70
|
end
|
71
71
|
|
72
|
-
delegate :register,
|
72
|
+
delegate :register, to: :application
|
73
73
|
delegate :register_page, to: :application
|
74
|
-
delegate :unload!,
|
75
|
-
delegate :load!,
|
76
|
-
delegate :routes,
|
74
|
+
delegate :unload!, to: :application
|
75
|
+
delegate :load!, to: :application
|
76
|
+
delegate :routes, to: :application
|
77
77
|
|
78
78
|
# A callback is triggered each time (before) Active Admin loads the configuration files.
|
79
79
|
# In development mode, this will happen whenever the user changes files. In production
|
@@ -130,4 +130,4 @@ require 'active_admin/filters'
|
|
130
130
|
|
131
131
|
# Require ORM-specific plugins
|
132
132
|
require 'active_admin/orm/active_record' if defined? ActiveRecord
|
133
|
-
require 'active_admin/orm/mongoid'
|
133
|
+
require 'active_admin/orm/mongoid' if defined? Mongoid
|
@@ -46,7 +46,7 @@ module ActiveAdmin
|
|
46
46
|
|
47
47
|
# Event that gets triggered on load of Active Admin
|
48
48
|
BeforeLoadEvent = 'active_admin.application.before_load'.freeze
|
49
|
-
AfterLoadEvent
|
49
|
+
AfterLoadEvent = 'active_admin.application.after_load'.freeze
|
50
50
|
|
51
51
|
# Runs before the app's AA initializer
|
52
52
|
def setup!
|
@@ -112,9 +112,9 @@ module ActiveAdmin
|
|
112
112
|
def load!
|
113
113
|
unless loaded?
|
114
114
|
ActiveSupport::Notifications.publish BeforeLoadEvent, self # before_load hook
|
115
|
-
files.each { |file| load file }
|
116
|
-
namespace(default_namespace)
|
117
|
-
ActiveSupport::Notifications.publish AfterLoadEvent, self
|
115
|
+
files.each { |file| load file } # load files
|
116
|
+
namespace(default_namespace) # init AA resources
|
117
|
+
ActiveSupport::Notifications.publish AfterLoadEvent, self # after_load hook
|
118
118
|
@@loaded = true
|
119
119
|
end
|
120
120
|
end
|
@@ -125,7 +125,7 @@ module ActiveAdmin
|
|
125
125
|
|
126
126
|
# Returns ALL the files to be loaded
|
127
127
|
def files
|
128
|
-
load_paths.flatten.compact.uniq.flat_map { |path| Dir["#{path}/**/*.rb"] }
|
128
|
+
load_paths.flatten.compact.uniq.flat_map { |path| Dir["#{path}/**/*.rb"] }.sort
|
129
129
|
end
|
130
130
|
|
131
131
|
# Creates all the necessary routes for the ActiveAdmin configurations
|
@@ -176,7 +176,7 @@ module ActiveAdmin
|
|
176
176
|
# files from being loaded twice in production.
|
177
177
|
def remove_active_admin_load_paths_from_rails_autoload_and_eager_load
|
178
178
|
ActiveSupport::Dependencies.autoload_paths -= load_paths
|
179
|
-
Rails.application.config.eager_load_paths
|
179
|
+
Rails.application.config.eager_load_paths -= load_paths
|
180
180
|
end
|
181
181
|
|
182
182
|
# Hook into the Rails code reloading mechanism so that things are reloaded
|
@@ -4,12 +4,12 @@ module ActiveAdmin
|
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
6
|
ACTIONS_DICTIONARY = {
|
7
|
-
index:
|
8
|
-
show:
|
9
|
-
new:
|
10
|
-
create:
|
11
|
-
edit:
|
12
|
-
update:
|
7
|
+
index: ActiveAdmin::Authorization::READ,
|
8
|
+
show: ActiveAdmin::Authorization::READ,
|
9
|
+
new: ActiveAdmin::Authorization::CREATE,
|
10
|
+
create: ActiveAdmin::Authorization::CREATE,
|
11
|
+
edit: ActiveAdmin::Authorization::UPDATE,
|
12
|
+
update: ActiveAdmin::Authorization::UPDATE,
|
13
13
|
destroy: ActiveAdmin::Authorization::DESTROY
|
14
14
|
}
|
15
15
|
|
@@ -112,9 +112,9 @@ module ActiveAdmin
|
|
112
112
|
redirect_backwards_or_to_root
|
113
113
|
end
|
114
114
|
|
115
|
-
format.csv
|
116
|
-
format.json { render json: { error: error },
|
117
|
-
format.xml
|
115
|
+
format.csv { render body: error, status: :unauthorized }
|
116
|
+
format.json { render json: { error: error }, status: :unauthorized }
|
117
|
+
format.xml { render xml: "<error>#{error}</error>", status: :unauthorized }
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|