activeadmin 3.4.0 → 4.0.0.beta18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -102
- data/CONTRIBUTING.md +32 -117
- data/README.md +17 -30
- data/UPGRADING.md +241 -0
- data/app/assets/config/active_admin_manifest.js +2 -0
- data/{lib → app/controllers}/active_admin/base_controller/authorization.rb +1 -1
- data/app/controllers/active_admin/base_controller/menu.rb +39 -0
- data/{lib → app/controllers}/active_admin/base_controller.rb +46 -18
- data/{lib → app/controllers}/active_admin/page_controller.rb +0 -4
- data/{lib → app/controllers}/active_admin/resource_controller/action_builder.rb +1 -1
- data/{lib → app/controllers}/active_admin/resource_controller/data_access.rb +11 -6
- data/{lib → app/controllers}/active_admin/resource_controller/scoping.rb +1 -1
- data/{lib → app/controllers}/active_admin/resource_controller/streaming.rb +4 -4
- data/app/controllers/active_admin/resource_controller.rb +102 -0
- data/app/helpers/active_admin/auto_link_helper.rb +66 -0
- data/app/helpers/active_admin/breadcrumb_helper.rb +41 -0
- data/app/helpers/active_admin/display_helper.rb +117 -0
- data/app/helpers/active_admin/form_helper.rb +95 -0
- data/app/helpers/active_admin/index_helper.rb +40 -0
- data/app/helpers/active_admin/layout_helper.rb +63 -0
- data/app/javascript/active_admin/features/batch_actions.js +95 -0
- data/app/javascript/active_admin/features/dark_mode_toggle.js +37 -0
- data/app/javascript/active_admin/features/filters.js +34 -0
- data/app/javascript/active_admin/features/has_many.js +28 -0
- data/app/javascript/active_admin/features/main_menu.js +12 -0
- data/app/javascript/active_admin/features/per_page.js +9 -0
- data/app/javascript/active_admin/utils/dom.js +17 -0
- data/app/javascript/active_admin.js +10 -0
- data/app/views/active_admin/_flash_messages.html.erb +22 -0
- data/app/views/active_admin/_html_head.html.erb +13 -0
- data/app/views/active_admin/_main_navigation.html.erb +28 -0
- data/app/views/active_admin/_page_header.html.erb +27 -0
- data/app/views/active_admin/_sidebar.html.erb +5 -0
- data/app/views/active_admin/_site_footer.html.erb +7 -0
- data/app/views/active_admin/_site_header.html.erb +30 -0
- data/app/views/active_admin/devise/confirmations/new.html.erb +5 -3
- data/app/views/active_admin/devise/passwords/edit.html.erb +5 -3
- data/app/views/active_admin/devise/passwords/new.html.erb +5 -4
- data/app/views/active_admin/devise/registrations/new.html.erb +6 -4
- data/app/views/active_admin/devise/sessions/new.html.erb +6 -4
- data/app/views/active_admin/devise/shared/_links.erb +3 -1
- data/app/views/active_admin/devise/unlocks/new.html.erb +6 -4
- data/app/views/{kaminari/active_admin_countless → active_admin/kaminari}/_gap.html.erb +3 -1
- data/app/views/active_admin/kaminari/_next_page.html.erb +16 -0
- data/app/views/active_admin/kaminari/_page.html.erb +14 -0
- data/app/views/{kaminari/active_admin_countless → active_admin/kaminari}/_paginator.html.erb +1 -2
- data/app/views/active_admin/kaminari/_prev_page.html.erb +16 -0
- data/app/views/active_admin/page/index.html.arb +5 -2
- data/app/views/active_admin/resource/_active_filters.html.erb +32 -0
- data/app/views/active_admin/resource/_batch_actions_dropdown.html.erb +19 -0
- data/app/views/active_admin/resource/_form.html.arb +15 -0
- data/app/views/active_admin/resource/_form_default.html.arb +11 -0
- data/app/views/active_admin/resource/_index_as_table_default.html.arb +8 -0
- data/app/views/active_admin/resource/_index_blank_slate.html.erb +14 -0
- data/app/views/active_admin/resource/_index_empty_results.html.erb +5 -0
- data/app/views/active_admin/resource/_index_table_actions_default.html.erb +9 -0
- data/app/views/active_admin/resource/_show_default.html.arb +2 -0
- data/app/views/active_admin/resource/edit.html.arb +1 -2
- data/app/views/active_admin/resource/index.html.arb +94 -2
- data/app/views/active_admin/resource/new.html.arb +1 -2
- data/app/views/active_admin/resource/show.html.arb +12 -2
- data/app/views/active_admin/shared/_action_items.html.erb +3 -0
- data/app/views/active_admin/shared/_download_format_links.html.erb +7 -0
- data/app/views/active_admin/shared/_resource_comments.html.erb +51 -0
- data/app/views/active_admin/shared/_sidebar_section.html.arb +6 -0
- data/app/views/active_admin/shared/_sidebar_sections.html.erb +5 -0
- data/app/views/layouts/active_admin.html.erb +20 -0
- data/app/views/layouts/active_admin_logged_out.html.erb +8 -45
- data/config/importmap.rb +5 -0
- data/config/locales/ar.yml +136 -116
- data/config/locales/az.yml +103 -118
- data/config/locales/bg.yml +91 -99
- data/config/locales/bs.yml +95 -101
- data/config/locales/ca.yml +131 -86
- data/config/locales/cs.yml +82 -90
- data/config/locales/da.yml +102 -117
- data/config/locales/de.yml +130 -141
- data/config/locales/el.yml +94 -106
- data/config/locales/en-CA.yml +104 -119
- data/config/locales/en-GB.yml +104 -119
- data/config/locales/en.yml +134 -140
- data/config/locales/eo.yml +107 -123
- data/config/locales/es-MX.yml +70 -78
- data/config/locales/es.yml +129 -138
- data/config/locales/fa.yml +91 -99
- data/config/locales/fi.yml +84 -92
- data/config/locales/fr.yml +135 -120
- data/config/locales/he.yml +103 -118
- data/config/locales/hr.yml +95 -103
- data/config/locales/hu.yml +76 -81
- data/config/locales/id.yml +97 -112
- data/config/locales/it.yml +134 -140
- data/config/locales/ja.yml +109 -120
- data/config/locales/ko.yml +136 -101
- data/config/locales/lt.yml +106 -121
- data/config/locales/lv.yml +70 -75
- data/config/locales/mk.yml +100 -114
- data/config/locales/nb.yml +98 -109
- data/config/locales/nl.yml +113 -122
- data/config/locales/pl.yml +137 -146
- data/config/locales/pt-BR.yml +134 -121
- data/config/locales/pt-PT.yml +71 -76
- data/config/locales/ro.yml +74 -79
- data/config/locales/ru.yml +142 -122
- data/config/locales/sk.yml +131 -146
- data/config/locales/sv-SE.yml +126 -141
- data/config/locales/tr.yml +105 -120
- data/config/locales/uk.yml +140 -119
- data/config/locales/vi.yml +125 -140
- data/config/locales/zh-CN.yml +135 -141
- data/config/locales/zh-TW.yml +136 -116
- data/lib/active_admin/application.rb +6 -14
- data/lib/active_admin/application_settings.rb +1 -1
- data/lib/active_admin/async_count.rb +23 -0
- data/lib/active_admin/batch_actions/controller.rb +1 -4
- data/lib/active_admin/batch_actions/resource_extension.rb +8 -15
- data/lib/active_admin/batch_actions/views/batch_action_form.rb +1 -7
- data/lib/active_admin/batch_actions/views/selection_cells.rb +3 -3
- data/lib/active_admin/batch_actions.rb +4 -9
- data/lib/active_admin/callbacks.rb +6 -4
- data/lib/active_admin/collection_decorator.rb +1 -1
- data/lib/active_admin/component.rb +0 -1
- data/lib/active_admin/csv_builder.rb +2 -2
- data/lib/active_admin/devise.rb +3 -3
- data/lib/active_admin/dsl.rb +3 -3
- data/lib/active_admin/dynamic_settings_node.rb +6 -6
- data/lib/active_admin/engine.rb +23 -7
- data/lib/active_admin/filters/active.rb +8 -6
- data/lib/active_admin/filters/active_filter.rb +2 -10
- data/lib/active_admin/filters/forms.rb +1 -45
- data/lib/active_admin/filters/resource_extension.rb +18 -10
- data/lib/active_admin/filters.rb +5 -7
- data/lib/active_admin/form_builder.rb +14 -17
- data/lib/active_admin/helpers/optional_display.rb +1 -1
- data/lib/active_admin/inputs/filters/base/search_method_select.rb +10 -12
- data/lib/active_admin/inputs/filters/base.rb +1 -1
- data/lib/active_admin/inputs/filters/check_boxes_input.rb +1 -6
- data/lib/active_admin/inputs/filters/date_range_input.rb +4 -2
- data/lib/active_admin/inputs.rb +0 -3
- data/lib/active_admin/localizers.rb +1 -1
- data/lib/active_admin/menu.rb +10 -7
- data/lib/active_admin/menu_collection.rb +1 -1
- data/lib/active_admin/menu_item.rb +24 -3
- data/lib/active_admin/namespace.rb +3 -45
- data/lib/active_admin/namespace_settings.rb +3 -36
- data/lib/active_admin/order_clause.rb +4 -1
- data/lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb +4 -76
- data/lib/active_admin/orm/active_record/comments/views.rb +2 -2
- data/lib/active_admin/orm/active_record/comments.rb +13 -8
- data/lib/active_admin/orm/active_record.rb +1 -1
- data/lib/active_admin/pundit_adapter.rb +3 -3
- data/lib/active_admin/resource/action_items.rb +18 -23
- data/lib/active_admin/resource/naming.rb +2 -3
- data/lib/active_admin/resource/page_presenters.rb +2 -2
- data/lib/active_admin/resource/sidebars.rb +1 -1
- data/lib/active_admin/resource.rb +17 -16
- data/lib/active_admin/resource_collection.rb +1 -1
- data/lib/active_admin/resource_dsl.rb +3 -3
- data/lib/active_admin/scope.rb +11 -1
- data/lib/active_admin/settings_node.rb +1 -1
- data/lib/active_admin/sidebar_section.rb +0 -5
- data/lib/active_admin/version.rb +1 -1
- data/lib/active_admin/view_helpers/method_or_proc_helper.rb +1 -1
- data/lib/active_admin/view_helpers.rb +0 -12
- data/lib/active_admin/views/components/active_admin_form.rb +21 -29
- data/lib/active_admin/views/components/attributes_table.rb +14 -16
- data/lib/active_admin/views/components/index_list.rb +10 -23
- data/lib/active_admin/views/components/paginated_collection.rb +34 -39
- data/lib/active_admin/views/components/panel.rb +3 -11
- data/lib/active_admin/views/components/scopes.rb +39 -26
- data/lib/active_admin/views/components/status_tag.rb +22 -19
- data/lib/active_admin/views/components/table_for.rb +25 -25
- data/lib/active_admin/views/index_as_table.rb +39 -101
- data/lib/active_admin.rb +16 -15
- data/lib/activeadmin.rb +1 -1
- data/lib/generators/active_admin/assets/assets_generator.rb +4 -4
- data/lib/generators/active_admin/assets/templates/active_admin.css +3 -0
- data/lib/generators/active_admin/assets/templates/tailwind.config.js +21 -0
- data/lib/generators/active_admin/devise/devise_generator.rb +2 -2
- data/lib/generators/active_admin/install/install_generator.rb +2 -8
- data/lib/generators/active_admin/install/templates/active_admin.rb.erb +10 -87
- data/lib/generators/active_admin/install/templates/dashboard.rb +8 -25
- data/lib/generators/active_admin/page/page_generator.rb +0 -1
- data/lib/generators/active_admin/resource/resource_generator.rb +50 -7
- data/lib/generators/active_admin/resource/templates/resource.rb.erb +42 -0
- data/lib/generators/active_admin/views_generator.rb +18 -0
- data/plugin.js +414 -0
- data/vendor/bundle/offense.rb +1 -0
- data/vendor/javascript/flowbite.js +1 -0
- data/vendor/javascript/rails_ujs_esm.js +1 -0
- metadata +80 -207
- data/app/assets/javascripts/active_admin/base.js +0 -517
- data/app/assets/stylesheets/active_admin/_base.scss +0 -57
- data/app/assets/stylesheets/active_admin/_forms.scss +0 -315
- data/app/assets/stylesheets/active_admin/_header.scss +0 -188
- data/app/assets/stylesheets/active_admin/_mixins.scss +0 -1
- data/app/assets/stylesheets/active_admin/_normalize.scss +0 -349
- data/app/assets/stylesheets/active_admin/_print.scss +0 -287
- data/app/assets/stylesheets/active_admin/_typography.scss +0 -100
- data/app/assets/stylesheets/active_admin/components/_batch_actions.scss +0 -6
- data/app/assets/stylesheets/active_admin/components/_blank_slates.scss +0 -30
- data/app/assets/stylesheets/active_admin/components/_breadcrumbs.scss +0 -20
- data/app/assets/stylesheets/active_admin/components/_buttons.scss +0 -6
- data/app/assets/stylesheets/active_admin/components/_columns.scss +0 -3
- data/app/assets/stylesheets/active_admin/components/_comments.scss +0 -41
- data/app/assets/stylesheets/active_admin/components/_date_picker.scss +0 -148
- data/app/assets/stylesheets/active_admin/components/_dropdown_menu.scss +0 -154
- data/app/assets/stylesheets/active_admin/components/_flash_messages.scss +0 -37
- data/app/assets/stylesheets/active_admin/components/_grid.scss +0 -9
- data/app/assets/stylesheets/active_admin/components/_index_list.scss +0 -12
- data/app/assets/stylesheets/active_admin/components/_links.scss +0 -5
- data/app/assets/stylesheets/active_admin/components/_modal_dialog.scss +0 -34
- data/app/assets/stylesheets/active_admin/components/_pagination.scss +0 -58
- data/app/assets/stylesheets/active_admin/components/_panels.scss +0 -6
- data/app/assets/stylesheets/active_admin/components/_scopes.scss +0 -13
- data/app/assets/stylesheets/active_admin/components/_status_tags.scss +0 -12
- data/app/assets/stylesheets/active_admin/components/_table_tools.scss +0 -70
- data/app/assets/stylesheets/active_admin/components/_tables.scss +0 -112
- data/app/assets/stylesheets/active_admin/components/_tabs.scss +0 -68
- data/app/assets/stylesheets/active_admin/components/_unsupported_browser.scss +0 -16
- data/app/assets/stylesheets/active_admin/mixins/_all.scss +0 -8
- data/app/assets/stylesheets/active_admin/mixins/_buttons.scss +0 -65
- data/app/assets/stylesheets/active_admin/mixins/_gradients.scss +0 -28
- data/app/assets/stylesheets/active_admin/mixins/_rounded.scss +0 -22
- data/app/assets/stylesheets/active_admin/mixins/_sections.scss +0 -41
- data/app/assets/stylesheets/active_admin/mixins/_shadows.scss +0 -15
- data/app/assets/stylesheets/active_admin/mixins/_typography.scss +0 -3
- data/app/assets/stylesheets/active_admin/mixins/_utilities.scss +0 -17
- data/app/assets/stylesheets/active_admin/mixins/_variables.scss +0 -51
- data/app/assets/stylesheets/active_admin/pages/_logged_out.scss +0 -44
- data/app/assets/stylesheets/active_admin/structure/_footer.scss +0 -19
- data/app/assets/stylesheets/active_admin/structure/_main_structure.scss +0 -29
- data/app/assets/stylesheets/active_admin/structure/_title_bar.scss +0 -43
- data/app/javascript/active_admin/base.js +0 -28
- data/app/javascript/active_admin/ext/jquery-ui.js +0 -7
- data/app/javascript/active_admin/ext/jquery.js +0 -9
- data/app/javascript/active_admin/initializers/batch-actions.js +0 -61
- data/app/javascript/active_admin/initializers/checkbox-toggler.js +0 -3
- data/app/javascript/active_admin/initializers/datepicker.js +0 -16
- data/app/javascript/active_admin/initializers/dropdown-menu.js +0 -9
- data/app/javascript/active_admin/initializers/filters.js +0 -10
- data/app/javascript/active_admin/initializers/has-many.js +0 -98
- data/app/javascript/active_admin/initializers/per-page.js +0 -13
- data/app/javascript/active_admin/initializers/table-checkbox-toggler.js +0 -3
- data/app/javascript/active_admin/initializers/tabs.js +0 -6
- data/app/javascript/active_admin/lib/checkbox-toggler.js +0 -49
- data/app/javascript/active_admin/lib/dropdown-menu.js +0 -116
- data/app/javascript/active_admin/lib/filters.js +0 -39
- data/app/javascript/active_admin/lib/modal-dialog.js +0 -63
- data/app/javascript/active_admin/lib/per-page.js +0 -38
- data/app/javascript/active_admin/lib/table-checkbox-toggler.js +0 -38
- data/app/javascript/active_admin/lib/utils.js +0 -40
- data/app/views/kaminari/active_admin/_first_page.html.erb +0 -11
- data/app/views/kaminari/active_admin/_gap.html.erb +0 -8
- data/app/views/kaminari/active_admin/_last_page.html.erb +0 -11
- data/app/views/kaminari/active_admin/_next_page.html.erb +0 -11
- data/app/views/kaminari/active_admin/_page.html.erb +0 -12
- data/app/views/kaminari/active_admin/_paginator.html.erb +0 -25
- data/app/views/kaminari/active_admin/_prev_page.html.erb +0 -11
- data/app/views/kaminari/active_admin_countless/_first_page.html.erb +0 -11
- data/app/views/kaminari/active_admin_countless/_next_page.html.erb +0 -11
- data/app/views/kaminari/active_admin_countless/_page.html.erb +0 -12
- data/app/views/kaminari/active_admin_countless/_prev_page.html.erb +0 -11
- data/app/views/layouts/active_admin.html.arb +0 -2
- data/config/locales/de-CH.yml +0 -94
- data/lib/active_admin/abstract_view_factory.rb +0 -48
- data/lib/active_admin/asset_registration.rb +0 -30
- data/lib/active_admin/base_controller/menu.rb +0 -35
- data/lib/active_admin/batch_actions/views/batch_action_selector.rb +0 -59
- data/lib/active_admin/filters/active_sidebar.rb +0 -28
- data/lib/active_admin/generators/boilerplate.rb +0 -54
- data/lib/active_admin/helpers/collection.rb +0 -21
- data/lib/active_admin/helpers/i18n.rb +0 -8
- data/lib/active_admin/inputs/datepicker_input.rb +0 -28
- data/lib/active_admin/inputs/filters/date_picker_input.rb +0 -14
- data/lib/active_admin/orm/active_record/comments/show_page_helper.rb +0 -24
- data/lib/active_admin/orm/mongoid.rb +0 -2
- data/lib/active_admin/resource_controller/sidebars.rb +0 -19
- data/lib/active_admin/resource_controller.rb +0 -68
- data/lib/active_admin/view_factory.rb +0 -28
- data/lib/active_admin/view_helpers/active_admin_application_helper.rb +0 -13
- data/lib/active_admin/view_helpers/auto_link_helper.rb +0 -46
- data/lib/active_admin/view_helpers/breadcrumb_helper.rb +0 -34
- data/lib/active_admin/view_helpers/display_helper.rb +0 -119
- data/lib/active_admin/view_helpers/download_format_links_helper.rb +0 -60
- data/lib/active_admin/view_helpers/fields_for.rb +0 -51
- data/lib/active_admin/view_helpers/flash_helper.rb +0 -15
- data/lib/active_admin/view_helpers/form_helper.rb +0 -21
- data/lib/active_admin/view_helpers/scope_name_helper.rb +0 -17
- data/lib/active_admin/view_helpers/sidebar_helper.rb +0 -16
- data/lib/active_admin/view_helpers/title_helper.rb +0 -12
- data/lib/active_admin/view_helpers/view_factory_helper.rb +0 -12
- data/lib/active_admin/views/action_items.rb +0 -18
- data/lib/active_admin/views/components/active_filters_sidebar_content.rb +0 -59
- data/lib/active_admin/views/components/blank_slate.rb +0 -18
- data/lib/active_admin/views/components/columns.rb +0 -162
- data/lib/active_admin/views/components/dropdown_menu.rb +0 -69
- data/lib/active_admin/views/components/menu.rb +0 -33
- data/lib/active_admin/views/components/menu_item.rb +0 -59
- data/lib/active_admin/views/components/sidebar.rb +0 -14
- data/lib/active_admin/views/components/sidebar_section.rb +0 -35
- data/lib/active_admin/views/components/site_title.rb +0 -55
- data/lib/active_admin/views/components/tabs.rb +0 -41
- data/lib/active_admin/views/components/unsupported_browser.rb +0 -12
- data/lib/active_admin/views/footer.rb +0 -32
- data/lib/active_admin/views/header.rb +0 -20
- data/lib/active_admin/views/index_as_block.rb +0 -37
- data/lib/active_admin/views/index_as_blog.rb +0 -156
- data/lib/active_admin/views/index_as_grid.rb +0 -81
- data/lib/active_admin/views/pages/base.rb +0 -134
- data/lib/active_admin/views/pages/form.rb +0 -65
- data/lib/active_admin/views/pages/index.rb +0 -166
- data/lib/active_admin/views/pages/layout.rb +0 -27
- data/lib/active_admin/views/pages/page.rb +0 -31
- data/lib/active_admin/views/pages/show.rb +0 -60
- data/lib/active_admin/views/tabbed_navigation.rb +0 -12
- data/lib/active_admin/views/title_bar.rb +0 -56
- data/lib/generators/active_admin/assets/templates/active_admin.js +0 -1
- data/lib/generators/active_admin/assets/templates/active_admin.scss +0 -17
- data/lib/generators/active_admin/resource/templates/admin.rb.erb +0 -46
- data/lib/generators/active_admin/webpacker/plugins/jquery.js +0 -7
- data/lib/generators/active_admin/webpacker/templates/active_admin.js +0 -5
- data/lib/generators/active_admin/webpacker/templates/active_admin.scss +0 -17
- data/lib/generators/active_admin/webpacker/templates/print.scss +0 -2
- data/lib/generators/active_admin/webpacker/webpacker_generator.rb +0 -27
- data/vendor/assets/javascripts/jquery-ui/data.js +0 -45
- data/vendor/assets/javascripts/jquery-ui/disable-selection.js +0 -51
- data/vendor/assets/javascripts/jquery-ui/focusable.js +0 -89
- data/vendor/assets/javascripts/jquery-ui/form-reset-mixin.js +0 -83
- data/vendor/assets/javascripts/jquery-ui/form.js +0 -25
- data/vendor/assets/javascripts/jquery-ui/ie.js +0 -20
- data/vendor/assets/javascripts/jquery-ui/keycode.js +0 -51
- data/vendor/assets/javascripts/jquery-ui/labels.js +0 -71
- data/vendor/assets/javascripts/jquery-ui/plugin.js +0 -49
- data/vendor/assets/javascripts/jquery-ui/position.js +0 -513
- data/vendor/assets/javascripts/jquery-ui/safe-active-element.js +0 -46
- data/vendor/assets/javascripts/jquery-ui/safe-blur.js +0 -27
- data/vendor/assets/javascripts/jquery-ui/scroll-parent.js +0 -50
- data/vendor/assets/javascripts/jquery-ui/tabbable.js +0 -41
- data/vendor/assets/javascripts/jquery-ui/unique-id.js +0 -54
- data/vendor/assets/javascripts/jquery-ui/version.js +0 -20
- data/vendor/assets/javascripts/jquery-ui/widget.js +0 -758
- data/vendor/assets/javascripts/jquery-ui/widgets/button.js +0 -454
- data/vendor/assets/javascripts/jquery-ui/widgets/checkboxradio.js +0 -294
- data/vendor/assets/javascripts/jquery-ui/widgets/controlgroup.js +0 -304
- data/vendor/assets/javascripts/jquery-ui/widgets/datepicker.js +0 -2243
- data/vendor/assets/javascripts/jquery-ui/widgets/dialog.js +0 -971
- data/vendor/assets/javascripts/jquery-ui/widgets/draggable.js +0 -1268
- data/vendor/assets/javascripts/jquery-ui/widgets/mouse.js +0 -241
- data/vendor/assets/javascripts/jquery-ui/widgets/resizable.js +0 -1228
- data/vendor/assets/javascripts/jquery-ui/widgets/sortable.js +0 -1622
- data/vendor/assets/javascripts/jquery-ui/widgets/tabs.js +0 -931
- /data/{lib → app/controllers}/active_admin/resource_controller/decorators.rb +0 -0
- /data/{lib → app/controllers}/active_admin/resource_controller/polymorphic_routes.rb +0 -0
- /data/{lib → app/controllers}/active_admin/resource_controller/resource_class_methods.rb +0 -0
- /data/lib/{active_admin/orm/mongoid/.gitkeep → generators/active_admin/assets/templates/builds/.keep} +0 -0
data/config/locales/zh-TW.yml
CHANGED
|
@@ -1,128 +1,148 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
zh-TW:
|
|
2
3
|
active_admin:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
call_to_action: "要新增儀表板內容,請查看 'app/admin/dashboard.rb'"
|
|
7
|
-
view: "檢視"
|
|
8
|
-
edit: "編輯"
|
|
9
|
-
delete: "刪除"
|
|
10
|
-
delete_confirmation: "你確定要刪除嗎?"
|
|
11
|
-
new_model: "新增 %{model}"
|
|
12
|
-
edit_model: "編輯 %{model}"
|
|
13
|
-
delete_model: "刪除 %{model}"
|
|
14
|
-
details: "%{model} 明細"
|
|
15
|
-
cancel: "取消"
|
|
16
|
-
empty: "空的"
|
|
17
|
-
previous: "前一個"
|
|
18
|
-
next: "下一個"
|
|
19
|
-
download: "下載:"
|
|
20
|
-
has_many_new: "增加新的 %{model}"
|
|
21
|
-
has_many_delete: "刪除"
|
|
22
|
-
has_many_remove: "清除"
|
|
23
|
-
filters:
|
|
24
|
-
buttons:
|
|
25
|
-
filter: "篩選"
|
|
26
|
-
clear: "清除篩選條件"
|
|
27
|
-
search_status:
|
|
28
|
-
headline: "搜尋條件:"
|
|
29
|
-
current_scope: "子集:"
|
|
30
|
-
current_filters: "目前篩選條件:"
|
|
31
|
-
no_current_filters: "無"
|
|
32
|
-
status_tag:
|
|
33
|
-
"yes": "是"
|
|
34
|
-
"no": "否"
|
|
35
|
-
"unset": "否"
|
|
36
|
-
main_content: "請實作 %{model}#main_content 以顯示內容。"
|
|
37
|
-
logout: "登出"
|
|
38
|
-
powered_by: "Powered by %{active_admin} %{version}"
|
|
39
|
-
sidebars:
|
|
40
|
-
filters: "篩選條件"
|
|
41
|
-
search_status: "搜尋條件"
|
|
42
|
-
pagination:
|
|
43
|
-
empty: "找不到 %{model} "
|
|
44
|
-
one: "顯示 <b>1</b> %{model}"
|
|
45
|
-
one_page: "顯示 <b>全部 %{n}</b> %{model}"
|
|
46
|
-
multiple: "總計 <b>%{total}</b> 顯示 %{model} 中<b>%{from} - %{to}</b> 筆"
|
|
47
|
-
multiple_without_total: "顯示 %{model} 中<b>%{from} - %{to}</b> 筆"
|
|
48
|
-
entry:
|
|
49
|
-
one: "筆"
|
|
50
|
-
other: "筆"
|
|
51
|
-
any: "任何"
|
|
52
|
-
blank_slate:
|
|
53
|
-
content: "尚無 %{resource_name}"
|
|
54
|
-
link: "建立一筆"
|
|
55
|
-
dropdown_actions:
|
|
56
|
-
button_label: "操作"
|
|
4
|
+
access_denied:
|
|
5
|
+
message: 你沒有權限執行此項操作
|
|
6
|
+
any: 任何
|
|
57
7
|
batch_actions:
|
|
58
|
-
button_label: "批次作業"
|
|
59
|
-
default_confirmation: "你確定你要這樣做?"
|
|
60
|
-
delete_confirmation: "你確定要刪除這些 %{plural_model} 嗎?"
|
|
61
|
-
succesfully_destroyed:
|
|
62
|
-
one: "成功刪除 1 %{model}"
|
|
63
|
-
other: "成功刪除 %{count} %{plural_model}"
|
|
64
|
-
selection_toggle_explanation: "(切換選取)"
|
|
65
8
|
action_label: "%{title} 已選取"
|
|
9
|
+
button_label: 批次操作
|
|
10
|
+
default_confirmation: 你確定要這樣做嗎?
|
|
11
|
+
delete_confirmation: 你確定要刪除這些 %{plural_model} 嗎?
|
|
66
12
|
labels:
|
|
67
|
-
destroy:
|
|
13
|
+
destroy: 刪除
|
|
14
|
+
selection_toggle_explanation: "(切換選取)"
|
|
15
|
+
successfully_destroyed:
|
|
16
|
+
one: 成功刪除 1 %{model}
|
|
17
|
+
other: 成功刪除 %{count} %{plural_model}
|
|
18
|
+
blank_slate:
|
|
19
|
+
content: 尚無 %{resource_name}。
|
|
20
|
+
link: 建立一筆
|
|
21
|
+
cancel: 取消
|
|
68
22
|
comments:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
delete:
|
|
76
|
-
delete_confirmation:
|
|
77
|
-
resource: "資源"
|
|
78
|
-
no_comments_yet: "尚無評論"
|
|
79
|
-
author_missing: "匿名"
|
|
80
|
-
title_content: "(%{count}) 則評論"
|
|
23
|
+
add: 新增評論
|
|
24
|
+
author: 作者
|
|
25
|
+
author_missing: 匿名
|
|
26
|
+
author_type: 作者身份
|
|
27
|
+
body: 內文
|
|
28
|
+
created_at: 建立時間
|
|
29
|
+
delete: 刪除評論
|
|
30
|
+
delete_confirmation: 你確定要刪除這個評論嗎?
|
|
81
31
|
errors:
|
|
82
|
-
empty_text:
|
|
32
|
+
empty_text: 評論儲存失敗,不允許空白的內容。
|
|
33
|
+
no_comments_yet: 尚無評論
|
|
34
|
+
resource: 資源
|
|
35
|
+
resource_type: 資源類型
|
|
36
|
+
title_content: "%{count} 則評論"
|
|
37
|
+
create_another: 新增另一個 %{model}
|
|
38
|
+
dashboard: 儀表板
|
|
39
|
+
delete: 刪除
|
|
40
|
+
delete_confirmation: 你確定要刪除嗎?
|
|
41
|
+
delete_model: 刪除 %{model}
|
|
42
|
+
details: "%{model} 明細"
|
|
83
43
|
devise:
|
|
84
|
-
|
|
85
|
-
|
|
44
|
+
change_password:
|
|
45
|
+
submit: 更改我的密碼
|
|
46
|
+
title: 更改你的密碼
|
|
86
47
|
email:
|
|
87
|
-
title:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
48
|
+
title: 電子郵件信箱
|
|
49
|
+
links:
|
|
50
|
+
forgot_your_password: 忘記密碼?
|
|
51
|
+
resend_confirmation_instructions: 重新發送確認信
|
|
52
|
+
resend_unlock_instructions: 重新發送解鎖指示
|
|
53
|
+
sign_in: 登入
|
|
54
|
+
sign_in_with_omniauth_provider: 使用 %{provider} 登入
|
|
55
|
+
sign_up: 註冊
|
|
95
56
|
login:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
57
|
+
remember_me: 記住我
|
|
58
|
+
submit: 登入
|
|
59
|
+
title: 登入
|
|
60
|
+
password:
|
|
61
|
+
title: 密碼
|
|
62
|
+
password_confirmation:
|
|
63
|
+
title: 確認密碼
|
|
64
|
+
resend_confirmation_instructions:
|
|
65
|
+
submit: 重新發送確認信
|
|
66
|
+
title: 重新發送確認信
|
|
99
67
|
reset_password:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
68
|
+
submit: 重設密碼
|
|
69
|
+
title: 忘記密碼?
|
|
70
|
+
sign_up:
|
|
71
|
+
submit: 註冊
|
|
72
|
+
title: 註冊
|
|
73
|
+
subdomain:
|
|
74
|
+
title: 子網域
|
|
105
75
|
unlock:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
title:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
76
|
+
submit: 重新發送解鎖指示
|
|
77
|
+
title: 重新發送解鎖指示
|
|
78
|
+
username:
|
|
79
|
+
title: 帳號
|
|
80
|
+
download: 下載:
|
|
81
|
+
edit: 編輯
|
|
82
|
+
edit_model: 編輯 %{model}
|
|
83
|
+
empty: 空的
|
|
84
|
+
filters:
|
|
85
|
+
buttons:
|
|
86
|
+
clear: 清除篩選條件
|
|
87
|
+
filter: 篩選
|
|
88
|
+
predicates:
|
|
89
|
+
from: 從
|
|
90
|
+
to: 到
|
|
91
|
+
has_many_delete: 刪除
|
|
92
|
+
has_many_new: 增加新的 %{model}
|
|
93
|
+
has_many_remove: 移除
|
|
124
94
|
index_list:
|
|
125
|
-
table:
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
95
|
+
table: 表格
|
|
96
|
+
logout: 登出
|
|
97
|
+
move: 移動
|
|
98
|
+
new_model: 新增 %{model}
|
|
99
|
+
next: 下一個
|
|
100
|
+
pagination:
|
|
101
|
+
empty: 找不到 %{model}
|
|
102
|
+
entry:
|
|
103
|
+
one: 筆
|
|
104
|
+
other: 筆
|
|
105
|
+
multiple: 總計 <b>%{total}</b> 顯示 %{model} 中<b>%{from} - %{to}</b> 筆
|
|
106
|
+
multiple_without_total: 顯示 %{model} 中<b>%{from} - %{to}</b> 筆
|
|
107
|
+
next: 下一個
|
|
108
|
+
one: 顯示 <b>1</b> %{model}
|
|
109
|
+
one_page: 顯示 <b>全部 %{n}</b> %{model}
|
|
110
|
+
per_page: '每頁 '
|
|
111
|
+
previous: 前一個
|
|
112
|
+
truncate: "…"
|
|
113
|
+
powered_by: 由 %{active_admin} %{version} 提供
|
|
114
|
+
previous: 前一個
|
|
115
|
+
scopes:
|
|
116
|
+
all: 全部
|
|
117
|
+
search_status:
|
|
118
|
+
no_current_filters: 未套用篩選條件
|
|
119
|
+
title: 進行中的搜尋
|
|
120
|
+
title_with_scope: 正在搜尋 %{name}
|
|
121
|
+
sidebars:
|
|
122
|
+
filters: 篩選條件
|
|
123
|
+
search_status: 搜尋狀態
|
|
124
|
+
status_tag:
|
|
125
|
+
'no': 否
|
|
126
|
+
unset: 未知
|
|
127
|
+
'yes': 是
|
|
128
|
+
toggle_dark_mode: 切換暗黑模式
|
|
129
|
+
toggle_main_navigation_menu: 切換主要導覽
|
|
130
|
+
toggle_section: 切換區塊
|
|
131
|
+
toggle_user_menu: 切換使用者選單
|
|
132
|
+
view: 檢視
|
|
133
|
+
activerecord:
|
|
134
|
+
attributes:
|
|
135
|
+
active_admin/comment:
|
|
136
|
+
author_type: 作者類型
|
|
137
|
+
body: 內容
|
|
138
|
+
created_at: 建立時間
|
|
139
|
+
namespace: 命名空間
|
|
140
|
+
resource_type: 資源類型
|
|
141
|
+
updated_at: 更新時間
|
|
142
|
+
models:
|
|
143
|
+
active_admin/comment:
|
|
144
|
+
one: 評論
|
|
145
|
+
other: 評論
|
|
146
|
+
comment:
|
|
147
|
+
one: 評論
|
|
148
|
+
other: 評論
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
require_relative "router"
|
|
3
|
+
require_relative "application_settings"
|
|
4
|
+
require_relative "namespace_settings"
|
|
5
5
|
|
|
6
6
|
module ActiveAdmin
|
|
7
7
|
class Application
|
|
@@ -43,15 +43,12 @@ module ActiveAdmin
|
|
|
43
43
|
@namespaces = Namespace::Store.new
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
-
include AssetRegistration
|
|
47
|
-
|
|
48
46
|
# Event that gets triggered on load of Active Admin
|
|
49
47
|
BeforeLoadEvent = "active_admin.application.before_load".freeze
|
|
50
48
|
AfterLoadEvent = "active_admin.application.after_load".freeze
|
|
51
49
|
|
|
52
50
|
# Runs before the app's AA initializer
|
|
53
51
|
def setup!
|
|
54
|
-
register_default_assets
|
|
55
52
|
end
|
|
56
53
|
|
|
57
54
|
# Runs after the app's AA initializer
|
|
@@ -104,7 +101,7 @@ module ActiveAdmin
|
|
|
104
101
|
# Removes all defined controllers from memory. Useful in
|
|
105
102
|
# development, where they are reloaded on each request.
|
|
106
103
|
def unload!
|
|
107
|
-
namespaces.each
|
|
104
|
+
namespaces.each(&:unload!)
|
|
108
105
|
@@loaded = false
|
|
109
106
|
end
|
|
110
107
|
|
|
@@ -148,7 +145,7 @@ module ActiveAdmin
|
|
|
148
145
|
# ActiveAdmin.before_action :authenticate_admin!
|
|
149
146
|
#
|
|
150
147
|
AbstractController::Callbacks::ClassMethods.public_instance_methods.
|
|
151
|
-
select { |m| m.
|
|
148
|
+
select { |m| m.end_with?('_action') }.each do |name|
|
|
152
149
|
define_method name do |*args, &block|
|
|
153
150
|
ActiveSupport.on_load(:active_admin_controller) do
|
|
154
151
|
public_send name, *args, &block
|
|
@@ -158,17 +155,12 @@ module ActiveAdmin
|
|
|
158
155
|
|
|
159
156
|
def controllers_for_filters
|
|
160
157
|
controllers = [BaseController]
|
|
161
|
-
controllers.push
|
|
158
|
+
controllers.push(*Devise.controllers_for_filters) if Dependency.devise?
|
|
162
159
|
controllers
|
|
163
160
|
end
|
|
164
161
|
|
|
165
162
|
private
|
|
166
163
|
|
|
167
|
-
def register_default_assets
|
|
168
|
-
register_stylesheet "active_admin.css", media: "all"
|
|
169
|
-
register_javascript "active_admin.js"
|
|
170
|
-
end
|
|
171
|
-
|
|
172
164
|
# Since app/admin is alphabetically before app/models, we have to remove it
|
|
173
165
|
# from the host app's +autoload_paths+ to prevent missing constant errors.
|
|
174
166
|
#
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module ActiveAdmin
|
|
3
|
+
class AsyncCount
|
|
4
|
+
class NotSupportedError < RuntimeError; end
|
|
5
|
+
|
|
6
|
+
def initialize(collection)
|
|
7
|
+
raise NotSupportedError, "#{collection.inspect} does not support :async_count" unless collection.respond_to?(:async_count)
|
|
8
|
+
|
|
9
|
+
@collection = collection.except(:select, :order)
|
|
10
|
+
@promise = @collection.async_count
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def count
|
|
14
|
+
value = @promise.value
|
|
15
|
+
# value.value due to Rails bug https://github.com/rails/rails/issues/50776
|
|
16
|
+
value.respond_to?(:value) ? value.value : value
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
alias size count
|
|
20
|
+
|
|
21
|
+
delegate :except, :group_values, :length, :limit_value, to: :@collection
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -2,14 +2,11 @@
|
|
|
2
2
|
module ActiveAdmin
|
|
3
3
|
module BatchActions
|
|
4
4
|
module Controller
|
|
5
|
-
|
|
6
5
|
# Controller action that is called when submitting the batch action form
|
|
7
6
|
def batch_action
|
|
8
7
|
if action_present?
|
|
9
8
|
selection = params[:collection_selection] || []
|
|
10
|
-
inputs = JSON.parse
|
|
11
|
-
valid_keys = MethodOrProcHelper.render_in_context(self, current_batch_action.inputs).try(:keys)
|
|
12
|
-
inputs = inputs.with_indifferent_access.slice *valid_keys
|
|
9
|
+
inputs = JSON.parse(params[:batch_action_inputs].presence || "{}")
|
|
13
10
|
instance_exec selection, inputs, ¤t_batch_action.block
|
|
14
11
|
else
|
|
15
12
|
raise "Couldn't find batch action \"#{params[:batch_action]}\""
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
module ActiveAdmin
|
|
3
|
-
|
|
4
3
|
module BatchActions
|
|
5
4
|
module ResourceExtension
|
|
6
5
|
def initialize(*)
|
|
@@ -59,7 +58,7 @@ module ActiveAdmin
|
|
|
59
58
|
destroy_options = {
|
|
60
59
|
priority: 100,
|
|
61
60
|
confirm: proc { I18n.t("active_admin.batch_actions.delete_confirmation", plural_model: active_admin_config.plural_resource_label.downcase) },
|
|
62
|
-
if: proc {
|
|
61
|
+
if: proc { destroy_action_authorized?(active_admin_config.resource_class) }
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
add_batch_action :destroy, proc { I18n.t("active_admin.delete") }, destroy_options do |selected_ids|
|
|
@@ -70,7 +69,7 @@ module ActiveAdmin
|
|
|
70
69
|
|
|
71
70
|
redirect_to active_admin_config.route_collection_path(params),
|
|
72
71
|
notice: I18n.t(
|
|
73
|
-
"active_admin.batch_actions.
|
|
72
|
+
"active_admin.batch_actions.successfully_destroyed",
|
|
74
73
|
count: selected_ids.count,
|
|
75
74
|
model: active_admin_config.resource_label.downcase,
|
|
76
75
|
plural_model: active_admin_config.plural_resource_label(count: selected_ids.count).downcase)
|
|
@@ -84,7 +83,7 @@ module ActiveAdmin
|
|
|
84
83
|
|
|
85
84
|
include Comparable
|
|
86
85
|
|
|
87
|
-
attr_reader :block, :title, :sym
|
|
86
|
+
attr_reader :block, :title, :sym, :partial, :link_html_options
|
|
88
87
|
|
|
89
88
|
DEFAULT_CONFIRM_MESSAGE = proc { I18n.t "active_admin.batch_actions.default_confirmation" }
|
|
90
89
|
|
|
@@ -96,7 +95,7 @@ module ActiveAdmin
|
|
|
96
95
|
# => Will create an action that appears in the action list popover
|
|
97
96
|
#
|
|
98
97
|
# BatchAction.new(:flag) { |selection| redirect_to collection_path, notice: "#{selection.length} users flagged" }
|
|
99
|
-
# => Will create an action that uses a block to process the request (which receives one
|
|
98
|
+
# => Will create an action that uses a block to process the request (which receives one parameter of the selected objects)
|
|
100
99
|
#
|
|
101
100
|
# BatchAction.new("Perform Long Operation on") { |selection| }
|
|
102
101
|
# => You can create batch actions with a title instead of a Symbol
|
|
@@ -110,8 +109,8 @@ module ActiveAdmin
|
|
|
110
109
|
# BatchAction.new(:flag, confirm: "Are you sure?") { |selection| }
|
|
111
110
|
# => You can pass a custom confirmation message through `:confirm`
|
|
112
111
|
#
|
|
113
|
-
# BatchAction.new(:flag,
|
|
114
|
-
# =>
|
|
112
|
+
# BatchAction.new(:flag, partial: "flag_form", link_html_options: { "data-modal-target": "modal-id", "data-modal-show": "modal-id" }) { |selection, inputs| }
|
|
113
|
+
# => Pass a partial that contains a modal and with a data attribute that opens the modal with the form for the user to fill out.
|
|
115
114
|
#
|
|
116
115
|
def initialize(sym, title, options = {}, &block)
|
|
117
116
|
@sym = sym
|
|
@@ -119,23 +118,19 @@ module ActiveAdmin
|
|
|
119
118
|
@options = options
|
|
120
119
|
@block = block
|
|
121
120
|
@confirm = options[:confirm]
|
|
121
|
+
@partial = options[:partial]
|
|
122
|
+
@link_html_options = options[:link_html_options] || {}
|
|
122
123
|
@block ||= proc {}
|
|
123
124
|
end
|
|
124
125
|
|
|
125
126
|
def confirm
|
|
126
127
|
if @confirm == true
|
|
127
128
|
DEFAULT_CONFIRM_MESSAGE
|
|
128
|
-
elsif !@confirm && @options[:form]
|
|
129
|
-
DEFAULT_CONFIRM_MESSAGE
|
|
130
129
|
else
|
|
131
130
|
@confirm
|
|
132
131
|
end
|
|
133
132
|
end
|
|
134
133
|
|
|
135
|
-
def inputs
|
|
136
|
-
@options[:form]
|
|
137
|
-
end
|
|
138
|
-
|
|
139
134
|
# Returns the display if block. If the block was not explicitly defined
|
|
140
135
|
# a default block always returning true will be returned.
|
|
141
136
|
def display_if_block
|
|
@@ -151,7 +146,5 @@ module ActiveAdmin
|
|
|
151
146
|
def <=>(other)
|
|
152
147
|
self.priority <=> other.priority
|
|
153
148
|
end
|
|
154
|
-
|
|
155
149
|
end
|
|
156
|
-
|
|
157
150
|
end
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
2
|
+
require_relative "../../component"
|
|
3
3
|
|
|
4
4
|
module ActiveAdmin
|
|
5
5
|
module BatchActions
|
|
6
|
-
|
|
7
6
|
# Build a BatchActionForm
|
|
8
7
|
class BatchActionForm < ActiveAdmin::Component
|
|
9
|
-
builder_method :batch_action_form
|
|
10
|
-
|
|
11
|
-
attr_reader :prefix_html
|
|
12
|
-
|
|
13
8
|
def build(options = {}, &block)
|
|
14
9
|
options[:id] ||= "collection_selection"
|
|
15
10
|
|
|
@@ -33,7 +28,6 @@ module ActiveAdmin
|
|
|
33
28
|
def closing_form_tag
|
|
34
29
|
"</form>".html_safe
|
|
35
30
|
end
|
|
36
|
-
|
|
37
31
|
end
|
|
38
32
|
end
|
|
39
33
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
2
|
+
require_relative "../../component"
|
|
3
3
|
|
|
4
4
|
module ActiveAdmin
|
|
5
5
|
module BatchActions
|
|
@@ -10,7 +10,7 @@ module ActiveAdmin
|
|
|
10
10
|
|
|
11
11
|
def build(label_text = "")
|
|
12
12
|
label do
|
|
13
|
-
input type: "checkbox", id: "collection_selection_toggle_all", name: "collection_selection_toggle_all", class: "
|
|
13
|
+
input type: "checkbox", id: "collection_selection_toggle_all", name: "collection_selection_toggle_all", class: "batch-actions-toggle-all"
|
|
14
14
|
text_node label_text if label_text.present?
|
|
15
15
|
end
|
|
16
16
|
end
|
|
@@ -21,7 +21,7 @@ module ActiveAdmin
|
|
|
21
21
|
builder_method :resource_selection_cell
|
|
22
22
|
|
|
23
23
|
def build(resource)
|
|
24
|
-
input type: "checkbox", id: "batch_action_item_#{resource.id}", value: resource.id, class: "
|
|
24
|
+
input type: "checkbox", id: "batch_action_item_#{resource.id}", value: resource.id, class: "batch-actions-resource-selection", name: "collection_selection[]"
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
ActiveAdmin.before_load do |app|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
require_relative "batch_actions/resource_extension"
|
|
4
|
+
require_relative "batch_actions/controller"
|
|
5
5
|
|
|
6
6
|
# Add our Extensions
|
|
7
7
|
ActiveAdmin::Resource.send :include, ActiveAdmin::BatchActions::ResourceExtension
|
|
8
8
|
ActiveAdmin::ResourceController.send :include, ActiveAdmin::BatchActions::Controller
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
require "active_admin/batch_actions/views/selection_cells"
|
|
13
|
-
require "active_admin/batch_actions/views/batch_action_selector"
|
|
14
|
-
|
|
15
|
-
# Register the views with the view factory
|
|
16
|
-
app.view_factory.register batch_action_selector: ActiveAdmin::BatchActions::BatchActionSelector
|
|
10
|
+
require_relative "batch_actions/views/batch_action_form"
|
|
11
|
+
require_relative "batch_actions/views/selection_cells"
|
|
17
12
|
end
|
|
@@ -3,6 +3,8 @@ module ActiveAdmin
|
|
|
3
3
|
module Callbacks
|
|
4
4
|
extend ActiveSupport::Concern
|
|
5
5
|
|
|
6
|
+
CALLBACK_TYPES = %i[before after].freeze
|
|
7
|
+
|
|
6
8
|
private
|
|
7
9
|
|
|
8
10
|
# Simple callback system. Implements before and after callbacks for
|
|
@@ -58,7 +60,7 @@ module ActiveAdmin
|
|
|
58
60
|
#
|
|
59
61
|
def define_active_admin_callbacks(*names)
|
|
60
62
|
names.each do |name|
|
|
61
|
-
|
|
63
|
+
CALLBACK_TYPES.each do |type|
|
|
62
64
|
callback_name = "#{type}_#{name}_callbacks"
|
|
63
65
|
callback_ivar = "@#{callback_name}"
|
|
64
66
|
|
|
@@ -75,10 +77,10 @@ module ActiveAdmin
|
|
|
75
77
|
end
|
|
76
78
|
|
|
77
79
|
# def run_create_callbacks
|
|
78
|
-
define_method "run_#{name}_callbacks" do |*args, &block|
|
|
79
|
-
self.class.send("before_#{name}_callbacks").each { |cbk| run_callback(cbk, *args) }
|
|
80
|
+
define_method :"run_#{name}_callbacks" do |*args, &block|
|
|
81
|
+
self.class.send(:"before_#{name}_callbacks").each { |cbk| run_callback(cbk, *args) }
|
|
80
82
|
value = block.try :call
|
|
81
|
-
self.class.send("after_#{name}_callbacks").each { |cbk| run_callback(cbk, *args) }
|
|
83
|
+
self.class.send(:"after_#{name}_callbacks").each { |cbk| run_callback(cbk, *args) }
|
|
82
84
|
return value
|
|
83
85
|
end
|
|
84
86
|
send :private, "run_#{name}_callbacks"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
module ActiveAdmin
|
|
3
3
|
# This class decorates a collection of objects delegating
|
|
4
|
-
#
|
|
4
|
+
# methods to behave like an Array. It's used to decouple ActiveAdmin
|
|
5
5
|
# from Draper and thus being able to use PORO decorators as well.
|
|
6
6
|
#
|
|
7
7
|
# It's implementation is heavily based on the Draper::CollectionDecorator
|
|
@@ -64,7 +64,7 @@ module ActiveAdmin
|
|
|
64
64
|
def exec_columns(view_context = nil)
|
|
65
65
|
@view_context = view_context
|
|
66
66
|
@columns = [] # we want to re-render these every instance
|
|
67
|
-
instance_exec
|
|
67
|
+
instance_exec(&@block) if @block.present?
|
|
68
68
|
columns
|
|
69
69
|
end
|
|
70
70
|
|
|
@@ -129,7 +129,7 @@ module ActiveAdmin
|
|
|
129
129
|
module Sanitizer
|
|
130
130
|
extend self
|
|
131
131
|
|
|
132
|
-
ATTACK_CHARACTERS = [
|
|
132
|
+
ATTACK_CHARACTERS = ['=', '+', '-', '@', "\t", "\r"].freeze
|
|
133
133
|
|
|
134
134
|
def sanitize(value)
|
|
135
135
|
return "'#{value}" if require_sanitization?(value)
|
data/lib/active_admin/devise.rb
CHANGED
|
@@ -10,8 +10,7 @@ module ActiveAdmin
|
|
|
10
10
|
{
|
|
11
11
|
path: ActiveAdmin.application.default_namespace || "/",
|
|
12
12
|
controllers: ActiveAdmin::Devise.controllers,
|
|
13
|
-
path_names: { sign_in: "login", sign_out: "logout" }
|
|
14
|
-
sign_out_via: [*::Devise.sign_out_via, ActiveAdmin.application.logout_link_method].uniq
|
|
13
|
+
path_names: { sign_in: "login", sign_out: "logout" }
|
|
15
14
|
}
|
|
16
15
|
end
|
|
17
16
|
|
|
@@ -29,7 +28,8 @@ module ActiveAdmin
|
|
|
29
28
|
extend ::ActiveSupport::Concern
|
|
30
29
|
included do
|
|
31
30
|
layout "active_admin_logged_out"
|
|
32
|
-
helper ::ActiveAdmin::
|
|
31
|
+
helper ::ActiveAdmin::LayoutHelper
|
|
32
|
+
helper ::ActiveAdmin::FormHelper
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
# Redirect to the default namespace on logout
|
data/lib/active_admin/dsl.rb
CHANGED
|
@@ -13,7 +13,7 @@ module ActiveAdmin
|
|
|
13
13
|
|
|
14
14
|
# Runs the registration block inside this object
|
|
15
15
|
def run_registration_block(&block)
|
|
16
|
-
instance_exec
|
|
16
|
+
instance_exec(&block) if block
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
# The instance of ActiveAdmin::Resource that's being registered
|
|
@@ -30,7 +30,7 @@ module ActiveAdmin
|
|
|
30
30
|
@config
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
# Include a module with this resource. The modules'
|
|
33
|
+
# Include a module with this resource. The modules' `included` method
|
|
34
34
|
# is called with the instance of the `ActiveAdmin::DSL` passed into it.
|
|
35
35
|
#
|
|
36
36
|
# eg:
|
|
@@ -72,7 +72,7 @@ module ActiveAdmin
|
|
|
72
72
|
# end
|
|
73
73
|
#
|
|
74
74
|
def controller(&block)
|
|
75
|
-
@config.controller.class_exec(&block) if
|
|
75
|
+
@config.controller.class_exec(&block) if block
|
|
76
76
|
@config.controller
|
|
77
77
|
end
|
|
78
78
|
|