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,7 @@
|
|
1
|
+
// Short-circuits `_focusTabbable` to focus on the modal itself instead of
|
2
|
+
// elements inside the modal. Without this, if a datepicker is the first input,
|
3
|
+
// it'll immediately pop up when the modal opens.
|
4
|
+
// See this ticket for more info: http://bugs.jqueryui.com/ticket/4731
|
5
|
+
$.ui.dialog.prototype._focusTabbable = function() {
|
6
|
+
this.uiDialog.focus();
|
7
|
+
};
|
@@ -0,0 +1,9 @@
|
|
1
|
+
// `serializeArray` generates => [{ name: 'foo', value: 'bar' }]
|
2
|
+
// This function remaps it to => { foo: 'bar' }
|
3
|
+
$.fn.serializeObject = function() {
|
4
|
+
return this.serializeArray()
|
5
|
+
.reduce((obj, item) => {
|
6
|
+
obj[item.name] = item.value
|
7
|
+
return obj
|
8
|
+
}, {});
|
9
|
+
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
(($) => {
|
2
|
+
|
3
|
+
$(document)
|
4
|
+
.on('focus', 'input.datepicker:not(.hasDatepicker)', function() {
|
5
|
+
const input = $(this);
|
6
|
+
|
7
|
+
// Only create datepickers in compatible browsers
|
8
|
+
if (input[0].type === 'date') { return; }
|
9
|
+
|
10
|
+
const defaults = { dateFormat: 'yy-mm-dd' };
|
11
|
+
const options = input.data('datepicker-options');
|
12
|
+
|
13
|
+
input.datepicker($.extend(defaults, options));
|
14
|
+
});
|
15
|
+
|
16
|
+
})(jQuery);
|
@@ -0,0 +1,45 @@
|
|
1
|
+
(($, ActiveAdmin) => {
|
2
|
+
|
3
|
+
class Filters {
|
4
|
+
|
5
|
+
static _clearForm(event) {
|
6
|
+
const regex = /^(q\[|q%5B|q%5b|page|utf8|commit)/;
|
7
|
+
const params = ActiveAdmin
|
8
|
+
.queryStringToParams()
|
9
|
+
.filter(({name}) => !name.match(regex));
|
10
|
+
|
11
|
+
event.preventDefault();
|
12
|
+
|
13
|
+
if (ActiveAdmin.turbolinks) {
|
14
|
+
ActiveAdmin.turbolinksVisit(params);
|
15
|
+
} else {
|
16
|
+
window.location.search = ActiveAdmin.toQueryString(params);
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
static _disableEmptyInputFields(event) {
|
21
|
+
const params = $(this)
|
22
|
+
.find(':input')
|
23
|
+
.filter((i, input) => input.value === '')
|
24
|
+
.prop({ disabled: true })
|
25
|
+
.end()
|
26
|
+
.serializeArray();
|
27
|
+
|
28
|
+
if (ActiveAdmin.turbolinks) {
|
29
|
+
event.preventDefault();
|
30
|
+
ActiveAdmin.turbolinksVisit(params);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
static _setSearchType() {
|
35
|
+
$(this).siblings('input').prop({name: `q[${this.value}]`});
|
36
|
+
}
|
37
|
+
|
38
|
+
}
|
39
|
+
|
40
|
+
$(document).
|
41
|
+
on('click', '.clear_filters_btn', Filters._clearForm).
|
42
|
+
on('submit', '.filter_form', Filters._disableEmptyInputFields).
|
43
|
+
on('change', '.filter_form_field.select_and_search select', Filters._setSearchType);
|
44
|
+
|
45
|
+
})(jQuery, window.activeadmin);
|
@@ -0,0 +1,41 @@
|
|
1
|
+
((window, $) => {
|
2
|
+
|
3
|
+
class ActiveAdmin {
|
4
|
+
|
5
|
+
static get turbolinks() {
|
6
|
+
return (typeof Turbolinks !== 'undefined' && Turbolinks.supported);
|
7
|
+
}
|
8
|
+
|
9
|
+
static turbolinksVisit(params) {
|
10
|
+
const path = [window.location.pathname, '?', this.toQueryString(params)].join('')
|
11
|
+
Turbolinks.visit(path);
|
12
|
+
}
|
13
|
+
|
14
|
+
static queryString() {
|
15
|
+
return (window.location.search || '').replace(/^\?/, '');
|
16
|
+
}
|
17
|
+
|
18
|
+
static queryStringToParams() {
|
19
|
+
const decode = (value) => decodeURIComponent((value || '').replace(/\+/g, '%20'));
|
20
|
+
|
21
|
+
return this.queryString()
|
22
|
+
.split("&")
|
23
|
+
.map(pair => pair.split("="))
|
24
|
+
.map(([key, value]) => {
|
25
|
+
return { name: decode(key), value: decode(value) }
|
26
|
+
});
|
27
|
+
}
|
28
|
+
|
29
|
+
static toQueryString(params) {
|
30
|
+
const encode = (value) => encodeURIComponent(value || '');
|
31
|
+
|
32
|
+
return params
|
33
|
+
.map(({name, value}) => [ encode(name), encode(value) ])
|
34
|
+
.map(pair => pair.join('='))
|
35
|
+
.join('&')
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
window.activeadmin = ActiveAdmin
|
40
|
+
|
41
|
+
})(window, jQuery);
|
@@ -0,0 +1,55 @@
|
|
1
|
+
const onDOMReady = function() {
|
2
|
+
//
|
3
|
+
// Use ActiveAdmin.modal_dialog to prompt user if
|
4
|
+
// confirmation is required for current Batch Action
|
5
|
+
//
|
6
|
+
$('.batch_actions_selector li a').click(function(event){
|
7
|
+
let message;
|
8
|
+
event.stopPropagation(); // prevent Rails UJS click event
|
9
|
+
event.preventDefault();
|
10
|
+
if ((message = $(this).data('confirm'))) {
|
11
|
+
ActiveAdmin.modal_dialog(message, $(this).data('inputs'), inputs => {
|
12
|
+
$(this).trigger('confirm:complete', inputs);
|
13
|
+
});
|
14
|
+
} else {
|
15
|
+
$(this).trigger('confirm:complete');
|
16
|
+
}
|
17
|
+
});
|
18
|
+
|
19
|
+
$('.batch_actions_selector li a').on('confirm:complete', function(event, inputs){
|
20
|
+
let val;
|
21
|
+
if ((val = JSON.stringify(inputs))) {
|
22
|
+
$('#batch_action_inputs').removeAttr('disabled').val(val);
|
23
|
+
} else {
|
24
|
+
$('#batch_action_inputs').attr('disabled', 'disabled');
|
25
|
+
}
|
26
|
+
|
27
|
+
$('#batch_action').val($(this).data('action'));
|
28
|
+
$('#collection_selection').submit();
|
29
|
+
});
|
30
|
+
|
31
|
+
//
|
32
|
+
// Add checkbox selection to resource tables and lists if batch actions are enabled
|
33
|
+
//
|
34
|
+
|
35
|
+
if ($(".batch_actions_selector").length && $(":checkbox.toggle_all").length) {
|
36
|
+
|
37
|
+
if ($(".paginated_collection table.index_table").length) {
|
38
|
+
$(".paginated_collection table.index_table").tableCheckboxToggler();
|
39
|
+
} else {
|
40
|
+
$(".paginated_collection").checkboxToggler();
|
41
|
+
}
|
42
|
+
|
43
|
+
$(document).on('change', '.paginated_collection :checkbox', function() {
|
44
|
+
if ($(".paginated_collection :checkbox:checked").length && $(".dropdown_menu_list").children().length) {
|
45
|
+
$(".batch_actions_selector").each(function() { $(this).aaDropdownMenu("enable"); });
|
46
|
+
} else {
|
47
|
+
$(".batch_actions_selector").each(function() { $(this).aaDropdownMenu("disable"); });
|
48
|
+
}
|
49
|
+
});
|
50
|
+
}
|
51
|
+
};
|
52
|
+
|
53
|
+
$(document).
|
54
|
+
ready(onDOMReady).
|
55
|
+
on('page:load turbolinks:load', onDOMReady);
|
@@ -0,0 +1,49 @@
|
|
1
|
+
ActiveAdmin.CheckboxToggler = class CheckboxToggler {
|
2
|
+
constructor(options, container){
|
3
|
+
this.options = options;
|
4
|
+
this.container = container;
|
5
|
+
this._init();
|
6
|
+
this._bind();
|
7
|
+
}
|
8
|
+
|
9
|
+
option(key, value) {
|
10
|
+
}
|
11
|
+
|
12
|
+
_init() {
|
13
|
+
if (!this.container) {
|
14
|
+
throw new Error('Container element not found');
|
15
|
+
} else {
|
16
|
+
this.$container = $(this.container);
|
17
|
+
}
|
18
|
+
|
19
|
+
if (!this.$container.find('.toggle_all').length) {
|
20
|
+
throw new Error('"toggle all" checkbox not found');
|
21
|
+
} else {
|
22
|
+
this.toggle_all_checkbox = this.$container.find('.toggle_all');
|
23
|
+
}
|
24
|
+
|
25
|
+
this.checkboxes = this.$container.find(':checkbox').not(this.toggle_all_checkbox);
|
26
|
+
}
|
27
|
+
|
28
|
+
_bind() {
|
29
|
+
this.checkboxes.change(event => this._didChangeCheckbox(event.target));
|
30
|
+
this.toggle_all_checkbox.change(() => this._didChangeToggleAllCheckbox());
|
31
|
+
}
|
32
|
+
|
33
|
+
_didChangeCheckbox(checkbox){
|
34
|
+
const numChecked = this.checkboxes.filter(':checked').length;
|
35
|
+
|
36
|
+
const allChecked = numChecked === this.checkboxes.length;
|
37
|
+
const someChecked = (numChecked > 0) && (numChecked < this.checkboxes.length);
|
38
|
+
|
39
|
+
this.toggle_all_checkbox.prop({ checked: allChecked, indeterminate: someChecked });
|
40
|
+
}
|
41
|
+
|
42
|
+
_didChangeToggleAllCheckbox() {
|
43
|
+
const setting = this.toggle_all_checkbox.prop('checked');
|
44
|
+
this.checkboxes.prop({ checked: setting });
|
45
|
+
return setting;
|
46
|
+
}
|
47
|
+
};
|
48
|
+
|
49
|
+
$.widget.bridge('checkboxToggler', ActiveAdmin.CheckboxToggler);
|
@@ -0,0 +1,123 @@
|
|
1
|
+
ActiveAdmin.DropdownMenu = class DropdownMenu {
|
2
|
+
|
3
|
+
constructor(options, element) {
|
4
|
+
this.options = options;
|
5
|
+
this.element = element;
|
6
|
+
this.$element = $(this.element);
|
7
|
+
|
8
|
+
const defaults = {
|
9
|
+
fadeInDuration: 20,
|
10
|
+
fadeOutDuration: 100,
|
11
|
+
onClickActionItemCallback: null
|
12
|
+
};
|
13
|
+
|
14
|
+
this.options = $.extend(defaults, this.options);
|
15
|
+
this.isOpen = false;
|
16
|
+
|
17
|
+
this.$menuButton = this.$element.find('.dropdown_menu_button');
|
18
|
+
this.$menuList = this.$element.find('.dropdown_menu_list_wrapper');
|
19
|
+
|
20
|
+
this._buildMenuList();
|
21
|
+
this._bind();
|
22
|
+
}
|
23
|
+
|
24
|
+
open() {
|
25
|
+
this.isOpen = true;
|
26
|
+
this.$menuList.fadeIn(this.options.fadeInDuration);
|
27
|
+
|
28
|
+
this._position();
|
29
|
+
return this;
|
30
|
+
}
|
31
|
+
|
32
|
+
close() {
|
33
|
+
this.isOpen = false;
|
34
|
+
this.$menuList.fadeOut(this.options.fadeOutDuration);
|
35
|
+
return this;
|
36
|
+
}
|
37
|
+
|
38
|
+
destroy() {
|
39
|
+
this.$element = null;
|
40
|
+
return this;
|
41
|
+
}
|
42
|
+
|
43
|
+
isDisabled() {
|
44
|
+
return this.$menuButton.hasClass('disabled');
|
45
|
+
}
|
46
|
+
|
47
|
+
disable() {
|
48
|
+
this.$menuButton.addClass('disabled');
|
49
|
+
}
|
50
|
+
|
51
|
+
enable() {
|
52
|
+
this.$menuButton.removeClass('disabled');
|
53
|
+
}
|
54
|
+
|
55
|
+
option(key, value) {
|
56
|
+
if ($.isPlainObject(key)) {
|
57
|
+
return this.options = $.extend(true, this.options, key);
|
58
|
+
} else if (key != null) {
|
59
|
+
return this.options[key];
|
60
|
+
} else {
|
61
|
+
return this.options[key] = value;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
_buildMenuList() {
|
66
|
+
this.$nipple = $('<div class="dropdown_menu_nipple"></div>');
|
67
|
+
this.$menuList.prepend(this.$nipple);
|
68
|
+
this.$menuList.hide();
|
69
|
+
}
|
70
|
+
|
71
|
+
_bind() {
|
72
|
+
$('body').click(() => {
|
73
|
+
if (this.isOpen) { this.close(); }
|
74
|
+
});
|
75
|
+
|
76
|
+
this.$menuButton.click(() => {
|
77
|
+
if (!this.isDisabled()) {
|
78
|
+
if (this.isOpen) {
|
79
|
+
this.close();
|
80
|
+
} else {
|
81
|
+
this.open();
|
82
|
+
}
|
83
|
+
}
|
84
|
+
return false;
|
85
|
+
});
|
86
|
+
}
|
87
|
+
|
88
|
+
_position() {
|
89
|
+
this.$menuList.css('top', this.$menuButton.position().top + this.$menuButton.outerHeight() + 10);
|
90
|
+
|
91
|
+
const button_left = this.$menuButton.position().left;
|
92
|
+
const button_center = this.$menuButton.outerWidth() / 2;
|
93
|
+
const button_right = button_left + (button_center * 2);
|
94
|
+
const menu_center = this.$menuList.outerWidth() / 2;
|
95
|
+
const nipple_center = this.$nipple.outerWidth() / 2;
|
96
|
+
const window_right = $(window).width();
|
97
|
+
|
98
|
+
const centered_menu_left = (button_left + button_center) - menu_center;
|
99
|
+
const centered_menu_right = button_left + button_center + menu_center;
|
100
|
+
|
101
|
+
if (centered_menu_left < 0) {
|
102
|
+
// Left align with button
|
103
|
+
this.$menuList.css('left', button_left);
|
104
|
+
this.$nipple.css('left', button_center - nipple_center);
|
105
|
+
} else if (centered_menu_right > window_right) {
|
106
|
+
// Right align with button
|
107
|
+
this.$menuList.css('right', window_right - button_right);
|
108
|
+
this.$nipple.css('right', button_center - nipple_center);
|
109
|
+
} else {
|
110
|
+
// Center align under button
|
111
|
+
this.$menuList.css('left', centered_menu_left);
|
112
|
+
this.$nipple.css('left', menu_center - nipple_center);
|
113
|
+
}
|
114
|
+
}
|
115
|
+
};
|
116
|
+
|
117
|
+
$.widget.bridge('aaDropdownMenu', ActiveAdmin.DropdownMenu);
|
118
|
+
|
119
|
+
const onDOMReady = () => $('.dropdown_menu').aaDropdownMenu();
|
120
|
+
|
121
|
+
$(document).
|
122
|
+
ready(onDOMReady).
|
123
|
+
on('page:load turbolinks:load', onDOMReady);
|
@@ -0,0 +1,95 @@
|
|
1
|
+
$(function() {
|
2
|
+
// Provides a before-removal hook:
|
3
|
+
// $ ->
|
4
|
+
// # This is a good place to tear down JS plugins to prevent memory leaks.
|
5
|
+
// $(document).on 'has_many_remove:before', '.has_many_container', (e, fieldset, container)->
|
6
|
+
// fieldset.find('.select2').select2 'destroy'
|
7
|
+
//
|
8
|
+
// # If you need to do anything after removing the items you can use the
|
9
|
+
// has_many_remove:after hook
|
10
|
+
// $(document).on 'has_many_remove:after', '.has_many_container', (e, fieldset, container)->
|
11
|
+
// list_item_count = container.find('.has_many_fields').length
|
12
|
+
// alert("There are now #{list_item_count} items in the list")
|
13
|
+
//
|
14
|
+
$(document).on('click', 'a.button.has_many_remove', function(event){
|
15
|
+
event.preventDefault();
|
16
|
+
const parent = $(this).closest('.has_many_container');
|
17
|
+
const to_remove = $(this).closest('fieldset');
|
18
|
+
recompute_positions(parent);
|
19
|
+
|
20
|
+
parent.trigger('has_many_remove:before', [to_remove, parent]);
|
21
|
+
to_remove.remove();
|
22
|
+
return parent.trigger('has_many_remove:after', [to_remove, parent]);
|
23
|
+
});
|
24
|
+
|
25
|
+
// Provides before and after creation hooks:
|
26
|
+
// $ ->
|
27
|
+
// # The before hook allows you to prevent the creation of new records.
|
28
|
+
// $(document).on 'has_many_add:before', '.has_many_container', (e, container)->
|
29
|
+
// if $(@).children('fieldset').length >= 3
|
30
|
+
// alert "you've reached the maximum number of items"
|
31
|
+
// e.preventDefault()
|
32
|
+
//
|
33
|
+
// # The after hook is a good place to initialize JS plugins and the like.
|
34
|
+
// $(document).on 'has_many_add:after', '.has_many_container', (e, fieldset, container)->
|
35
|
+
// fieldset.find('select').chosen()
|
36
|
+
//
|
37
|
+
$(document).on('click', 'a.button.has_many_add', function(event){
|
38
|
+
let before_add;
|
39
|
+
event.preventDefault();
|
40
|
+
const parent = $(this).closest('.has_many_container');
|
41
|
+
parent.trigger((before_add = $.Event('has_many_add:before')), [parent]);
|
42
|
+
|
43
|
+
if (!before_add.isDefaultPrevented()) {
|
44
|
+
let index = parent.data('has_many_index') || (parent.children('fieldset').length - 1);
|
45
|
+
parent.data({has_many_index: ++index});
|
46
|
+
|
47
|
+
const regex = new RegExp($(this).data('placeholder'), 'g');
|
48
|
+
const html = $(this).data('html').replace(regex, index);
|
49
|
+
|
50
|
+
const fieldset = $(html).insertBefore(this);
|
51
|
+
recompute_positions(parent);
|
52
|
+
return parent.trigger('has_many_add:after', [fieldset, parent]);
|
53
|
+
}
|
54
|
+
});
|
55
|
+
|
56
|
+
$(document).on('change', '.has_many_container[data-sortable] :input[name$="[_destroy]"]', function() {
|
57
|
+
recompute_positions($(this).closest('.has_many'));
|
58
|
+
});
|
59
|
+
|
60
|
+
init_sortable();
|
61
|
+
$(document).on('has_many_add:after', '.has_many_container', init_sortable);
|
62
|
+
});
|
63
|
+
|
64
|
+
var init_sortable = function() {
|
65
|
+
const elems = $('.has_many_container[data-sortable]:not(.ui-sortable)');
|
66
|
+
elems.sortable({
|
67
|
+
items: '> fieldset',
|
68
|
+
handle: '> ol > .handle',
|
69
|
+
start: (ev, ui) => {
|
70
|
+
ui.item.css({opacity: 0.3});
|
71
|
+
},
|
72
|
+
stop: function (ev, ui) {
|
73
|
+
ui.item.css({opacity: 1.0});
|
74
|
+
recompute_positions($(this));
|
75
|
+
}
|
76
|
+
});
|
77
|
+
elems.each(recompute_positions);
|
78
|
+
};
|
79
|
+
|
80
|
+
var recompute_positions = function(parent){
|
81
|
+
parent = parent instanceof jQuery ? parent : $(this);
|
82
|
+
const input_name = parent.data('sortable');
|
83
|
+
let position = parseInt(parent.data('sortable-start') || 0, 10);
|
84
|
+
|
85
|
+
parent.children('fieldset').each(function() {
|
86
|
+
// We ignore nested inputs, so when defining your has_many, be sure to keep
|
87
|
+
// your sortable input at the root of the has_many block.
|
88
|
+
const destroy_input = $(this).find("> ol > .input > :input[name$='[_destroy]']");
|
89
|
+
const sortable_input = $(this).find(`> ol > .input > :input[name$='[${input_name}]']`);
|
90
|
+
|
91
|
+
if (sortable_input.length) {
|
92
|
+
sortable_input.val(destroy_input.is(':checked') ? '' : position++);
|
93
|
+
}
|
94
|
+
});
|
95
|
+
};
|