activeadmin 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activeadmin might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/CHANGELOG.md +546 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/CONTRIBUTING.md +217 -0
- data/LICENSE +20 -0
- data/README.md +110 -0
- data/app/assets/images/active_admin/nested_menu_arrow.gif +0 -0
- data/app/assets/images/active_admin/nested_menu_arrow_dark.gif +0 -0
- data/app/assets/images/active_admin/orderable.png +0 -0
- 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/_base.scss +41 -0
- data/app/assets/stylesheets/active_admin/_forms.scss +326 -0
- data/app/assets/stylesheets/active_admin/_header.scss +156 -0
- data/app/assets/stylesheets/active_admin/_mixins.scss +1 -0
- data/app/assets/stylesheets/active_admin/_typography.scss +100 -0
- data/app/assets/stylesheets/active_admin/components/_batch_actions.scss +6 -0
- data/app/assets/stylesheets/active_admin/components/_blank_slates.scss +30 -0
- data/app/assets/stylesheets/active_admin/components/_breadcrumbs.scss +20 -0
- data/app/assets/stylesheets/active_admin/components/_buttons.scss +6 -0
- data/app/assets/stylesheets/active_admin/components/_columns.scss +3 -0
- data/app/assets/stylesheets/active_admin/components/_comments.scss +41 -0
- data/app/assets/stylesheets/active_admin/components/_date_picker.scss +149 -0
- data/app/assets/stylesheets/active_admin/components/_dropdown_menu.scss +152 -0
- data/app/assets/stylesheets/active_admin/components/_flash_messages.scss +37 -0
- data/app/assets/stylesheets/active_admin/components/_grid.scss +9 -0
- data/app/assets/stylesheets/active_admin/components/_index_list.scss +12 -0
- data/app/assets/stylesheets/active_admin/components/_links.scss +5 -0
- data/app/assets/stylesheets/active_admin/components/_modal_dialog.scss +34 -0
- data/app/assets/stylesheets/active_admin/components/_pagination.scss +55 -0
- data/app/assets/stylesheets/active_admin/components/_panels.scss +6 -0
- data/app/assets/stylesheets/active_admin/components/_scopes.scss +13 -0
- data/app/assets/stylesheets/active_admin/components/_status_tags.scss +12 -0
- data/app/assets/stylesheets/active_admin/components/_table_tools.scss +67 -0
- data/app/assets/stylesheets/active_admin/components/_tables.scss +113 -0
- data/app/assets/stylesheets/active_admin/components/_tabs.scss +65 -0
- data/app/assets/stylesheets/active_admin/components/_unsupported_browser.scss +16 -0
- data/app/assets/stylesheets/active_admin/mixins/_all.scss +8 -0
- data/app/assets/stylesheets/active_admin/mixins/_buttons.scss +65 -0
- data/app/assets/stylesheets/active_admin/mixins/_gradients.scss +28 -0
- data/app/assets/stylesheets/active_admin/mixins/_rounded.scss +22 -0
- data/app/assets/stylesheets/active_admin/mixins/_sections.scss +41 -0
- data/app/assets/stylesheets/active_admin/mixins/_shadows.scss +15 -0
- data/app/assets/stylesheets/active_admin/mixins/_typography.scss +3 -0
- data/app/assets/stylesheets/active_admin/mixins/_utilities.scss +17 -0
- data/app/assets/stylesheets/active_admin/mixins/_variables.scss +34 -0
- data/app/assets/stylesheets/active_admin/pages/_logged_out.scss +44 -0
- data/app/assets/stylesheets/active_admin/print.scss +287 -0
- data/app/assets/stylesheets/active_admin/structure/_footer.scss +14 -0
- data/app/assets/stylesheets/active_admin/structure/_main_structure.scss +29 -0
- data/app/assets/stylesheets/active_admin/structure/_title_bar.scss +41 -0
- data/app/views/active_admin/devise/confirmations/new.html.erb +15 -0
- data/app/views/active_admin/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/active_admin/devise/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/active_admin/devise/passwords/edit.html.erb +18 -0
- data/app/views/active_admin/devise/passwords/new.html.erb +15 -0
- data/app/views/active_admin/devise/registrations/new.html.erb +21 -0
- data/app/views/active_admin/devise/sessions/new.html.erb +20 -0
- data/app/views/active_admin/devise/shared/_error_messages.html.erb +15 -0
- data/app/views/active_admin/devise/shared/_links.erb +33 -0
- data/app/views/active_admin/devise/unlocks/new.html.erb +15 -0
- 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/kaminari/active_admin/_first_page.html.erb +11 -0
- data/app/views/kaminari/active_admin/_gap.html.erb +8 -0
- data/app/views/kaminari/active_admin/_last_page.html.erb +11 -0
- data/app/views/kaminari/active_admin/_next_page.html.erb +11 -0
- data/app/views/kaminari/active_admin/_page.html.erb +12 -0
- data/app/views/kaminari/active_admin/_paginator.html.erb +25 -0
- data/app/views/kaminari/active_admin/_prev_page.html.erb +11 -0
- data/app/views/layouts/active_admin.html.arb +1 -0
- data/app/views/layouts/active_admin_logged_out.html.erb +39 -0
- data/config/locales/ar.yml +135 -0
- data/config/locales/bg.yml +119 -0
- data/config/locales/bs.yml +121 -0
- data/config/locales/ca.yml +106 -0
- data/config/locales/cs.yml +109 -0
- data/config/locales/da.yml +137 -0
- data/config/locales/de-CH.yml +101 -0
- data/config/locales/de.yml +144 -0
- data/config/locales/el.yml +126 -0
- data/config/locales/en-CA.yml +139 -0
- data/config/locales/en-GB.yml +139 -0
- data/config/locales/en.yml +162 -0
- data/config/locales/eo.yml +145 -0
- data/config/locales/es-MX.yml +96 -0
- data/config/locales/es.yml +162 -0
- data/config/locales/fa.yml +119 -0
- data/config/locales/fi.yml +112 -0
- data/config/locales/fr.yml +141 -0
- data/config/locales/he.yml +141 -0
- data/config/locales/hr.yml +123 -0
- data/config/locales/hu.yml +102 -0
- data/config/locales/id.yml +135 -0
- data/config/locales/it.yml +144 -0
- data/config/locales/ja.yml +141 -0
- data/config/locales/ko.yml +120 -0
- data/config/locales/lt.yml +142 -0
- data/config/locales/lv.yml +92 -0
- data/config/locales/mk.yml +134 -0
- data/config/locales/nb.yml +130 -0
- data/config/locales/nl.yml +144 -0
- data/config/locales/pl.yml +168 -0
- data/config/locales/pt-BR.yml +143 -0
- data/config/locales/pt-PT.yml +92 -0
- data/config/locales/ro.yml +96 -0
- data/config/locales/ru.yml +141 -0
- data/config/locales/sk.yml +109 -0
- data/config/locales/sv-SE.yml +135 -0
- data/config/locales/tr.yml +144 -0
- data/config/locales/uk.yml +138 -0
- data/config/locales/vi.yml +134 -0
- data/config/locales/zh-CN.yml +143 -0
- data/config/locales/zh-TW.yml +135 -0
- data/docs/.gitignore +1 -0
- data/docs/0-installation.md +118 -0
- data/docs/1-general-configuration.md +204 -0
- data/docs/10-custom-pages.md +150 -0
- data/docs/11-decorators.md +59 -0
- data/docs/12-arbre-components.md +214 -0
- data/docs/13-authorization-adapter.md +285 -0
- data/docs/14-gotchas.md +138 -0
- data/docs/2-resource-customization.md +466 -0
- data/docs/3-index-pages.md +328 -0
- data/docs/3-index-pages/custom-index.md +35 -0
- data/docs/3-index-pages/index-as-block.md +19 -0
- data/docs/3-index-pages/index-as-blog.md +69 -0
- data/docs/3-index-pages/index-as-grid.md +27 -0
- data/docs/3-index-pages/index-as-table.md +227 -0
- data/docs/4-csv-format.md +74 -0
- data/docs/5-forms.md +232 -0
- data/docs/6-show-pages.md +81 -0
- data/docs/7-sidebars.md +75 -0
- data/docs/8-custom-actions.md +177 -0
- data/docs/9-batch-actions.md +237 -0
- data/docs/CNAME +1 -0
- data/docs/Gemfile +4 -0
- data/docs/Gemfile.lock +249 -0
- data/docs/README.md +24 -0
- data/docs/_config.yml +2 -0
- data/docs/_includes/footer.html +8 -0
- data/docs/_includes/google-analytics.html +16 -0
- data/docs/_includes/head.html +7 -0
- data/docs/_includes/toc.html +98 -0
- data/docs/_includes/top-menu.html +17 -0
- data/docs/_layouts/default.html +21 -0
- data/docs/documentation.md +60 -0
- 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 +14 -0
- data/docs/index.html +125 -0
- data/docs/stylesheets/main.css +1176 -0
- data/lib/active_admin.rb +134 -0
- data/lib/active_admin/abstract_view_factory.rb +47 -0
- data/lib/active_admin/application.rb +234 -0
- data/lib/active_admin/application_settings.rb +42 -0
- data/lib/active_admin/asset_registration.rb +29 -0
- data/lib/active_admin/authorization_adapter.rb +129 -0
- data/lib/active_admin/base_controller.rb +81 -0
- data/lib/active_admin/base_controller/authorization.rb +127 -0
- data/lib/active_admin/base_controller/menu.rb +34 -0
- data/lib/active_admin/batch_actions.rb +16 -0
- data/lib/active_admin/batch_actions/controller.rb +40 -0
- data/lib/active_admin/batch_actions/resource_extension.rb +155 -0
- data/lib/active_admin/batch_actions/views/batch_action_form.rb +38 -0
- data/lib/active_admin/batch_actions/views/batch_action_selector.rb +58 -0
- data/lib/active_admin/batch_actions/views/selection_cells.rb +38 -0
- data/lib/active_admin/callbacks.rb +88 -0
- data/lib/active_admin/cancan_adapter.rb +36 -0
- data/lib/active_admin/component.rb +5 -0
- data/lib/active_admin/controller_action.rb +13 -0
- data/lib/active_admin/csv_builder.rb +133 -0
- data/lib/active_admin/dependency.rb +100 -0
- data/lib/active_admin/deprecation.rb +10 -0
- data/lib/active_admin/devise.rb +80 -0
- data/lib/active_admin/dsl.rb +160 -0
- data/lib/active_admin/dynamic_setting.rb +38 -0
- data/lib/active_admin/dynamic_settings_node.rb +28 -0
- data/lib/active_admin/engine.rb +21 -0
- data/lib/active_admin/error.rb +64 -0
- data/lib/active_admin/filters.rb +11 -0
- data/lib/active_admin/filters/active.rb +29 -0
- data/lib/active_admin/filters/active_filter.rb +124 -0
- data/lib/active_admin/filters/active_sidebar.rb +54 -0
- data/lib/active_admin/filters/dsl.rb +21 -0
- data/lib/active_admin/filters/forms.rb +85 -0
- data/lib/active_admin/filters/formtastic_addons.rb +79 -0
- data/lib/active_admin/filters/resource_extension.rb +155 -0
- data/lib/active_admin/form_builder.rb +182 -0
- data/lib/active_admin/generators/boilerplate.rb +45 -0
- data/lib/active_admin/helpers/collection.rb +19 -0
- data/lib/active_admin/helpers/i18n.rb +7 -0
- data/lib/active_admin/helpers/optional_display.rb +38 -0
- data/lib/active_admin/helpers/routes/url_helpers.rb +15 -0
- data/lib/active_admin/helpers/scope_chain.rb +24 -0
- data/lib/active_admin/inputs.rb +21 -0
- data/lib/active_admin/inputs/datepicker_input.rb +27 -0
- data/lib/active_admin/inputs/filters/base.rb +44 -0
- data/lib/active_admin/inputs/filters/base/search_method_select.rb +75 -0
- data/lib/active_admin/inputs/filters/boolean_input.rb +24 -0
- data/lib/active_admin/inputs/filters/check_boxes_input.rb +50 -0
- data/lib/active_admin/inputs/filters/date_picker_input.rb +13 -0
- data/lib/active_admin/inputs/filters/date_range_input.rb +49 -0
- data/lib/active_admin/inputs/filters/numeric_input.rb +12 -0
- data/lib/active_admin/inputs/filters/select_input.rb +58 -0
- data/lib/active_admin/inputs/filters/string_input.rb +26 -0
- data/lib/active_admin/inputs/filters/text_input.rb +25 -0
- data/lib/active_admin/localizers.rb +11 -0
- data/lib/active_admin/localizers/resource_localizer.rb +35 -0
- data/lib/active_admin/menu.rb +102 -0
- data/lib/active_admin/menu_collection.rb +91 -0
- data/lib/active_admin/menu_item.rb +69 -0
- data/lib/active_admin/namespace.rb +266 -0
- data/lib/active_admin/namespace_settings.rb +110 -0
- data/lib/active_admin/order_clause.rb +48 -0
- data/lib/active_admin/orm/active_record.rb +5 -0
- data/lib/active_admin/orm/active_record/comments.rb +101 -0
- data/lib/active_admin/orm/active_record/comments/comment.rb +31 -0
- data/lib/active_admin/orm/active_record/comments/namespace_helper.rb +14 -0
- data/lib/active_admin/orm/active_record/comments/resource_helper.rb +17 -0
- data/lib/active_admin/orm/active_record/comments/show_page_helper.rb +23 -0
- data/lib/active_admin/orm/active_record/comments/views.rb +2 -0
- data/lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb +100 -0
- data/lib/active_admin/orm/mongoid.rb +1 -0
- data/lib/active_admin/orm/mongoid/.gitkeep +0 -0
- data/lib/active_admin/page.rb +111 -0
- data/lib/active_admin/page_controller.rb +29 -0
- data/lib/active_admin/page_dsl.rb +32 -0
- data/lib/active_admin/page_presenter.rb +33 -0
- data/lib/active_admin/pundit_adapter.rb +81 -0
- data/lib/active_admin/resource.rb +207 -0
- data/lib/active_admin/resource/action_items.rb +120 -0
- data/lib/active_admin/resource/attributes.rb +47 -0
- data/lib/active_admin/resource/belongs_to.rb +50 -0
- data/lib/active_admin/resource/controllers.rb +19 -0
- data/lib/active_admin/resource/includes.rb +12 -0
- data/lib/active_admin/resource/menu.rb +67 -0
- data/lib/active_admin/resource/naming.rb +62 -0
- data/lib/active_admin/resource/ordering.rb +11 -0
- data/lib/active_admin/resource/page_presenters.rb +82 -0
- data/lib/active_admin/resource/pagination.rb +23 -0
- data/lib/active_admin/resource/routes.rb +139 -0
- data/lib/active_admin/resource/scope_to.rb +74 -0
- data/lib/active_admin/resource/scopes.rb +52 -0
- data/lib/active_admin/resource/sidebars.rb +28 -0
- data/lib/active_admin/resource_collection.rb +72 -0
- data/lib/active_admin/resource_controller.rb +64 -0
- data/lib/active_admin/resource_controller/action_builder.rb +31 -0
- data/lib/active_admin/resource_controller/data_access.rb +322 -0
- data/lib/active_admin/resource_controller/decorators.rb +102 -0
- data/lib/active_admin/resource_controller/resource_class_methods.rb +26 -0
- data/lib/active_admin/resource_controller/scoping.rb +31 -0
- data/lib/active_admin/resource_controller/sidebars.rb +18 -0
- data/lib/active_admin/resource_controller/streaming.rb +43 -0
- data/lib/active_admin/resource_dsl.rb +224 -0
- data/lib/active_admin/router.rb +114 -0
- data/lib/active_admin/scope.rb +64 -0
- data/lib/active_admin/settings_node.rb +19 -0
- data/lib/active_admin/sidebar_section.rb +39 -0
- data/lib/active_admin/version.rb +3 -0
- data/lib/active_admin/view_factory.rb +27 -0
- data/lib/active_admin/view_helpers.rb +20 -0
- data/lib/active_admin/view_helpers/active_admin_application_helper.rb +12 -0
- data/lib/active_admin/view_helpers/auto_link_helper.rb +45 -0
- data/lib/active_admin/view_helpers/breadcrumb_helper.rb +33 -0
- data/lib/active_admin/view_helpers/display_helper.rb +104 -0
- data/lib/active_admin/view_helpers/download_format_links_helper.rb +59 -0
- data/lib/active_admin/view_helpers/fields_for.rb +50 -0
- data/lib/active_admin/view_helpers/flash_helper.rb +14 -0
- data/lib/active_admin/view_helpers/form_helper.rb +20 -0
- data/lib/active_admin/view_helpers/method_or_proc_helper.rb +100 -0
- data/lib/active_admin/view_helpers/scope_name_helper.rb +16 -0
- data/lib/active_admin/view_helpers/sidebar_helper.rb +15 -0
- data/lib/active_admin/view_helpers/title_helper.rb +11 -0
- data/lib/active_admin/view_helpers/view_factory_helper.rb +11 -0
- data/lib/active_admin/views.rb +8 -0
- data/lib/active_admin/views/action_items.rb +17 -0
- data/lib/active_admin/views/components/active_admin_form.rb +155 -0
- data/lib/active_admin/views/components/attributes_table.rb +94 -0
- data/lib/active_admin/views/components/blank_slate.rb +17 -0
- data/lib/active_admin/views/components/columns.rb +161 -0
- data/lib/active_admin/views/components/dropdown_menu.rb +71 -0
- data/lib/active_admin/views/components/index_list.rb +69 -0
- data/lib/active_admin/views/components/menu.rb +32 -0
- data/lib/active_admin/views/components/menu_item.rb +58 -0
- data/lib/active_admin/views/components/paginated_collection.rb +159 -0
- data/lib/active_admin/views/components/panel.rb +38 -0
- data/lib/active_admin/views/components/scopes.rb +72 -0
- data/lib/active_admin/views/components/sidebar.rb +13 -0
- data/lib/active_admin/views/components/sidebar_section.rb +34 -0
- data/lib/active_admin/views/components/site_title.rb +54 -0
- data/lib/active_admin/views/components/status_tag.rb +75 -0
- data/lib/active_admin/views/components/table_for.rb +209 -0
- data/lib/active_admin/views/components/tabs.rb +40 -0
- data/lib/active_admin/views/components/unsupported_browser.rb +11 -0
- data/lib/active_admin/views/footer.rb +30 -0
- data/lib/active_admin/views/header.rb +19 -0
- data/lib/active_admin/views/index_as_block.rb +36 -0
- data/lib/active_admin/views/index_as_blog.rb +155 -0
- data/lib/active_admin/views/index_as_grid.rb +80 -0
- data/lib/active_admin/views/index_as_table.rb +392 -0
- data/lib/active_admin/views/pages/base.rb +126 -0
- data/lib/active_admin/views/pages/form.rb +64 -0
- data/lib/active_admin/views/pages/index.rb +163 -0
- data/lib/active_admin/views/pages/layout.rb +26 -0
- data/lib/active_admin/views/pages/page.rb +30 -0
- data/lib/active_admin/views/pages/show.rb +65 -0
- data/lib/active_admin/views/tabbed_navigation.rb +11 -0
- data/lib/active_admin/views/title_bar.rb +55 -0
- data/lib/activeadmin.rb +1 -0
- data/lib/generators/active_admin/assets/assets_generator.rb +14 -0
- data/lib/generators/active_admin/assets/templates/active_admin.js +1 -0
- data/lib/generators/active_admin/assets/templates/active_admin.scss +17 -0
- data/lib/generators/active_admin/devise/devise_generator.rb +68 -0
- data/lib/generators/active_admin/install/install_generator.rb +49 -0
- data/lib/generators/active_admin/install/templates/active_admin.rb.erb +315 -0
- data/lib/generators/active_admin/install/templates/admin_users.rb.erb +28 -0
- data/lib/generators/active_admin/install/templates/dashboard.rb +32 -0
- data/lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb.erb +16 -0
- data/lib/generators/active_admin/page/USAGE +8 -0
- data/lib/generators/active_admin/page/page_generator.rb +12 -0
- data/lib/generators/active_admin/page/templates/page.rb +5 -0
- data/lib/generators/active_admin/resource/resource_generator.rb +20 -0
- data/lib/generators/active_admin/resource/templates/admin.rb.erb +44 -0
- data/lib/ransack_ext.rb +20 -0
- data/vendor/assets/javascripts/jquery-ui/data.js +41 -0
- data/vendor/assets/javascripts/jquery-ui/disable-selection.js +48 -0
- data/vendor/assets/javascripts/jquery-ui/escape-selector.js +23 -0
- data/vendor/assets/javascripts/jquery-ui/focusable.js +86 -0
- 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/ie.js +17 -0
- data/vendor/assets/javascripts/jquery-ui/keycode.js +47 -0
- data/vendor/assets/javascripts/jquery-ui/labels.js +65 -0
- data/vendor/assets/javascripts/jquery-ui/plugin.js +46 -0
- data/vendor/assets/javascripts/jquery-ui/position.js +500 -0
- data/vendor/assets/javascripts/jquery-ui/safe-active-element.js +42 -0
- data/vendor/assets/javascripts/jquery-ui/safe-blur.js +23 -0
- data/vendor/assets/javascripts/jquery-ui/scroll-parent.js +47 -0
- data/vendor/assets/javascripts/jquery-ui/tabbable.js +38 -0
- data/vendor/assets/javascripts/jquery-ui/unique-id.js +51 -0
- data/vendor/assets/javascripts/jquery-ui/version.js +17 -0
- data/vendor/assets/javascripts/jquery-ui/widget.js +735 -0
- data/vendor/assets/javascripts/jquery-ui/widgets/button.js +391 -0
- data/vendor/assets/javascripts/jquery-ui/widgets/checkboxradio.js +291 -0
- data/vendor/assets/javascripts/jquery-ui/widgets/controlgroup.js +300 -0
- data/vendor/assets/javascripts/jquery-ui/widgets/datepicker.js +2123 -0
- data/vendor/assets/javascripts/jquery-ui/widgets/dialog.js +954 -0
- data/vendor/assets/javascripts/jquery-ui/widgets/draggable.js +1259 -0
- data/vendor/assets/javascripts/jquery-ui/widgets/mouse.js +230 -0
- data/vendor/assets/javascripts/jquery-ui/widgets/resizable.js +1207 -0
- data/vendor/assets/javascripts/jquery-ui/widgets/sortable.js +1561 -0
- data/vendor/assets/javascripts/jquery-ui/widgets/tabs.js +931 -0
- data/vendor/assets/stylesheets/active_admin/_normalize.scss +447 -0
- metadata +616 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
module ActiveAdmin
|
2
|
+
module Views
|
3
|
+
|
4
|
+
# # Index as a Grid
|
5
|
+
#
|
6
|
+
# Sometimes you want to display the index screen for a set of resources as a grid
|
7
|
+
# (possibly a grid of thumbnail images). To do so, use the :grid option for the
|
8
|
+
# index block.
|
9
|
+
#
|
10
|
+
# ```ruby
|
11
|
+
# index as: :grid do |product|
|
12
|
+
# link_to image_tag(product.image_path), admin_product_path(product)
|
13
|
+
# end
|
14
|
+
# ```
|
15
|
+
#
|
16
|
+
# The block is rendered within a cell in the grid once for each resource in the
|
17
|
+
# collection. The resource is passed into the block for you to use in the view.
|
18
|
+
#
|
19
|
+
# You can customize the number of columns that are rendered using the columns
|
20
|
+
# option:
|
21
|
+
#
|
22
|
+
# ```ruby
|
23
|
+
# index as: :grid, columns: 5 do |product|
|
24
|
+
# link_to image_tag(product.image_path), admin_product_path(product)
|
25
|
+
# end
|
26
|
+
# ```
|
27
|
+
#
|
28
|
+
class IndexAsGrid < ActiveAdmin::Component
|
29
|
+
|
30
|
+
def build(page_presenter, collection)
|
31
|
+
@page_presenter = page_presenter
|
32
|
+
@collection = collection.to_a
|
33
|
+
add_class "index"
|
34
|
+
build_table
|
35
|
+
end
|
36
|
+
|
37
|
+
def number_of_columns
|
38
|
+
@page_presenter[:columns] || default_number_of_columns
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.index_name
|
42
|
+
"grid"
|
43
|
+
end
|
44
|
+
|
45
|
+
protected
|
46
|
+
|
47
|
+
def build_table
|
48
|
+
resource_selection_toggle_panel if active_admin_config.batch_actions.any?
|
49
|
+
table class: "index_grid" do
|
50
|
+
@collection.in_groups_of(number_of_columns).each do |group|
|
51
|
+
build_row(group)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def build_row(group)
|
57
|
+
tr do
|
58
|
+
group.each do |item|
|
59
|
+
item ? build_item(item) : build_empty_cell
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def build_item(item)
|
65
|
+
td for: item do
|
66
|
+
instance_exec(item, &@page_presenter.block)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def build_empty_cell
|
71
|
+
td ' '.html_safe
|
72
|
+
end
|
73
|
+
|
74
|
+
def default_number_of_columns
|
75
|
+
3
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,392 @@
|
|
1
|
+
module ActiveAdmin
|
2
|
+
module Views
|
3
|
+
|
4
|
+
# # Index as a Table
|
5
|
+
#
|
6
|
+
# By default, the index page is a table with each of the models content columns and links to
|
7
|
+
# show, edit and delete the object. There are many ways to customize what gets
|
8
|
+
# displayed.
|
9
|
+
#
|
10
|
+
# ## Defining Columns
|
11
|
+
#
|
12
|
+
# To display an attribute or a method on a resource, simply pass a symbol into the
|
13
|
+
# column method:
|
14
|
+
#
|
15
|
+
# ```ruby
|
16
|
+
# index do
|
17
|
+
# selectable_column
|
18
|
+
# column :title
|
19
|
+
# end
|
20
|
+
# ```
|
21
|
+
#
|
22
|
+
# For association columns we make an educated guess on what to display by
|
23
|
+
# calling the following methods in the following order:
|
24
|
+
#
|
25
|
+
# ```ruby
|
26
|
+
# :display_name, :full_name, :name, :username, :login, :title, :email, :to_s
|
27
|
+
# ```
|
28
|
+
#
|
29
|
+
# This can be customized in `config/initializers/active_admin.rb`.
|
30
|
+
#
|
31
|
+
# If the default title does not work for you, pass it as the first argument:
|
32
|
+
#
|
33
|
+
# ```ruby
|
34
|
+
# index do
|
35
|
+
# selectable_column
|
36
|
+
# column "My Custom Title", :title
|
37
|
+
# end
|
38
|
+
# ```
|
39
|
+
#
|
40
|
+
# Sometimes that just isn't enough and you need to write some view-specific code.
|
41
|
+
# For example, say we wanted a "Title" column that links to the posts admin screen.
|
42
|
+
#
|
43
|
+
# `column` accepts a block that will be rendered for each of the objects in the collection.
|
44
|
+
# The block is called once for each resource, which is passed as an argument to the block.
|
45
|
+
#
|
46
|
+
# ```ruby
|
47
|
+
# index do
|
48
|
+
# selectable_column
|
49
|
+
# column "Title" do |post|
|
50
|
+
# link_to post.title, admin_post_path(post)
|
51
|
+
# end
|
52
|
+
# end
|
53
|
+
# ```
|
54
|
+
#
|
55
|
+
# ## Defining Actions
|
56
|
+
#
|
57
|
+
# To setup links to View, Edit and Delete a resource, use the `actions` method:
|
58
|
+
#
|
59
|
+
# ```ruby
|
60
|
+
# index do
|
61
|
+
# selectable_column
|
62
|
+
# column :title
|
63
|
+
# actions
|
64
|
+
# end
|
65
|
+
# ```
|
66
|
+
#
|
67
|
+
# You can also append custom links to the default links:
|
68
|
+
#
|
69
|
+
# ```ruby
|
70
|
+
# index do
|
71
|
+
# selectable_column
|
72
|
+
# column :title
|
73
|
+
# actions do |post|
|
74
|
+
# item "Preview", admin_preview_post_path(post), class: "member_link"
|
75
|
+
# end
|
76
|
+
# end
|
77
|
+
# ```
|
78
|
+
#
|
79
|
+
# Or forego the default links entirely:
|
80
|
+
#
|
81
|
+
# ```ruby
|
82
|
+
# index do
|
83
|
+
# column :title
|
84
|
+
# actions defaults: false do |post|
|
85
|
+
# item "View", admin_post_path(post)
|
86
|
+
# end
|
87
|
+
# end
|
88
|
+
# ```
|
89
|
+
#
|
90
|
+
# Or append custom action with custom html via arbre:
|
91
|
+
#
|
92
|
+
# ```ruby
|
93
|
+
# index do
|
94
|
+
# column :title
|
95
|
+
# actions do |post|
|
96
|
+
# a "View", href: admin_post_path(post)
|
97
|
+
# end
|
98
|
+
# end
|
99
|
+
# ```
|
100
|
+
#
|
101
|
+
# In case you prefer to list actions links in a dropdown menu:
|
102
|
+
#
|
103
|
+
# ```ruby
|
104
|
+
# index do
|
105
|
+
# selectable_column
|
106
|
+
# column :title
|
107
|
+
# actions dropdown: true do |post|
|
108
|
+
# item "Preview", admin_preview_post_path(post)
|
109
|
+
# end
|
110
|
+
# end
|
111
|
+
# ```
|
112
|
+
#
|
113
|
+
# In addition, you can insert the position of the row in the greater
|
114
|
+
# collection by using the index_column special command:
|
115
|
+
#
|
116
|
+
# ```ruby
|
117
|
+
# index do
|
118
|
+
# selectable_column
|
119
|
+
# index_column
|
120
|
+
# column :title
|
121
|
+
# end
|
122
|
+
# ```
|
123
|
+
#
|
124
|
+
# index_column take an optional offset parameter to allow a developer to set
|
125
|
+
# the starting number for the index (default is 1).
|
126
|
+
#
|
127
|
+
# ## Sorting
|
128
|
+
#
|
129
|
+
# When a column is generated from an Active Record attribute, the table is
|
130
|
+
# sortable by default. If you are creating a custom column, you may need to give
|
131
|
+
# Active Admin a hint for how to sort the table.
|
132
|
+
#
|
133
|
+
# You can pass the key specifying the attribute which gets used to sort objects using Active Record.
|
134
|
+
# By default, this is the column on the resource's table that the attribute corresponds to.
|
135
|
+
# Otherwise, any attribute that the resource collection responds to can be used.
|
136
|
+
#
|
137
|
+
# ```ruby
|
138
|
+
# index do
|
139
|
+
# column :title, sortable: :title do |post|
|
140
|
+
# link_to post.title, admin_post_path(post)
|
141
|
+
# end
|
142
|
+
# end
|
143
|
+
# ```
|
144
|
+
#
|
145
|
+
# You can turn off sorting on any column by passing false:
|
146
|
+
#
|
147
|
+
# ```ruby
|
148
|
+
# index do
|
149
|
+
# column :title, sortable: false
|
150
|
+
# end
|
151
|
+
# ```
|
152
|
+
#
|
153
|
+
# It's also possible to sort by PostgreSQL's hstore column key. You should set `sortable`
|
154
|
+
# option to a `column->'key'` value:
|
155
|
+
#
|
156
|
+
# ```ruby
|
157
|
+
# index do
|
158
|
+
# column :keywords, sortable: "meta->'keywords'"
|
159
|
+
# end
|
160
|
+
# ```
|
161
|
+
#
|
162
|
+
# ## Custom sorting
|
163
|
+
#
|
164
|
+
# It is also possible to use database specific expressions and options for sorting by column
|
165
|
+
#
|
166
|
+
# ```ruby
|
167
|
+
# order_by(:title) do |order_clause|
|
168
|
+
# if order_clause.order == 'desc'
|
169
|
+
# [order_clause.to_sql, 'NULLS LAST'].join(' ')
|
170
|
+
# else
|
171
|
+
# [order_clause.to_sql, 'NULLS FIRST'].join(' ')
|
172
|
+
# end
|
173
|
+
# end
|
174
|
+
#
|
175
|
+
# index do
|
176
|
+
# column :title
|
177
|
+
# end
|
178
|
+
# ```
|
179
|
+
#
|
180
|
+
# ## Associated Sorting
|
181
|
+
#
|
182
|
+
# You're normally able to sort columns alphabetically, but by default you
|
183
|
+
# can't sort by associated objects. Though with a few simple changes, you can.
|
184
|
+
#
|
185
|
+
# Assuming you're on the Books index page, and Book has_one Publisher:
|
186
|
+
#
|
187
|
+
# ```ruby
|
188
|
+
# controller do
|
189
|
+
# def scoped_collection
|
190
|
+
# super.includes :publisher # prevents N+1 queries to your database
|
191
|
+
# end
|
192
|
+
# end
|
193
|
+
# ```
|
194
|
+
#
|
195
|
+
# Then it's simple to sort by any Publisher attribute from within the index table:
|
196
|
+
#
|
197
|
+
# ```ruby
|
198
|
+
# index do
|
199
|
+
# column :publisher, sortable: 'publishers.name'
|
200
|
+
# end
|
201
|
+
# ```
|
202
|
+
#
|
203
|
+
# ## Showing and Hiding Columns
|
204
|
+
#
|
205
|
+
# The entire index block is rendered within the context of the view, so you can
|
206
|
+
# easily do things that show or hide columns based on the current context.
|
207
|
+
#
|
208
|
+
# For example, if you were using CanCan:
|
209
|
+
#
|
210
|
+
# ```ruby
|
211
|
+
# index do
|
212
|
+
# column :title, sortable: false
|
213
|
+
# column :secret_data if can? :manage, Post
|
214
|
+
# end
|
215
|
+
# ```
|
216
|
+
#
|
217
|
+
# ## Custom row class
|
218
|
+
#
|
219
|
+
# In order to add special class to table rows pass the proc object as a `:row_class` option
|
220
|
+
# of the `index` method.
|
221
|
+
#
|
222
|
+
# ```ruby
|
223
|
+
# index row_class: ->elem { 'active' if elem.active? } do
|
224
|
+
# # columns
|
225
|
+
# end
|
226
|
+
# ```
|
227
|
+
#
|
228
|
+
class IndexAsTable < ActiveAdmin::Component
|
229
|
+
|
230
|
+
def build(page_presenter, collection)
|
231
|
+
table_options = {
|
232
|
+
id: "index_table_#{active_admin_config.resource_name.plural}",
|
233
|
+
sortable: true,
|
234
|
+
class: "index_table index",
|
235
|
+
i18n: active_admin_config.resource_class,
|
236
|
+
paginator: page_presenter[:paginator] != false,
|
237
|
+
row_class: page_presenter[:row_class]
|
238
|
+
}
|
239
|
+
|
240
|
+
table_for collection, table_options do |t|
|
241
|
+
table_config_block = page_presenter.block || default_table
|
242
|
+
instance_exec(t, &table_config_block)
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
def table_for(*args, &block)
|
247
|
+
insert_tag IndexTableFor, *args, &block
|
248
|
+
end
|
249
|
+
|
250
|
+
def default_table
|
251
|
+
proc do
|
252
|
+
selectable_column
|
253
|
+
id_column if resource_class.primary_key
|
254
|
+
active_admin_config.resource_columns.each do |attribute|
|
255
|
+
column attribute
|
256
|
+
end
|
257
|
+
actions
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
261
|
+
def self.index_name
|
262
|
+
"table"
|
263
|
+
end
|
264
|
+
|
265
|
+
#
|
266
|
+
# Extend the default ActiveAdmin::Views::TableFor with some
|
267
|
+
# methods for quickly displaying items on the index page
|
268
|
+
#
|
269
|
+
class IndexTableFor < ::ActiveAdmin::Views::TableFor
|
270
|
+
|
271
|
+
# Display a column for checkbox
|
272
|
+
def selectable_column
|
273
|
+
return unless active_admin_config.batch_actions.any?
|
274
|
+
column resource_selection_toggle_cell, class: 'col-selectable', sortable: false do |resource|
|
275
|
+
resource_selection_cell resource
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
def index_column(start_value = 1)
|
280
|
+
column '#', class: 'col-index', sortable: false do |resource|
|
281
|
+
@collection.offset_value + @collection.index(resource) + start_value
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
# Display a column for the id
|
286
|
+
def id_column
|
287
|
+
raise "#{resource_class.name} has no primary_key!" unless resource_class.primary_key
|
288
|
+
column(resource_class.human_attribute_name(resource_class.primary_key), sortable: resource_class.primary_key) do |resource|
|
289
|
+
if controller.action_methods.include?('show')
|
290
|
+
link_to resource.id, resource_path(resource), class: "resource_id_link"
|
291
|
+
elsif controller.action_methods.include?('edit')
|
292
|
+
link_to resource.id, edit_resource_path(resource), class: "resource_id_link"
|
293
|
+
else
|
294
|
+
resource.id
|
295
|
+
end
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
299
|
+
def default_actions
|
300
|
+
raise '`default_actions` is no longer provided in ActiveAdmin 1.x. Use `actions` instead.'
|
301
|
+
end
|
302
|
+
|
303
|
+
# Add links to perform actions.
|
304
|
+
#
|
305
|
+
# ```ruby
|
306
|
+
# # Add default links.
|
307
|
+
# actions
|
308
|
+
#
|
309
|
+
# # Add default links with a custom column title (empty by default).
|
310
|
+
# actions name: 'A title!'
|
311
|
+
#
|
312
|
+
# # Append some actions onto the end of the default actions.
|
313
|
+
# actions do |admin_user|
|
314
|
+
# item 'Grant Admin', grant_admin_admin_user_path(admin_user)
|
315
|
+
# item 'Grant User', grant_user_admin_user_path(admin_user)
|
316
|
+
# end
|
317
|
+
#
|
318
|
+
# # Append some actions onto the end of the default actions using arbre dsl.
|
319
|
+
# actions do |admin_user|
|
320
|
+
# a 'Grant Admin', href: grant_admin_admin_user_path(admin_user)
|
321
|
+
# end
|
322
|
+
#
|
323
|
+
# # Custom actions without the defaults.
|
324
|
+
# actions defaults: false do |admin_user|
|
325
|
+
# item 'Grant Admin', grant_admin_admin_user_path(admin_user)
|
326
|
+
# end
|
327
|
+
#
|
328
|
+
# # Append some actions onto the end of the default actions displayed in a Dropdown Menu
|
329
|
+
# actions dropdown: true do |admin_user|
|
330
|
+
# item 'Grant Admin', grant_admin_admin_user_path(admin_user)
|
331
|
+
# end
|
332
|
+
#
|
333
|
+
# # Custom actions without the defaults displayed in a Dropdown Menu.
|
334
|
+
# actions defaults: false, dropdown: true, dropdown_name: 'Additional actions' do |admin_user|
|
335
|
+
# item 'Grant Admin', grant_admin_admin_user_path(admin_user)
|
336
|
+
# end
|
337
|
+
#
|
338
|
+
# ```
|
339
|
+
def actions(options = {}, &block)
|
340
|
+
name = options.delete(:name) { '' }
|
341
|
+
defaults = options.delete(:defaults) { true }
|
342
|
+
dropdown = options.delete(:dropdown) { false }
|
343
|
+
dropdown_name = options.delete(:dropdown_name) { I18n.t 'active_admin.dropdown_actions.button_label', default: 'Actions' }
|
344
|
+
|
345
|
+
options[:class] ||= 'col-actions'
|
346
|
+
|
347
|
+
column name, options do |resource|
|
348
|
+
if dropdown
|
349
|
+
dropdown_menu dropdown_name do
|
350
|
+
defaults(resource) if defaults
|
351
|
+
instance_exec(resource, &block) if block_given?
|
352
|
+
end
|
353
|
+
else
|
354
|
+
table_actions do
|
355
|
+
defaults(resource, css_class: :member_link) if defaults
|
356
|
+
if block_given?
|
357
|
+
block_result = instance_exec(resource, &block)
|
358
|
+
text_node block_result unless block_result.is_a? Arbre::Element
|
359
|
+
end
|
360
|
+
end
|
361
|
+
end
|
362
|
+
end
|
363
|
+
end
|
364
|
+
|
365
|
+
private
|
366
|
+
|
367
|
+
def defaults(resource, options = {})
|
368
|
+
localizer = ActiveAdmin::Localizers.resource(active_admin_config)
|
369
|
+
if controller.action_methods.include?('show') && authorized?(ActiveAdmin::Auth::READ, resource)
|
370
|
+
item localizer.t(:view), resource_path(resource), class: "view_link #{options[:css_class]}", title: localizer.t(:view)
|
371
|
+
end
|
372
|
+
if controller.action_methods.include?('edit') && authorized?(ActiveAdmin::Auth::UPDATE, resource)
|
373
|
+
item localizer.t(:edit), edit_resource_path(resource), class: "edit_link #{options[:css_class]}", title: localizer.t(:edit)
|
374
|
+
end
|
375
|
+
if controller.action_methods.include?('destroy') && authorized?(ActiveAdmin::Auth::DESTROY, resource)
|
376
|
+
item localizer.t(:delete), resource_path(resource), class: "delete_link #{options[:css_class]}", title: localizer.t(:delete),
|
377
|
+
method: :delete, data: { confirm: localizer.t(:delete_confirmation) }
|
378
|
+
end
|
379
|
+
end
|
380
|
+
|
381
|
+
class TableActions < ActiveAdmin::Component
|
382
|
+
builder_method :table_actions
|
383
|
+
|
384
|
+
def item *args
|
385
|
+
text_node link_to *args
|
386
|
+
end
|
387
|
+
end
|
388
|
+
end # IndexTableFor
|
389
|
+
|
390
|
+
end
|
391
|
+
end
|
392
|
+
end
|