activeadmin 2.6.1 → 3.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +438 -9
- data/CONTRIBUTING.md +12 -36
- data/README.md +8 -8
- data/app/assets/javascripts/active_admin/base.js +27 -25
- data/app/assets/stylesheets/active_admin/_base.scss +53 -37
- data/app/assets/stylesheets/active_admin/_forms.scss +2 -13
- data/app/assets/stylesheets/active_admin/_header.scss +37 -3
- data/app/assets/stylesheets/active_admin/_normalize.scss +25 -123
- data/app/assets/stylesheets/active_admin/components/_comments.scss +2 -2
- data/app/assets/stylesheets/active_admin/components/_date_picker.scss +1 -2
- data/app/assets/stylesheets/active_admin/components/_dropdown_menu.scss +7 -5
- data/app/assets/stylesheets/active_admin/components/_pagination.scss +5 -2
- data/app/assets/stylesheets/active_admin/components/_table_tools.scss +9 -6
- data/app/assets/stylesheets/active_admin/components/_tabs.scss +10 -7
- data/app/assets/stylesheets/active_admin/mixins/_buttons.scss +2 -2
- data/app/assets/stylesheets/active_admin/mixins/_variables.scss +12 -0
- data/app/assets/stylesheets/active_admin/pages/_logged_out.scss +1 -1
- data/app/assets/stylesheets/active_admin/structure/_footer.scss +6 -1
- data/app/assets/stylesheets/active_admin/structure/_title_bar.scss +6 -4
- data/app/javascript/active_admin/initializers/has-many.js +4 -1
- 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/active_admin/devise/mailer/reset_password_instructions.html.erb +1 -1
- data/app/views/active_admin/devise/mailer/unlock_instructions.html.erb +2 -2
- data/app/views/active_admin/devise/shared/_links.erb +1 -1
- data/app/views/active_admin/page/index.html.arb +1 -0
- data/app/views/active_admin/resource/edit.html.arb +1 -0
- data/app/views/active_admin/resource/index.html.arb +1 -0
- data/app/views/active_admin/resource/new.html.arb +1 -0
- data/app/views/active_admin/resource/show.html.arb +1 -0
- data/app/views/layouts/active_admin.html.arb +1 -0
- data/app/views/layouts/active_admin_logged_out.html.erb +18 -7
- data/config/locales/ar.yml +6 -13
- data/config/locales/az.yml +0 -7
- data/config/locales/bg.yml +0 -7
- data/config/locales/bs.yml +0 -7
- data/config/locales/ca.yml +0 -7
- data/config/locales/cs.yml +0 -7
- data/config/locales/da.yml +0 -7
- data/config/locales/de-CH.yml +0 -7
- data/config/locales/de.yml +0 -8
- data/config/locales/el.yml +0 -7
- data/config/locales/en-CA.yml +0 -7
- data/config/locales/en-GB.yml +0 -7
- data/config/locales/en.yml +0 -8
- data/config/locales/eo.yml +0 -8
- data/config/locales/es-MX.yml +2 -8
- data/config/locales/es.yml +2 -10
- data/config/locales/fa.yml +0 -7
- data/config/locales/fi.yml +0 -7
- data/config/locales/fr.yml +3 -11
- data/config/locales/he.yml +0 -9
- data/config/locales/hr.yml +0 -7
- data/config/locales/hu.yml +0 -8
- data/config/locales/id.yml +0 -7
- data/config/locales/it.yml +18 -8
- data/config/locales/ja.yml +2 -10
- data/config/locales/ko.yml +1 -8
- data/config/locales/lt.yml +0 -8
- data/config/locales/lv.yml +0 -7
- data/config/locales/mk.yml +0 -8
- data/config/locales/nb.yml +0 -8
- data/config/locales/nl.yml +1 -9
- data/config/locales/pl.yml +0 -8
- data/config/locales/pt-BR.yml +0 -8
- data/config/locales/pt-PT.yml +0 -7
- data/config/locales/ro.yml +3 -9
- data/config/locales/ru.yml +0 -6
- data/config/locales/sk.yml +0 -8
- data/config/locales/sv-SE.yml +58 -39
- data/config/locales/tr.yml +0 -11
- data/config/locales/uk.yml +0 -6
- data/config/locales/vi.yml +38 -19
- data/config/locales/zh-CN.yml +34 -23
- data/config/locales/zh-TW.yml +0 -7
- data/lib/active_admin/abstract_view_factory.rb +1 -0
- data/lib/active_admin/application.rb +19 -19
- data/lib/active_admin/application_settings.rb +4 -3
- data/lib/active_admin/asset_registration.rb +4 -3
- data/lib/active_admin/authorization_adapter.rb +6 -3
- data/lib/active_admin/base_controller/authorization.rb +15 -13
- data/lib/active_admin/base_controller/menu.rb +1 -0
- data/lib/active_admin/base_controller.rb +6 -5
- data/lib/active_admin/batch_actions/controller.rb +4 -3
- data/lib/active_admin/batch_actions/resource_extension.rb +10 -8
- data/lib/active_admin/batch_actions/views/batch_action_form.rb +4 -3
- data/lib/active_admin/batch_actions/views/batch_action_selector.rb +7 -6
- data/lib/active_admin/batch_actions/views/selection_cells.rb +4 -3
- data/lib/active_admin/batch_actions.rb +1 -0
- data/lib/active_admin/callbacks.rb +1 -0
- data/lib/active_admin/cancan_adapter.rb +2 -1
- data/lib/active_admin/collection_decorator.rb +32 -0
- data/lib/active_admin/component.rb +1 -0
- data/lib/active_admin/controller_action.rb +1 -0
- data/lib/active_admin/csv_builder.rb +25 -17
- data/lib/active_admin/dependency.rb +12 -15
- data/lib/active_admin/devise.rb +16 -5
- data/lib/active_admin/dsl.rb +2 -1
- data/lib/active_admin/dynamic_setting.rb +1 -0
- data/lib/active_admin/dynamic_settings_node.rb +3 -2
- data/lib/active_admin/engine.rb +17 -9
- data/lib/active_admin/error.rb +1 -2
- data/lib/active_admin/filters/active.rb +2 -1
- data/lib/active_admin/filters/active_filter.rb +6 -6
- data/lib/active_admin/filters/active_sidebar.rb +4 -30
- data/lib/active_admin/filters/dsl.rb +1 -0
- data/lib/active_admin/filters/forms.rb +9 -8
- data/lib/active_admin/filters/formtastic_addons.rb +3 -7
- data/lib/active_admin/filters/resource_extension.rb +6 -5
- data/lib/active_admin/filters.rb +8 -7
- data/lib/active_admin/form_builder.rb +25 -20
- data/lib/active_admin/generators/boilerplate.rb +2 -1
- data/lib/active_admin/helpers/collection.rb +2 -0
- data/lib/active_admin/helpers/i18n.rb +1 -0
- data/lib/active_admin/helpers/optional_display.rb +3 -2
- data/lib/active_admin/helpers/routes/url_helpers.rb +1 -0
- data/lib/active_admin/helpers/scope_chain.rb +1 -0
- data/lib/active_admin/inputs/datepicker_input.rb +2 -1
- data/lib/active_admin/inputs/filters/base/search_method_select.rb +7 -6
- data/lib/active_admin/inputs/filters/base.rb +2 -1
- data/lib/active_admin/inputs/filters/boolean_input.rb +2 -1
- data/lib/active_admin/inputs/filters/check_boxes_input.rb +2 -1
- data/lib/active_admin/inputs/filters/date_picker_input.rb +1 -0
- data/lib/active_admin/inputs/filters/date_range_input.rb +3 -2
- data/lib/active_admin/inputs/filters/numeric_input.rb +2 -1
- data/lib/active_admin/inputs/filters/select_input.rb +5 -2
- data/lib/active_admin/inputs/filters/string_input.rb +2 -1
- data/lib/active_admin/inputs/filters/text_input.rb +1 -0
- data/lib/active_admin/inputs.rb +1 -0
- data/lib/active_admin/localizers/resource_localizer.rb +4 -3
- data/lib/active_admin/localizers.rb +2 -1
- data/lib/active_admin/menu.rb +8 -3
- data/lib/active_admin/menu_collection.rb +1 -0
- data/lib/active_admin/menu_item.rb +8 -7
- data/lib/active_admin/namespace.rb +16 -15
- data/lib/active_admin/namespace_settings.rb +9 -5
- data/lib/active_admin/order_clause.rb +2 -1
- data/lib/active_admin/orm/active_record/comments/comment.rb +12 -3
- data/lib/active_admin/orm/active_record/comments/namespace_helper.rb +1 -0
- data/lib/active_admin/orm/active_record/comments/resource_helper.rb +1 -0
- data/lib/active_admin/orm/active_record/comments/show_page_helper.rb +1 -0
- data/lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb +21 -20
- data/lib/active_admin/orm/active_record/comments/views.rb +3 -2
- data/lib/active_admin/orm/active_record/comments.rb +28 -27
- data/lib/active_admin/orm/active_record.rb +2 -1
- data/lib/active_admin/orm/mongoid.rb +1 -0
- data/lib/active_admin/page.rb +2 -1
- data/lib/active_admin/page_controller.rb +1 -0
- data/lib/active_admin/page_dsl.rb +1 -0
- data/lib/active_admin/page_presenter.rb +1 -0
- data/lib/active_admin/pundit_adapter.rb +58 -16
- data/lib/active_admin/resource/action_items.rb +6 -5
- data/lib/active_admin/resource/attributes.rb +9 -1
- data/lib/active_admin/resource/belongs_to.rb +3 -2
- data/lib/active_admin/resource/controllers.rb +2 -1
- data/lib/active_admin/resource/includes.rb +1 -0
- data/lib/active_admin/resource/menu.rb +5 -4
- data/lib/active_admin/resource/model.rb +1 -0
- data/lib/active_admin/resource/naming.rb +5 -4
- data/lib/active_admin/resource/ordering.rb +1 -0
- data/lib/active_admin/resource/page_presenters.rb +1 -0
- data/lib/active_admin/resource/pagination.rb +1 -0
- data/lib/active_admin/resource/routes.rb +6 -7
- data/lib/active_admin/resource/scope_to.rb +8 -7
- data/lib/active_admin/resource/scopes.rb +1 -0
- data/lib/active_admin/resource/sidebars.rb +2 -1
- data/lib/active_admin/resource.rb +20 -19
- data/lib/active_admin/resource_collection.rb +1 -0
- data/lib/active_admin/resource_controller/action_builder.rb +1 -0
- data/lib/active_admin/resource_controller/data_access.rb +31 -5
- data/lib/active_admin/resource_controller/decorators.rb +7 -28
- data/lib/active_admin/resource_controller/polymorphic_routes.rb +1 -0
- data/lib/active_admin/resource_controller/resource_class_methods.rb +1 -0
- data/lib/active_admin/resource_controller/scoping.rb +1 -0
- data/lib/active_admin/resource_controller/sidebars.rb +1 -0
- data/lib/active_admin/resource_controller/streaming.rb +9 -7
- data/lib/active_admin/resource_controller.rb +13 -11
- data/lib/active_admin/resource_dsl.rb +11 -25
- data/lib/active_admin/router.rb +1 -0
- data/lib/active_admin/scope.rb +7 -6
- data/lib/active_admin/settings_node.rb +1 -0
- data/lib/active_admin/sidebar_section.rb +1 -0
- data/lib/active_admin/version.rb +2 -1
- data/lib/active_admin/view_factory.rb +18 -17
- data/lib/active_admin/view_helpers/active_admin_application_helper.rb +1 -0
- data/lib/active_admin/view_helpers/auto_link_helper.rb +2 -1
- data/lib/active_admin/view_helpers/breadcrumb_helper.rb +4 -3
- data/lib/active_admin/view_helpers/display_helper.rb +23 -8
- data/lib/active_admin/view_helpers/download_format_links_helper.rb +2 -1
- data/lib/active_admin/view_helpers/fields_for.rb +3 -2
- data/lib/active_admin/view_helpers/flash_helper.rb +1 -0
- data/lib/active_admin/view_helpers/form_helper.rb +1 -0
- data/lib/active_admin/view_helpers/method_or_proc_helper.rb +1 -0
- data/lib/active_admin/view_helpers/scope_name_helper.rb +1 -0
- data/lib/active_admin/view_helpers/sidebar_helper.rb +1 -0
- data/lib/active_admin/view_helpers/title_helper.rb +1 -0
- data/lib/active_admin/view_helpers/view_factory_helper.rb +1 -0
- data/lib/active_admin/view_helpers.rb +2 -1
- data/lib/active_admin/views/action_items.rb +1 -0
- data/lib/active_admin/views/components/active_admin_form.rb +8 -11
- data/lib/active_admin/views/components/active_filters_sidebar_content.rb +59 -0
- data/lib/active_admin/views/components/attributes_table.rb +6 -5
- data/lib/active_admin/views/components/blank_slate.rb +2 -1
- data/lib/active_admin/views/components/columns.rb +1 -0
- data/lib/active_admin/views/components/dropdown_menu.rb +7 -9
- data/lib/active_admin/views/components/index_list.rb +4 -3
- data/lib/active_admin/views/components/menu.rb +2 -1
- data/lib/active_admin/views/components/menu_item.rb +5 -4
- data/lib/active_admin/views/components/paginated_collection.rb +19 -18
- data/lib/active_admin/views/components/panel.rb +2 -1
- data/lib/active_admin/views/components/scopes.rb +8 -5
- data/lib/active_admin/views/components/sidebar.rb +1 -0
- data/lib/active_admin/views/components/sidebar_section.rb +1 -0
- data/lib/active_admin/views/components/site_title.rb +2 -1
- data/lib/active_admin/views/components/status_tag.rb +12 -11
- data/lib/active_admin/views/components/table_for.rb +18 -17
- data/lib/active_admin/views/components/tabs.rb +4 -3
- data/lib/active_admin/views/components/unsupported_browser.rb +1 -0
- data/lib/active_admin/views/footer.rb +3 -1
- data/lib/active_admin/views/header.rb +3 -2
- data/lib/active_admin/views/index_as_block.rb +1 -0
- data/lib/active_admin/views/index_as_blog.rb +2 -1
- data/lib/active_admin/views/index_as_grid.rb +2 -1
- data/lib/active_admin/views/index_as_table.rb +16 -19
- data/lib/active_admin/views/pages/base.rb +17 -11
- data/lib/active_admin/views/pages/form.rb +1 -0
- data/lib/active_admin/views/pages/index.rb +15 -13
- data/lib/active_admin/views/pages/layout.rb +1 -0
- data/lib/active_admin/views/pages/page.rb +1 -0
- data/lib/active_admin/views/pages/show.rb +2 -7
- data/lib/active_admin/views/tabbed_navigation.rb +3 -2
- data/lib/active_admin/views/title_bar.rb +2 -1
- data/lib/active_admin/views.rb +2 -1
- data/lib/active_admin.rb +63 -61
- data/lib/activeadmin.rb +2 -1
- data/lib/generators/active_admin/assets/assets_generator.rb +3 -2
- data/lib/generators/active_admin/assets/templates/active_admin.scss +2 -2
- data/lib/generators/active_admin/devise/devise_generator.rb +6 -5
- data/lib/generators/active_admin/install/install_generator.rb +15 -8
- data/lib/generators/active_admin/install/templates/active_admin.rb.erb +27 -3
- data/lib/generators/active_admin/install/templates/dashboard.rb +1 -0
- data/lib/generators/active_admin/page/page_generator.rb +2 -1
- data/lib/generators/active_admin/page/templates/page.rb +1 -0
- data/lib/generators/active_admin/resource/resource_generator.rb +4 -3
- data/lib/generators/active_admin/webpacker/plugins/jquery.js +7 -0
- data/lib/generators/active_admin/webpacker/templates/active_admin.js +5 -0
- data/lib/generators/active_admin/webpacker/templates/active_admin.scss +17 -0
- data/lib/generators/active_admin/webpacker/templates/print.scss +2 -0
- data/lib/generators/active_admin/webpacker/webpacker_generator.rb +27 -0
- data/vendor/assets/javascripts/jquery-ui/data.js +12 -8
- data/vendor/assets/javascripts/jquery-ui/disable-selection.js +10 -7
- data/vendor/assets/javascripts/jquery-ui/focusable.js +12 -9
- data/vendor/assets/javascripts/jquery-ui/form-reset-mixin.js +60 -57
- data/vendor/assets/javascripts/jquery-ui/form.js +15 -12
- data/vendor/assets/javascripts/jquery-ui/ie.js +5 -2
- data/vendor/assets/javascripts/jquery-ui/keycode.js +11 -7
- data/vendor/assets/javascripts/jquery-ui/labels.js +46 -40
- data/vendor/assets/javascripts/jquery-ui/plugin.js +5 -2
- data/vendor/assets/javascripts/jquery-ui/position.js +30 -17
- data/vendor/assets/javascripts/jquery-ui/safe-active-element.js +6 -2
- data/vendor/assets/javascripts/jquery-ui/safe-blur.js +6 -2
- data/vendor/assets/javascripts/jquery-ui/scroll-parent.js +10 -7
- data/vendor/assets/javascripts/jquery-ui/tabbable.js +11 -8
- data/vendor/assets/javascripts/jquery-ui/unique-id.js +10 -7
- data/vendor/assets/javascripts/jquery-ui/version.js +6 -3
- data/vendor/assets/javascripts/jquery-ui/widget.js +53 -30
- data/vendor/assets/javascripts/jquery-ui/widgets/button.js +87 -24
- data/vendor/assets/javascripts/jquery-ui/widgets/checkboxradio.js +276 -273
- data/vendor/assets/javascripts/jquery-ui/widgets/controlgroup.js +15 -11
- data/vendor/assets/javascripts/jquery-ui/widgets/datepicker.js +182 -62
- data/vendor/assets/javascripts/jquery-ui/widgets/dialog.js +53 -36
- data/vendor/assets/javascripts/jquery-ui/widgets/draggable.js +28 -19
- data/vendor/assets/javascripts/jquery-ui/widgets/mouse.js +22 -11
- data/vendor/assets/javascripts/jquery-ui/widgets/resizable.js +47 -26
- data/vendor/assets/javascripts/jquery-ui/widgets/sortable.js +186 -125
- data/vendor/assets/javascripts/jquery-ui/widgets/tabs.js +20 -20
- metadata +48 -114
- data/docs/.gitignore +0 -1
- data/docs/0-installation.md +0 -118
- data/docs/1-general-configuration.md +0 -224
- data/docs/10-custom-pages.md +0 -150
- data/docs/11-decorators.md +0 -59
- data/docs/12-arbre-components.md +0 -214
- data/docs/13-authorization-adapter.md +0 -285
- data/docs/14-gotchas.md +0 -138
- data/docs/2-resource-customization.md +0 -466
- data/docs/3-index-pages/custom-index.md +0 -35
- data/docs/3-index-pages/index-as-block.md +0 -19
- data/docs/3-index-pages/index-as-blog.md +0 -69
- data/docs/3-index-pages/index-as-grid.md +0 -27
- data/docs/3-index-pages/index-as-table.md +0 -234
- data/docs/3-index-pages.md +0 -328
- data/docs/4-csv-format.md +0 -74
- data/docs/5-forms.md +0 -232
- data/docs/6-show-pages.md +0 -81
- data/docs/7-sidebars.md +0 -75
- data/docs/8-custom-actions.md +0 -177
- data/docs/9-batch-actions.md +0 -237
- data/docs/CNAME +0 -1
- data/docs/Gemfile +0 -3
- data/docs/Gemfile.lock +0 -248
- data/docs/README.md +0 -24
- data/docs/_config.yml +0 -4
- data/docs/_includes/footer.html +0 -8
- data/docs/_includes/google-analytics.html +0 -16
- data/docs/_includes/head.html +0 -7
- data/docs/_includes/toc.html +0 -98
- data/docs/_includes/top-menu.html +0 -17
- data/docs/_layouts/default.html +0 -21
- data/docs/documentation.md +0 -60
- data/docs/images/activeadmin.png +0 -0
- data/docs/images/code-header.png +0 -0
- data/docs/images/divider.png +0 -0
- data/docs/images/features.png +0 -0
- data/docs/images/tidelift.svg +0 -14
- data/docs/index.html +0 -226
- data/docs/stylesheets/main.css +0 -1205
- data/lib/active_admin/deprecation.rb +0 -10
- data/lib/ransack_ext.rb +0 -20
- data/vendor/assets/javascripts/jquery-ui/escape-selector.js +0 -23
- /data/app/assets/stylesheets/active_admin/{print.scss → _print.scss} +0 -0
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module ActiveAdmin
|
2
3
|
module Views
|
3
4
|
module Pages
|
@@ -15,7 +16,7 @@ module ActiveAdmin
|
|
15
16
|
end
|
16
17
|
|
17
18
|
def main_content
|
18
|
-
I18n.t(
|
19
|
+
I18n.t("active_admin.main_content", model: title).html_safe
|
19
20
|
end
|
20
21
|
|
21
22
|
private
|
@@ -29,22 +30,27 @@ module ActiveAdmin
|
|
29
30
|
text_node(active_admin_namespace.head)
|
30
31
|
|
31
32
|
active_admin_application.stylesheets.each do |style, options|
|
32
|
-
|
33
|
+
stylesheet_tag = active_admin_namespace.use_webpacker ? stylesheet_pack_tag(style, **options) : stylesheet_link_tag(style, **options)
|
34
|
+
text_node(stylesheet_tag.html_safe) if stylesheet_tag
|
33
35
|
end
|
34
36
|
|
35
37
|
active_admin_namespace.meta_tags.each do |name, content|
|
36
38
|
text_node(meta(name: name, content: content))
|
37
39
|
end
|
38
40
|
|
39
|
-
active_admin_application.javascripts.each do |path|
|
40
|
-
|
41
|
+
active_admin_application.javascripts.each do |path, options|
|
42
|
+
javascript_tag = active_admin_namespace.use_webpacker ? javascript_pack_tag(path, **options) : javascript_include_tag(path, **options)
|
43
|
+
text_node(javascript_tag)
|
41
44
|
end
|
42
45
|
|
43
46
|
if active_admin_namespace.favicon
|
44
|
-
|
47
|
+
favicon = active_admin_namespace.favicon
|
48
|
+
favicon_tag = active_admin_namespace.use_webpacker ? favicon_pack_tag(favicon) : favicon_link_tag(favicon)
|
49
|
+
text_node(favicon_tag)
|
45
50
|
end
|
46
51
|
|
47
|
-
text_node
|
52
|
+
text_node csrf_meta_tags
|
53
|
+
text_node csp_meta_tag
|
48
54
|
end
|
49
55
|
end
|
50
56
|
|
@@ -63,9 +69,9 @@ module ActiveAdmin
|
|
63
69
|
def body_classes
|
64
70
|
Arbre::HTML::ClassList.new [
|
65
71
|
params[:action],
|
66
|
-
params[:controller].tr(
|
67
|
-
|
68
|
-
active_admin_namespace.name.to_s +
|
72
|
+
params[:controller].tr("/", "_"),
|
73
|
+
"active_admin", "logged_in",
|
74
|
+
active_admin_namespace.name.to_s + "_namespace"
|
69
75
|
]
|
70
76
|
end
|
71
77
|
|
@@ -79,12 +85,12 @@ module ActiveAdmin
|
|
79
85
|
build_flash_messages
|
80
86
|
div id: "active_admin_content", class: (skip_sidebar? ? "without_sidebar" : "with_sidebar") do
|
81
87
|
build_main_content_wrapper
|
82
|
-
sidebar sidebar_sections_for_action, id:
|
88
|
+
sidebar sidebar_sections_for_action, id: "sidebar" unless skip_sidebar?
|
83
89
|
end
|
84
90
|
end
|
85
91
|
|
86
92
|
def build_flash_messages
|
87
|
-
div class:
|
93
|
+
div class: "flashes" do
|
88
94
|
flash_messages.each do |type, messages|
|
89
95
|
[*messages].each do |message|
|
90
96
|
div message, class: "flash flash_#{type}"
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "active_admin/helpers/collection"
|
2
3
|
|
3
4
|
module ActiveAdmin
|
4
5
|
module Views
|
@@ -111,7 +112,7 @@ module ActiveAdmin
|
|
111
112
|
|
112
113
|
def render_blank_slate
|
113
114
|
blank_slate_content = I18n.t("active_admin.blank_slate.content", resource_name: active_admin_config.plural_resource_label)
|
114
|
-
if controller.action_methods.include?(
|
115
|
+
if controller.action_methods.include?("new") && authorized?(ActiveAdmin::Auth::NEW, active_admin_config.resource_class)
|
115
116
|
blank_slate_content = [blank_slate_content, blank_slate_link].compact.join(" ")
|
116
117
|
end
|
117
118
|
insert_tag(view_factory.blank_slate, blank_slate_content)
|
@@ -125,18 +126,19 @@ module ActiveAdmin
|
|
125
126
|
def render_index
|
126
127
|
renderer_class = find_index_renderer_class(config[:as])
|
127
128
|
|
128
|
-
paginator
|
129
|
-
download_links
|
129
|
+
paginator = config.fetch(:paginator, true)
|
130
|
+
download_links = config.fetch(:download_links, active_admin_config.namespace.download_links)
|
130
131
|
pagination_total = config.fetch(:pagination_total, true)
|
131
|
-
per_page
|
132
|
-
|
133
|
-
paginated_collection(
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
132
|
+
per_page = config.fetch(:per_page, active_admin_config.per_page)
|
133
|
+
|
134
|
+
paginated_collection(
|
135
|
+
collection, entry_name: active_admin_config.resource_label,
|
136
|
+
entries_name: active_admin_config.plural_resource_label(count: collection_size),
|
137
|
+
download_links: download_links,
|
138
|
+
paginator: paginator,
|
139
|
+
per_page: per_page,
|
140
|
+
pagination_total: pagination_total) do
|
141
|
+
div class: "index_content" do
|
140
142
|
insert_tag(renderer_class, config, collection)
|
141
143
|
end
|
142
144
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module ActiveAdmin
|
2
3
|
module Views
|
3
4
|
module Pages
|
@@ -39,13 +40,7 @@ module ActiveAdmin
|
|
39
40
|
protected
|
40
41
|
|
41
42
|
def default_title
|
42
|
-
|
43
|
-
|
44
|
-
if title.blank?
|
45
|
-
title = "#{active_admin_config.resource_label} ##{resource.id}"
|
46
|
-
end
|
47
|
-
|
48
|
-
title
|
43
|
+
display_name(resource)
|
49
44
|
end
|
50
45
|
|
51
46
|
module DefaultMainContent
|
@@ -1,10 +1,11 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative "components/menu"
|
2
3
|
|
3
4
|
module ActiveAdmin
|
4
5
|
module Views
|
5
6
|
class TabbedNavigation < Menu
|
6
7
|
def build(menu, options = {})
|
7
|
-
super(menu, options.reverse_merge(id:
|
8
|
+
super(menu, options.reverse_merge(id: "tabs"))
|
8
9
|
end
|
9
10
|
end
|
10
11
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module ActiveAdmin
|
2
3
|
module Views
|
3
4
|
class TitleBar < Component
|
@@ -43,7 +44,7 @@ module ActiveAdmin
|
|
43
44
|
end
|
44
45
|
|
45
46
|
def build_title_tag
|
46
|
-
h2(@title, id:
|
47
|
+
h2(@title, id: "page_title")
|
47
48
|
end
|
48
49
|
|
49
50
|
def build_action_items
|
data/lib/active_admin/views.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module ActiveAdmin
|
2
3
|
module Views
|
3
4
|
|
4
5
|
# Loads all the classes in views/*.rb
|
5
|
-
Dir[File.expand_path(
|
6
|
+
Dir[File.expand_path("views", __dir__) + "/**/*.rb"].sort.each { |f| require f }
|
6
7
|
|
7
8
|
end
|
8
9
|
end
|
data/lib/active_admin.rb
CHANGED
@@ -1,58 +1,56 @@
|
|
1
|
-
|
2
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "active_support/core_ext"
|
3
|
+
require "set"
|
3
4
|
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require 'sassc-rails'
|
12
|
-
require 'arbre'
|
5
|
+
require "ransack"
|
6
|
+
require "kaminari"
|
7
|
+
require "formtastic"
|
8
|
+
require "formtastic_i18n"
|
9
|
+
require "inherited_resources"
|
10
|
+
require "jquery-rails"
|
11
|
+
require "arbre"
|
13
12
|
|
14
|
-
require
|
13
|
+
require "active_admin/helpers/i18n"
|
15
14
|
|
16
15
|
module ActiveAdmin
|
17
16
|
|
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 :
|
31
|
-
autoload :
|
32
|
-
autoload :
|
33
|
-
autoload :
|
34
|
-
autoload :
|
35
|
-
autoload :
|
36
|
-
autoload :
|
37
|
-
autoload :
|
38
|
-
autoload :
|
39
|
-
autoload :
|
40
|
-
autoload :
|
41
|
-
autoload :
|
42
|
-
autoload :
|
43
|
-
autoload :
|
44
|
-
autoload :
|
45
|
-
autoload :
|
46
|
-
autoload :
|
47
|
-
autoload :
|
48
|
-
autoload :
|
49
|
-
autoload :
|
50
|
-
autoload :
|
51
|
-
autoload :
|
52
|
-
autoload :
|
53
|
-
autoload :
|
54
|
-
autoload :
|
55
|
-
autoload :Views, 'active_admin/views'
|
17
|
+
autoload :VERSION, "active_admin/version"
|
18
|
+
autoload :Application, "active_admin/application"
|
19
|
+
autoload :AssetRegistration, "active_admin/asset_registration"
|
20
|
+
autoload :Authorization, "active_admin/authorization_adapter"
|
21
|
+
autoload :AuthorizationAdapter, "active_admin/authorization_adapter"
|
22
|
+
autoload :Callbacks, "active_admin/callbacks"
|
23
|
+
autoload :Component, "active_admin/component"
|
24
|
+
autoload :BaseController, "active_admin/base_controller"
|
25
|
+
autoload :CanCanAdapter, "active_admin/cancan_adapter"
|
26
|
+
autoload :ControllerAction, "active_admin/controller_action"
|
27
|
+
autoload :CSVBuilder, "active_admin/csv_builder"
|
28
|
+
autoload :Dependency, "active_admin/dependency"
|
29
|
+
autoload :Devise, "active_admin/devise"
|
30
|
+
autoload :DSL, "active_admin/dsl"
|
31
|
+
autoload :FormBuilder, "active_admin/form_builder"
|
32
|
+
autoload :Inputs, "active_admin/inputs"
|
33
|
+
autoload :Localizers, "active_admin/localizers"
|
34
|
+
autoload :Menu, "active_admin/menu"
|
35
|
+
autoload :MenuCollection, "active_admin/menu_collection"
|
36
|
+
autoload :MenuItem, "active_admin/menu_item"
|
37
|
+
autoload :Namespace, "active_admin/namespace"
|
38
|
+
autoload :OrderClause, "active_admin/order_clause"
|
39
|
+
autoload :Page, "active_admin/page"
|
40
|
+
autoload :PagePresenter, "active_admin/page_presenter"
|
41
|
+
autoload :PageController, "active_admin/page_controller"
|
42
|
+
autoload :PageDSL, "active_admin/page_dsl"
|
43
|
+
autoload :PunditAdapter, "active_admin/pundit_adapter"
|
44
|
+
autoload :Resource, "active_admin/resource"
|
45
|
+
autoload :ResourceController, "active_admin/resource_controller"
|
46
|
+
autoload :ResourceDSL, "active_admin/resource_dsl"
|
47
|
+
autoload :Scope, "active_admin/scope"
|
48
|
+
autoload :ScopeChain, "active_admin/helpers/scope_chain"
|
49
|
+
autoload :SidebarSection, "active_admin/sidebar_section"
|
50
|
+
autoload :TableBuilder, "active_admin/table_builder"
|
51
|
+
autoload :ViewFactory, "active_admin/view_factory"
|
52
|
+
autoload :ViewHelpers, "active_admin/view_helpers"
|
53
|
+
autoload :Views, "active_admin/views"
|
56
54
|
|
57
55
|
class << self
|
58
56
|
|
@@ -62,6 +60,10 @@ module ActiveAdmin
|
|
62
60
|
@application ||= ::ActiveAdmin::Application.new
|
63
61
|
end
|
64
62
|
|
63
|
+
def deprecator
|
64
|
+
@deprecator ||= ActiveSupport::Deprecation.new("4.0", "active-admin")
|
65
|
+
end
|
66
|
+
|
65
67
|
# Gets called within the initializer
|
66
68
|
def setup
|
67
69
|
application.setup!
|
@@ -69,11 +71,11 @@ module ActiveAdmin
|
|
69
71
|
application.prepare!
|
70
72
|
end
|
71
73
|
|
72
|
-
delegate :register,
|
74
|
+
delegate :register, to: :application
|
73
75
|
delegate :register_page, to: :application
|
74
|
-
delegate :unload!,
|
75
|
-
delegate :load!,
|
76
|
-
delegate :routes,
|
76
|
+
delegate :unload!, to: :application
|
77
|
+
delegate :load!, to: :application
|
78
|
+
delegate :routes, to: :application
|
77
79
|
|
78
80
|
# A callback is triggered each time (before) Active Admin loads the configuration files.
|
79
81
|
# In development mode, this will happen whenever the user changes files. In production
|
@@ -113,7 +115,7 @@ module ActiveAdmin
|
|
113
115
|
private
|
114
116
|
|
115
117
|
def wrap_block_for_active_support_notifications block
|
116
|
-
proc { |
|
118
|
+
proc { |_name, _start, _finish, _id, payload| block.call payload[:active_admin_application] }
|
117
119
|
end
|
118
120
|
|
119
121
|
end
|
@@ -121,13 +123,13 @@ module ActiveAdmin
|
|
121
123
|
end
|
122
124
|
|
123
125
|
# Require things that don't support autoload
|
124
|
-
require
|
125
|
-
require
|
126
|
+
require "active_admin/engine"
|
127
|
+
require "active_admin/error"
|
126
128
|
|
127
129
|
# Require internal plugins
|
128
|
-
require
|
129
|
-
require
|
130
|
+
require "active_admin/batch_actions"
|
131
|
+
require "active_admin/filters"
|
130
132
|
|
131
133
|
# Require ORM-specific plugins
|
132
|
-
require
|
133
|
-
require
|
134
|
+
require "active_admin/orm/active_record" if defined? ActiveRecord
|
135
|
+
require "active_admin/orm/mongoid" if defined? Mongoid
|
data/lib/activeadmin.rb
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "active_admin"
|
@@ -1,11 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module ActiveAdmin
|
2
3
|
module Generators
|
3
4
|
class AssetsGenerator < Rails::Generators::Base
|
4
5
|
|
5
|
-
source_root File.expand_path(
|
6
|
+
source_root File.expand_path("templates", __dir__)
|
6
7
|
|
7
8
|
def install_assets
|
8
|
-
template
|
9
|
+
template "active_admin.js", "app/assets/javascripts/active_admin.js"
|
9
10
|
template "active_admin.scss", "app/assets/stylesheets/active_admin.scss"
|
10
11
|
end
|
11
12
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
//
|
1
|
+
// Sass variable overrides must be declared before loading up Active Admin's styles.
|
2
2
|
//
|
3
3
|
// To view the variables that Active Admin provides, take a look at
|
4
4
|
// `app/assets/stylesheets/active_admin/mixins/_variables.scss` in the
|
@@ -11,7 +11,7 @@
|
|
11
11
|
@import "active_admin/mixins";
|
12
12
|
@import "active_admin/base";
|
13
13
|
|
14
|
-
// Overriding any non-variable
|
14
|
+
// Overriding any non-variable Sass must be done after the fact.
|
15
15
|
// For example, to change the default status-tag color:
|
16
16
|
//
|
17
17
|
// .status_tag { background: #6090DB; }
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "active_admin/error"
|
2
3
|
require "active_admin/dependency"
|
3
4
|
|
@@ -7,13 +8,13 @@ module ActiveAdmin
|
|
7
8
|
desc "Creates an admin user and uses Devise for authentication"
|
8
9
|
argument :name, type: :string, default: "AdminUser"
|
9
10
|
|
10
|
-
class_option
|
11
|
-
|
11
|
+
class_option :registerable, type: :boolean, default: false,
|
12
|
+
desc: "Should the generated resource be registerable?"
|
12
13
|
|
13
14
|
RESERVED_NAMES = [:active_admin_user]
|
14
15
|
|
15
|
-
class_option
|
16
|
-
|
16
|
+
class_option :default_user, type: :boolean, default: true,
|
17
|
+
desc: "Should a default user be created inside the migration?"
|
17
18
|
|
18
19
|
def install_devise
|
19
20
|
begin
|
@@ -22,7 +23,7 @@ module ActiveAdmin
|
|
22
23
|
raise ActiveAdmin::GeneratorError, "#{e.message} If you don't want to use devise, run the generator with --skip-users."
|
23
24
|
end
|
24
25
|
|
25
|
-
require
|
26
|
+
require "devise"
|
26
27
|
|
27
28
|
initializer_file =
|
28
29
|
File.join(destination_root, "config", "initializers", "devise.rb")
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "rails/generators/active_record"
|
2
3
|
|
3
4
|
module ActiveAdmin
|
4
5
|
module Generators
|
@@ -8,22 +9,24 @@ module ActiveAdmin
|
|
8
9
|
|
9
10
|
hook_for :users, default: "devise", desc: "Admin user generator to run. Skip with --skip-users"
|
10
11
|
class_option :skip_comments, type: :boolean, default: false, desc: "Skip installation of comments"
|
12
|
+
class_option :use_webpacker, type: :boolean, default: false, desc: "Use Webpacker assets instead of Sprockets"
|
11
13
|
|
12
|
-
source_root File.expand_path(
|
14
|
+
source_root File.expand_path("templates", __dir__)
|
13
15
|
|
14
16
|
def copy_initializer
|
15
|
-
@underscored_user_name = name.underscore.gsub(
|
17
|
+
@underscored_user_name = name.underscore.gsub("/", "_")
|
16
18
|
@use_authentication_method = options[:users].present?
|
17
19
|
@skip_comments = options[:skip_comments]
|
18
|
-
|
20
|
+
@use_webpacker = options[:use_webpacker]
|
21
|
+
template "active_admin.rb.erb", "config/initializers/active_admin.rb"
|
19
22
|
end
|
20
23
|
|
21
24
|
def setup_directory
|
22
25
|
empty_directory "app/admin"
|
23
|
-
template
|
26
|
+
template "dashboard.rb", "app/admin/dashboard.rb"
|
24
27
|
if options[:users].present?
|
25
28
|
@user_class = name
|
26
|
-
template
|
29
|
+
template "admin_users.rb.erb", "app/admin/#{name.underscore.pluralize}.rb"
|
27
30
|
end
|
28
31
|
end
|
29
32
|
|
@@ -36,12 +39,16 @@ module ActiveAdmin
|
|
36
39
|
end
|
37
40
|
|
38
41
|
def create_assets
|
39
|
-
|
42
|
+
if options[:use_webpacker]
|
43
|
+
generate "active_admin:webpacker"
|
44
|
+
else
|
45
|
+
generate "active_admin:assets"
|
46
|
+
end
|
40
47
|
end
|
41
48
|
|
42
49
|
def create_migrations
|
43
50
|
unless options[:skip_comments]
|
44
|
-
migration_template
|
51
|
+
migration_template "migrations/create_active_admin_comments.rb.erb", "db/migrate/create_active_admin_comments.rb"
|
45
52
|
end
|
46
53
|
end
|
47
54
|
end
|
@@ -18,6 +18,23 @@ ActiveAdmin.setup do |config|
|
|
18
18
|
#
|
19
19
|
# config.site_title_image = "logo.png"
|
20
20
|
|
21
|
+
# == Load Paths
|
22
|
+
#
|
23
|
+
# By default Active Admin files go inside app/admin/.
|
24
|
+
# You can change this directory.
|
25
|
+
#
|
26
|
+
# eg:
|
27
|
+
# config.load_paths = [File.join(Rails.root, 'app', 'ui')]
|
28
|
+
#
|
29
|
+
# Or, you can also load more directories.
|
30
|
+
# Useful when setting namespaces with users that are not your main AdminUser entity.
|
31
|
+
#
|
32
|
+
# eg:
|
33
|
+
# config.load_paths = [
|
34
|
+
# File.join(Rails.root, 'app', 'admin'),
|
35
|
+
# File.join(Rails.root, 'app', 'cashier')
|
36
|
+
# ]
|
37
|
+
|
21
38
|
# == Default Namespace
|
22
39
|
#
|
23
40
|
# Set the default namespace each administration resource
|
@@ -241,7 +258,7 @@ ActiveAdmin.setup do |config|
|
|
241
258
|
#
|
242
259
|
# config.namespace :admin do |admin|
|
243
260
|
# admin.build_menu :default do |menu|
|
244
|
-
# menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target:
|
261
|
+
# menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: "_blank" }
|
245
262
|
# end
|
246
263
|
# end
|
247
264
|
|
@@ -294,7 +311,7 @@ ActiveAdmin.setup do |config|
|
|
294
311
|
# config.include_default_association_filters = true
|
295
312
|
|
296
313
|
# 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
|
314
|
+
# config.filter_columns_for_large_association = [
|
298
315
|
# :display_name,
|
299
316
|
# :full_name,
|
300
317
|
# :name,
|
@@ -303,7 +320,7 @@ ActiveAdmin.setup do |config|
|
|
303
320
|
# :title,
|
304
321
|
# :email,
|
305
322
|
# ]
|
306
|
-
# config.filter_method_for_large_association
|
323
|
+
# config.filter_method_for_large_association = '_start'
|
307
324
|
|
308
325
|
# == Head
|
309
326
|
#
|
@@ -325,4 +342,11 @@ ActiveAdmin.setup do |config|
|
|
325
342
|
# You can inherit it with own class and inject it for all resources
|
326
343
|
#
|
327
344
|
# config.order_clause = MyOrderClause
|
345
|
+
|
346
|
+
# == Webpacker
|
347
|
+
#
|
348
|
+
# By default, Active Admin uses Sprocket's asset pipeline.
|
349
|
+
# You can switch to using Webpacker here.
|
350
|
+
#
|
351
|
+
<% unless @use_webpacker %># <% end %>config.use_webpacker = true
|
328
352
|
end
|
@@ -1,7 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module ActiveAdmin
|
2
3
|
module Generators
|
3
4
|
class PageGenerator < Rails::Generators::NamedBase
|
4
|
-
source_root File.expand_path(
|
5
|
+
source_root File.expand_path("templates", __dir__)
|
5
6
|
|
6
7
|
def generate_config_file
|
7
8
|
template "page.rb", "app/admin/#{file_path.tr('/', '_')}.rb"
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "active_admin/generators/boilerplate"
|
2
3
|
|
3
4
|
module ActiveAdmin
|
4
5
|
module Generators
|
@@ -6,9 +7,9 @@ module ActiveAdmin
|
|
6
7
|
desc "Registers resources with Active Admin"
|
7
8
|
|
8
9
|
class_option :include_boilerplate, type: :boolean, default: false,
|
9
|
-
|
10
|
+
desc: "Generate boilerplate code for your resource."
|
10
11
|
|
11
|
-
source_root File.expand_path(
|
12
|
+
source_root File.expand_path("templates", __dir__)
|
12
13
|
|
13
14
|
def generate_config_file
|
14
15
|
@boilerplate = ActiveAdmin::Generators::Boilerplate.new(class_name)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
// Sass variable overrides must be declared before loading up Active Admin's styles.
|
2
|
+
//
|
3
|
+
// To view the variables that Active Admin provides, take a look at
|
4
|
+
// `app/assets/stylesheets/active_admin/mixins/_variables.scss` in the
|
5
|
+
// Active Admin source.
|
6
|
+
//
|
7
|
+
// For example, to change the sidebar width:
|
8
|
+
// $sidebar-width: 242px;
|
9
|
+
|
10
|
+
// Active Admin's got SASS!
|
11
|
+
@import "~@activeadmin/activeadmin/src/scss/mixins";
|
12
|
+
@import "~@activeadmin/activeadmin/src/scss/base";
|
13
|
+
|
14
|
+
// Overriding any non-variable Sass must be done after the fact.
|
15
|
+
// For example, to change the default status-tag color:
|
16
|
+
//
|
17
|
+
// .status_tag { background: #6090DB; }
|