activeadmin 1.4.3 → 2.0.0.rc1
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 +70 -10
- data/CONTRIBUTING.md +12 -11
- data/README.md +34 -8
- data/app/assets/javascripts/active_admin/base.es6 +23 -0
- data/app/assets/javascripts/active_admin/ext/jquery-ui.es6 +7 -0
- data/app/assets/javascripts/active_admin/ext/jquery.es6 +9 -0
- data/app/assets/javascripts/active_admin/initializers/datepicker.es6 +16 -0
- data/app/assets/javascripts/active_admin/initializers/filters.es6 +45 -0
- data/app/assets/javascripts/active_admin/initializers/tabs.es6 +6 -0
- data/app/assets/javascripts/active_admin/lib/active_admin.es6 +41 -0
- data/app/assets/javascripts/active_admin/lib/batch_actions.es6 +55 -0
- data/app/assets/javascripts/active_admin/lib/checkbox-toggler.es6 +49 -0
- data/app/assets/javascripts/active_admin/lib/dropdown-menu.es6 +123 -0
- data/app/assets/javascripts/active_admin/lib/has_many.es6 +95 -0
- data/app/assets/javascripts/active_admin/lib/modal_dialog.es6 +61 -0
- data/app/assets/javascripts/active_admin/lib/per_page.es6 +47 -0
- data/app/assets/javascripts/active_admin/lib/table-checkbox-toggler.es6 +36 -0
- data/app/assets/stylesheets/active_admin/_forms.scss +2 -14
- data/app/assets/stylesheets/active_admin/components/_status_tags.scss +0 -5
- data/app/assets/stylesheets/active_admin/components/_tabs.scss +1 -1
- data/app/assets/stylesheets/active_admin/mixins/_gradients.scss +1 -1
- data/app/views/active_admin/devise/confirmations/new.html.erb +1 -1
- data/app/views/active_admin/devise/passwords/edit.html.erb +1 -1
- data/app/views/active_admin/devise/passwords/new.html.erb +1 -1
- data/app/views/active_admin/devise/registrations/new.html.erb +1 -2
- data/app/views/active_admin/devise/shared/_error_messages.html.erb +15 -0
- data/app/views/active_admin/devise/unlocks/new.html.erb +1 -1
- data/app/views/layouts/active_admin_logged_out.html.erb +1 -1
- data/config/locales/bg.yml +0 -1
- data/config/locales/he.yml +0 -1
- data/config/locales/hu.yml +4 -0
- data/config/locales/lt.yml +2 -2
- data/config/locales/uk.yml +2 -0
- data/docs/0-installation.md +2 -2
- data/docs/13-authorization-adapter.md +4 -4
- data/docs/CNAME +1 -1
- data/docs/index.html +2 -2
- data/lib/active_admin.rb +9 -4
- data/lib/active_admin/application.rb +8 -14
- data/lib/active_admin/application_settings.rb +3 -0
- data/lib/active_admin/asset_registration.rb +0 -8
- data/lib/active_admin/base_controller.rb +6 -6
- data/lib/active_admin/base_controller/authorization.rb +2 -4
- data/lib/active_admin/batch_actions/controller.rb +1 -1
- data/lib/active_admin/batch_actions/resource_extension.rb +4 -4
- data/lib/active_admin/callbacks.rb +1 -1
- data/lib/active_admin/csv_builder.rb +1 -1
- data/lib/active_admin/dependency.rb +1 -77
- data/lib/active_admin/dsl.rb +1 -8
- data/lib/active_admin/error.rb +1 -1
- data/lib/active_admin/filters/active_filter.rb +3 -1
- data/lib/active_admin/filters/active_sidebar.rb +5 -1
- data/lib/active_admin/filters/forms.rb +2 -2
- data/lib/active_admin/filters/formtastic_addons.rb +1 -1
- data/lib/active_admin/filters/resource_extension.rb +3 -3
- data/lib/active_admin/form_builder.rb +3 -3
- data/lib/active_admin/generators/boilerplate.rb +1 -1
- data/lib/active_admin/helpers/scope_chain.rb +1 -0
- data/lib/active_admin/inputs/datepicker_input.rb +1 -1
- data/lib/active_admin/inputs/filters/base/search_method_select.rb +2 -2
- data/lib/active_admin/menu_item.rb +1 -1
- data/lib/active_admin/namespace.rb +2 -2
- data/lib/active_admin/namespace_settings.rb +7 -4
- data/lib/active_admin/orm/active_record/comments.rb +4 -4
- data/lib/active_admin/orm/active_record/comments/comment.rb +2 -2
- data/lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb +10 -5
- data/lib/active_admin/page_dsl.rb +1 -1
- data/lib/active_admin/pundit_adapter.rb +13 -4
- data/lib/active_admin/resource.rb +2 -2
- data/lib/active_admin/resource/action_items.rb +1 -1
- data/lib/active_admin/resource/attributes.rb +7 -4
- data/lib/active_admin/resource/menu.rb +3 -3
- data/lib/active_admin/resource/naming.rb +3 -3
- data/lib/active_admin/resource/routes.rb +9 -4
- data/lib/active_admin/resource/scopes.rb +3 -3
- data/lib/active_admin/resource/sidebars.rb +1 -1
- data/lib/active_admin/resource_collection.rb +2 -2
- data/lib/active_admin/resource_controller/action_builder.rb +10 -0
- data/lib/active_admin/resource_controller/resource_class_methods.rb +2 -0
- data/lib/active_admin/resource_dsl.rb +5 -3
- data/lib/active_admin/router.rb +1 -1
- data/lib/active_admin/scope.rb +4 -4
- data/lib/active_admin/settings_node.rb +1 -1
- data/lib/active_admin/version.rb +1 -1
- data/lib/active_admin/view_helpers.rb +1 -1
- data/lib/active_admin/view_helpers/display_helper.rb +10 -2
- data/lib/active_admin/view_helpers/download_format_links_helper.rb +1 -0
- data/lib/active_admin/view_helpers/method_or_proc_helper.rb +2 -0
- data/lib/active_admin/views.rb +1 -1
- data/lib/active_admin/views/components/active_admin_form.rb +7 -1
- data/lib/active_admin/views/components/attributes_table.rb +3 -3
- data/lib/active_admin/views/components/paginated_collection.rb +1 -1
- data/lib/active_admin/views/components/sidebar_section.rb +0 -3
- data/lib/active_admin/views/components/status_tag.rb +1 -18
- data/lib/active_admin/views/components/table_for.rb +2 -2
- data/lib/active_admin/views/components/tabs.rb +11 -2
- data/lib/active_admin/views/footer.rb +1 -1
- data/lib/active_admin/views/index_as_table.rb +5 -4
- data/lib/active_admin/views/pages/base.rb +3 -0
- data/lib/generators/active_admin/assets/assets_generator.rb +2 -2
- data/lib/generators/active_admin/assets/templates/active_admin.js +1 -0
- data/lib/generators/active_admin/install/install_generator.rb +6 -2
- data/lib/generators/active_admin/install/templates/active_admin.rb.erb +20 -1
- data/lib/generators/active_admin/install/templates/dashboard.rb +2 -3
- data/lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb.erb +1 -15
- data/lib/generators/active_admin/page/page_generator.rb +1 -1
- data/lib/generators/active_admin/resource/resource_generator.rb +1 -1
- data/lib/ransack_ext.rb +3 -3
- data/vendor/assets/javascripts/jquery-ui/form-reset-mixin.js +80 -0
- data/vendor/assets/javascripts/jquery-ui/form.js +22 -0
- data/vendor/assets/javascripts/jquery-ui/labels.js +65 -0
- data/vendor/assets/javascripts/jquery-ui/widgets/checkboxradio.js +274 -283
- metadata +107 -96
- data/.circleci/config.yml +0 -572
- data/.github/ISSUE_TEMPLATE.md +0 -20
- data/.gitignore +0 -16
- data/.mdlrc +0 -1
- data/.rspec +0 -1
- data/.rspec_parallel +0 -2
- data/.rubocop.yml +0 -99
- data/.simplecov +0 -9
- data/.yardopts +0 -7
- data/Gemfile +0 -30
- data/Gemfile.common +0 -26
- data/Gemfile.lock +0 -433
- data/Rakefile +0 -24
- data/activeadmin.gemspec +0 -32
- data/app/assets/javascripts/active_admin/base.js.coffee +0 -13
- data/app/assets/javascripts/active_admin/ext/jquery-ui.js.coffee +0 -6
- data/app/assets/javascripts/active_admin/ext/jquery.js.coffee +0 -7
- data/app/assets/javascripts/active_admin/initializers/batch_actions.js.coffee +0 -11
- data/app/assets/javascripts/active_admin/initializers/datepicker.js.coffee +0 -14
- data/app/assets/javascripts/active_admin/initializers/filters.js.coffee +0 -26
- data/app/assets/javascripts/active_admin/initializers/tabs.js.coffee +0 -7
- data/app/assets/javascripts/active_admin/lib/batch_actions.js.coffee +0 -42
- data/app/assets/javascripts/active_admin/lib/checkbox-toggler.js.coffee +0 -46
- data/app/assets/javascripts/active_admin/lib/dropdown-menu.js.coffee +0 -104
- data/app/assets/javascripts/active_admin/lib/flash.js.coffee +0 -19
- data/app/assets/javascripts/active_admin/lib/has_many.js.coffee +0 -79
- data/app/assets/javascripts/active_admin/lib/modal_dialog.js.coffee +0 -45
- data/app/assets/javascripts/active_admin/lib/per_page.js.coffee +0 -46
- data/app/assets/javascripts/active_admin/lib/table-checkbox-toggler.js.coffee +0 -22
- data/bin/install_chromedriver.sh +0 -17
- data/config/i18n-tasks.yml +0 -26
- data/config/mdl_style.rb +0 -11
- data/cucumber.yml +0 -7
- data/gemfiles/rails_42.gemfile +0 -10
- data/gemfiles/rails_42.gemfile.lock +0 -339
- data/gemfiles/rails_50.gemfile +0 -10
- data/gemfiles/rails_50.gemfile.lock +0 -353
- data/gemfiles/rails_51.gemfile +0 -10
- data/gemfiles/rails_51.gemfile.lock +0 -353
- data/lib/active_admin/event.rb +0 -24
- data/lib/active_admin/helpers/output_safety_helper.rb +0 -35
- data/lib/bug_report_templates/active_admin_master.rb +0 -111
- data/lib/generators/active_admin/assets/templates/active_admin.js.coffee +0 -1
- data/tasks/application_generator.rb +0 -50
- data/tasks/docs.rake +0 -64
- data/tasks/gemfiles.rake +0 -8
- data/tasks/lint.rake +0 -110
- data/tasks/local.rake +0 -27
- data/tasks/release.rake +0 -6
- data/tasks/test.rake +0 -42
@@ -85,18 +85,7 @@ form {
|
|
85
85
|
padding: 0;
|
86
86
|
margin-bottom: 0;
|
87
87
|
|
88
|
-
|
89
|
-
position:absolute;
|
90
|
-
width:95%;
|
91
|
-
padding-top:0.1em;
|
92
|
-
left: 0px;
|
93
|
-
font-size: 100%;
|
94
|
-
font-weight: normal;
|
95
|
-
span { position:absolute; }
|
96
|
-
&.label label { position:absolute; }
|
97
|
-
}
|
98
|
-
|
99
|
-
&:not(.has_many_fields) ol {
|
88
|
+
&:not(.inputs) ol {
|
100
89
|
float: left;
|
101
90
|
width: 74%;
|
102
91
|
margin: 0;
|
@@ -108,7 +97,7 @@ form {
|
|
108
97
|
}
|
109
98
|
}
|
110
99
|
|
111
|
-
&.
|
100
|
+
&.inputs ol {
|
112
101
|
float: left;
|
113
102
|
width: 100%;
|
114
103
|
margin: 0;
|
@@ -335,4 +324,3 @@ form.filter_form {
|
|
335
324
|
}
|
336
325
|
a.clear_filters_btn { @include light-button; }
|
337
326
|
}
|
338
|
-
|
@@ -6,11 +6,6 @@
|
|
6
6
|
padding: 3px 5px 2px 5px;
|
7
7
|
font-size: 0.8em;
|
8
8
|
|
9
|
-
// TODO: deprecated, remove in a v2 release
|
10
|
-
&.ok, &.published, &.complete, &.completed, &.green { background: #8daa92; }
|
11
|
-
&.warn, &.warning, &.orange { background: #e29b20; }
|
12
|
-
&.error, &.errored, &.red { background: #d45f53; }
|
13
|
-
|
14
9
|
&.yes { background: #6090DB }
|
15
10
|
&.no { background: grey }
|
16
11
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<div id="login">
|
2
2
|
<h2><%= active_admin_application.site_title(self) %> <%= title t('active_admin.devise.resend_confirmation_instructions.title') %></h2>
|
3
3
|
|
4
|
-
<%=
|
4
|
+
<%= render partial: "active_admin/devise/shared/error_messages", resource: resource %>
|
5
5
|
<%= active_admin_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f|
|
6
6
|
f.inputs do
|
7
7
|
f.input :email
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<div id="login">
|
2
2
|
<h2><%= active_admin_application.site_title(self) %> <%= title t('active_admin.devise.change_password.title') %></h2>
|
3
3
|
|
4
|
-
<%=
|
4
|
+
<%= render partial: "active_admin/devise/shared/error_messages", resource: resource %>
|
5
5
|
<%= active_admin_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f|
|
6
6
|
f.inputs do
|
7
7
|
f.input :password
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<div id="login">
|
2
2
|
<h2><%= active_admin_application.site_title(self) %> <%= title t('active_admin.devise.reset_password.title') %></h2>
|
3
3
|
|
4
|
-
<%=
|
4
|
+
<%= render partial: "active_admin/devise/shared/error_messages", resource: resource %>
|
5
5
|
<%= active_admin_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f|
|
6
6
|
f.inputs do
|
7
7
|
f.input :email
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<h2><%= active_admin_application.site_title(self) %> <%= title t('active_admin.devise.sign_up.title') %></h2>
|
3
3
|
|
4
4
|
<% scope = Devise::Mapping.find_scope!(resource_name) %>
|
5
|
-
<%=
|
5
|
+
<%= render partial: "active_admin/devise/shared/error_messages", resource: resource %>
|
6
6
|
<%= active_admin_form_for(resource, as: resource_name, url: send(:"#{scope}_registration_path"), html: { id: "registration_new" }) do |f|
|
7
7
|
f.inputs do
|
8
8
|
resource.class.authentication_keys.each_with_index { |key, index|
|
@@ -19,4 +19,3 @@
|
|
19
19
|
|
20
20
|
<%= render partial: "active_admin/devise/shared/links" %>
|
21
21
|
</div>
|
22
|
-
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% if resource.errors.any? %>
|
2
|
+
<div id="error_explanation">
|
3
|
+
<h2>
|
4
|
+
<%= I18n.t("errors.messages.not_saved",
|
5
|
+
count: resource.errors.count,
|
6
|
+
resource: resource.class.model_name.human.downcase)
|
7
|
+
%>
|
8
|
+
</h2>
|
9
|
+
<ul>
|
10
|
+
<% resource.errors.full_messages.each do |message| %>
|
11
|
+
<li><%= message %></li>
|
12
|
+
<% end %>
|
13
|
+
</ul>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<div id="login">
|
2
2
|
<h2><%= active_admin_application.site_title(self) %> <%= title t('active_admin.devise.unlock.title') %></h2>
|
3
3
|
|
4
|
-
<%=
|
4
|
+
<%= render partial: "active_admin/devise/shared/error_messages", resource: resource %>
|
5
5
|
<%= active_admin_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f|
|
6
6
|
f.inputs do
|
7
7
|
f.input :email
|
data/config/locales/bg.yml
CHANGED
data/config/locales/he.yml
CHANGED
data/config/locales/hu.yml
CHANGED
@@ -31,6 +31,10 @@ hu:
|
|
31
31
|
ends_with: "végződik"
|
32
32
|
greater_than: "Nagyobb, mint"
|
33
33
|
less_than: "Kisebb, mint"
|
34
|
+
gteq_datetime: "Nagyobb vagy egyenlő, mint"
|
35
|
+
lteq_datetime: "Kisebb vagy egyenlő, mint"
|
36
|
+
from: "-tól"
|
37
|
+
to: "-ig"
|
34
38
|
status_tag:
|
35
39
|
"yes": "Igen"
|
36
40
|
"no": "Nem"
|
data/config/locales/lt.yml
CHANGED
@@ -53,8 +53,8 @@ lt:
|
|
53
53
|
empty: '%{model} nerastas'
|
54
54
|
one: 'Rodoma <B> 1 </ b> %{model}'
|
55
55
|
one_page: 'Rodoma <b>visi %{n} </ b> %{model}'
|
56
|
-
multiple: 'Rodomi %{model} <b>%{
|
57
|
-
multiple_without_total: 'Rodomi %{model} <b>%{
|
56
|
+
multiple: 'Rodomi %{model} <b>%{from} - %{to} </ b> iš<b>%{total} </ b> iš viso'
|
57
|
+
multiple_without_total: 'Rodomi %{model} <b>%{from} - %{to} </ b> '
|
58
58
|
per_page: "Puslapyje: "
|
59
59
|
entry:
|
60
60
|
one: 'įrašas'
|
data/config/locales/uk.yml
CHANGED
data/docs/0-installation.md
CHANGED
@@ -11,7 +11,7 @@ gem 'activeadmin'
|
|
11
11
|
|
12
12
|
# Plus integrations with:
|
13
13
|
gem 'devise'
|
14
|
-
gem '
|
14
|
+
gem 'cancancan'
|
15
15
|
gem 'draper'
|
16
16
|
gem 'pundit'
|
17
17
|
```
|
@@ -44,7 +44,7 @@ After installing the gem, you need to run the generator. Here are your options:
|
|
44
44
|
The generator adds these core files, among others:
|
45
45
|
|
46
46
|
* `app/admin/dashboard.rb`
|
47
|
-
* `app/assets/javascripts/active_admin.js
|
47
|
+
* `app/assets/javascripts/active_admin.js`
|
48
48
|
* `app/assets/stylesheets/active_admin.scss`
|
49
49
|
* `config/initializers/active_admin.rb`
|
50
50
|
|
@@ -180,8 +180,7 @@ end
|
|
180
180
|
|
181
181
|
Sub-classing `ActiveAdmin::AuthorizationAdapter` is fairly low level. Many times
|
182
182
|
it's nicer to have a simpler DSL for managing authorization. Active Admin
|
183
|
-
provides an adapter out of the box for [
|
184
|
-
and [CanCanCan](https://github.com/CanCanCommunity/cancancan).
|
183
|
+
provides an adapter out of the box for [CanCanCan](https://github.com/CanCanCommunity/cancancan).
|
185
184
|
|
186
185
|
To use the CanCan adapter, update the configuration in the Active Admin
|
187
186
|
initializer:
|
@@ -221,7 +220,7 @@ changed from the initializer:
|
|
221
220
|
config.cancan_ability_class = "MyCustomAbility"
|
222
221
|
```
|
223
222
|
|
224
|
-
Now you can simply use
|
223
|
+
Now you can simply use CanCanCan the way that you would expect and
|
225
224
|
Active Admin will use it for authorization:
|
226
225
|
|
227
226
|
```ruby
|
@@ -240,7 +239,6 @@ end
|
|
240
239
|
```
|
241
240
|
|
242
241
|
To view more details about the API's, visit project pages of
|
243
|
-
[CanCan](https://github.com/ryanb/cancan) and
|
244
242
|
[CanCanCan](https://github.com/CanCanCommunity/cancancan).
|
245
243
|
|
246
244
|
## Using the Pundit Adapter
|
@@ -283,3 +281,5 @@ policy](https://github.com/activeadmin/activeadmin/blob/master/spec/support/temp
|
|
283
281
|
in your application instead of default one generated by Pundit's
|
284
282
|
`rails g pundit:install` command.
|
285
283
|
|
284
|
+
In addition, there are [example policies](https://github.com/activeadmin/activeadmin/tree/master/spec/support/templates/policies/active_admin)
|
285
|
+
for restricting access to ActiveAdmin's pages and comments.
|
data/docs/CNAME
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
activeadmin.info
|
data/docs/index.html
CHANGED
@@ -102,12 +102,12 @@
|
|
102
102
|
<span class="n">column</span> <span class="s2">"Price"</span><span class="p">,</span> <span class="ss">sortable:</span> <span class="ss">:price</span> <span class="k">do</span> <span class="o">|</span><span class="n">product</span><span class="o">|</span>
|
103
103
|
<span class="n">number_to_currency</span> <span class="n">product</span><span class="o">.</span><span class="n">price</span>
|
104
104
|
<span class="k">end</span>
|
105
|
-
<span class="n">
|
105
|
+
<span class="n">actions</span>
|
106
106
|
<span class="k">end</span>
|
107
107
|
|
108
108
|
<span class="k">end</span>
|
109
109
|
</code>
|
110
|
-
</pre>
|
110
|
+
</pre>
|
111
111
|
</div>
|
112
112
|
</div>
|
113
113
|
<h2 class="getting-started-heading">
|
data/lib/active_admin.rb
CHANGED
@@ -8,8 +8,8 @@ require 'formtastic'
|
|
8
8
|
require 'formtastic_i18n'
|
9
9
|
require 'inherited_resources'
|
10
10
|
require 'jquery-rails'
|
11
|
-
require 'coffee-rails'
|
12
11
|
require 'arbre'
|
12
|
+
require 'sprockets/es6'
|
13
13
|
|
14
14
|
require 'active_admin/helpers/i18n'
|
15
15
|
|
@@ -30,7 +30,6 @@ module ActiveAdmin
|
|
30
30
|
autoload :Deprecation, 'active_admin/deprecation'
|
31
31
|
autoload :Devise, 'active_admin/devise'
|
32
32
|
autoload :DSL, 'active_admin/dsl'
|
33
|
-
autoload :Event, 'active_admin/event'
|
34
33
|
autoload :FormBuilder, 'active_admin/form_builder'
|
35
34
|
autoload :Inputs, 'active_admin/inputs'
|
36
35
|
autoload :Localizers, 'active_admin/localizers'
|
@@ -90,7 +89,7 @@ module ActiveAdmin
|
|
90
89
|
#
|
91
90
|
# @param [Block] block A block to call each time (before) AA loads resources
|
92
91
|
def before_load(&block)
|
93
|
-
ActiveSupport::Notifications.subscribe ActiveAdmin::Application::BeforeLoadEvent, &
|
92
|
+
ActiveSupport::Notifications.subscribe ActiveAdmin::Application::BeforeLoadEvent, &wrap_block_for_active_support_notifications(block)
|
94
93
|
end
|
95
94
|
|
96
95
|
# A callback is triggered each time (after) Active Admin loads the configuration files. This
|
@@ -108,7 +107,13 @@ module ActiveAdmin
|
|
108
107
|
#
|
109
108
|
# @param [Block] block A block to call each time (after) AA loads resources
|
110
109
|
def after_load(&block)
|
111
|
-
ActiveSupport::Notifications.subscribe ActiveAdmin::Application::AfterLoadEvent, &
|
110
|
+
ActiveSupport::Notifications.subscribe ActiveAdmin::Application::AfterLoadEvent, &wrap_block_for_active_support_notifications(block)
|
111
|
+
end
|
112
|
+
|
113
|
+
private
|
114
|
+
|
115
|
+
def wrap_block_for_active_support_notifications block
|
116
|
+
proc { |event, *args| block.call *args }
|
112
117
|
end
|
113
118
|
|
114
119
|
end
|
@@ -43,12 +43,6 @@ module ActiveAdmin
|
|
43
43
|
@namespaces = Namespace::Store.new
|
44
44
|
end
|
45
45
|
|
46
|
-
# == Deprecated Settings
|
47
|
-
|
48
|
-
def allow_comments=(*)
|
49
|
-
raise "`config.allow_comments` is no longer provided in ActiveAdmin 1.x. Use `config.comments` instead."
|
50
|
-
end
|
51
|
-
|
52
46
|
include AssetRegistration
|
53
47
|
|
54
48
|
# Event that gets triggered on load of Active Admin
|
@@ -68,7 +62,7 @@ module ActiveAdmin
|
|
68
62
|
|
69
63
|
# Registers a brand new configuration for the given resource.
|
70
64
|
def register(resource, options = {}, &block)
|
71
|
-
ns = options.fetch(:namespace){ default_namespace }
|
65
|
+
ns = options.fetch(:namespace) { default_namespace }
|
72
66
|
namespace(ns).register resource, options, &block
|
73
67
|
end
|
74
68
|
|
@@ -98,7 +92,7 @@ module ActiveAdmin
|
|
98
92
|
# @&block The registration block.
|
99
93
|
#
|
100
94
|
def register_page(name, options = {}, &block)
|
101
|
-
ns = options.fetch(:namespace){ default_namespace }
|
95
|
+
ns = options.fetch(:namespace) { default_namespace }
|
102
96
|
namespace(ns).register_page name, options, &block
|
103
97
|
end
|
104
98
|
|
@@ -119,7 +113,7 @@ module ActiveAdmin
|
|
119
113
|
def load!
|
120
114
|
unless loaded?
|
121
115
|
ActiveSupport::Notifications.publish BeforeLoadEvent, self # before_load hook
|
122
|
-
files.each{ |file| load file }
|
116
|
+
files.each { |file| load file } # load files
|
123
117
|
namespace(default_namespace) # init AA resources
|
124
118
|
ActiveSupport::Notifications.publish AfterLoadEvent, self # after_load hook
|
125
119
|
@@loaded = true
|
@@ -127,12 +121,12 @@ module ActiveAdmin
|
|
127
121
|
end
|
128
122
|
|
129
123
|
def load(file)
|
130
|
-
DatabaseHitDuringLoad.capture{ super }
|
124
|
+
DatabaseHitDuringLoad.capture { super }
|
131
125
|
end
|
132
126
|
|
133
127
|
# Returns ALL the files to be loaded
|
134
128
|
def files
|
135
|
-
load_paths.flatten.compact.uniq.flat_map{ |path| Dir["#{path}/**/*.rb"] }
|
129
|
+
load_paths.flatten.compact.uniq.flat_map { |path| Dir["#{path}/**/*.rb"] }
|
136
130
|
end
|
137
131
|
|
138
132
|
# Creates all the necessary routes for the ActiveAdmin configurations
|
@@ -171,9 +165,9 @@ module ActiveAdmin
|
|
171
165
|
private
|
172
166
|
|
173
167
|
def register_default_assets
|
174
|
-
|
175
|
-
|
176
|
-
|
168
|
+
register_stylesheet 'active_admin.css', media: 'screen'
|
169
|
+
register_stylesheet 'active_admin/print.css', media: 'print'
|
170
|
+
register_javascript 'active_admin.js'
|
177
171
|
end
|
178
172
|
|
179
173
|
# Since app/admin is alphabetically before app/models, we have to remove it
|
@@ -35,5 +35,8 @@ module ActiveAdmin
|
|
35
35
|
|
36
36
|
# To make debugging easier, by default don't stream in development
|
37
37
|
register :disable_streaming_in, ['development']
|
38
|
+
|
39
|
+
# Remove sensitive attributes from being displayed, made editable, or exported by default
|
40
|
+
register :filter_attributes, [:encrypted_password, :password, :password_confirmation]
|
38
41
|
end
|
39
42
|
end
|
@@ -2,10 +2,6 @@ module ActiveAdmin
|
|
2
2
|
module AssetRegistration
|
3
3
|
|
4
4
|
def register_stylesheet(path, options = {})
|
5
|
-
Deprecation.warn <<-MSG.strip_heredoc
|
6
|
-
The `register_stylesheet` config is deprecated and will be removed
|
7
|
-
in v2. Import your "#{path}" stylesheet in the active_admin.scss.
|
8
|
-
MSG
|
9
5
|
stylesheets[path] = options
|
10
6
|
end
|
11
7
|
|
@@ -18,10 +14,6 @@ module ActiveAdmin
|
|
18
14
|
end
|
19
15
|
|
20
16
|
def register_javascript(name)
|
21
|
-
Deprecation.warn <<-MSG.strip_heredoc
|
22
|
-
The `register_javascript` config is deprecated and will be removed
|
23
|
-
in v2. Import your "#{name}" javascript in the active_admin.js.
|
24
|
-
MSG
|
25
17
|
javascripts.add name
|
26
18
|
end
|
27
19
|
|
@@ -22,6 +22,11 @@ module ActiveAdmin
|
|
22
22
|
attr_accessor :active_admin_config
|
23
23
|
end
|
24
24
|
|
25
|
+
include Authorization
|
26
|
+
include Menu
|
27
|
+
|
28
|
+
private
|
29
|
+
|
25
30
|
# By default Rails will render un-implemented actions when the view exists. Because Active
|
26
31
|
# Admin allows you to not render any of the actions by using the #actions method, we need
|
27
32
|
# to check if they are implemented.
|
@@ -29,11 +34,6 @@ module ActiveAdmin
|
|
29
34
|
raise AbstractController::ActionNotFound unless action_methods.include?(params[:action])
|
30
35
|
end
|
31
36
|
|
32
|
-
include Authorization
|
33
|
-
include Menu
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
37
|
# Calls the authentication method as defined in ActiveAdmin.authentication_method
|
38
38
|
def authenticate_active_admin_user
|
39
39
|
send(active_admin_namespace.authentication_method) if active_admin_namespace.authentication_method
|
@@ -74,7 +74,7 @@ module ActiveAdmin
|
|
74
74
|
|
75
75
|
def active_admin_root
|
76
76
|
controller, action = active_admin_namespace.root_to.split '#'
|
77
|
-
{controller: controller, action: action}
|
77
|
+
{ controller: controller, action: action }
|
78
78
|
end
|
79
79
|
|
80
80
|
end
|
@@ -111,16 +111,14 @@ module ActiveAdmin
|
|
111
111
|
redirect_backwards_or_to_root
|
112
112
|
end
|
113
113
|
|
114
|
-
body
|
115
|
-
|
116
|
-
format.csv { render body => error, status: :unauthorized }
|
114
|
+
format.csv { render body: error, status: :unauthorized }
|
117
115
|
format.json { render json: { error: error }, status: :unauthorized }
|
118
116
|
format.xml { render xml: "<error>#{error}</error>", status: :unauthorized }
|
119
117
|
end
|
120
118
|
end
|
121
119
|
|
122
120
|
def redirect_backwards_or_to_root
|
123
|
-
|
121
|
+
redirect_back fallback_location: active_admin_root
|
124
122
|
end
|
125
123
|
|
126
124
|
end
|