rails_admin 2.1.0 → 3.0.0.beta
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rails_admin might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile +9 -11
- data/README.md +37 -31
- data/Rakefile +2 -2
- data/app/assets/javascripts/rails_admin.js +21 -0
- data/app/assets/stylesheets/rails_admin/custom/mixins.scss +1 -1
- data/app/assets/stylesheets/rails_admin/custom/variables.scss +1 -1
- data/app/assets/stylesheets/rails_admin.scss.erb +76 -0
- data/app/controllers/rails_admin/application_controller.rb +4 -3
- data/app/controllers/rails_admin/main_controller.rb +43 -24
- data/app/helpers/rails_admin/application_helper.rb +69 -52
- data/app/helpers/rails_admin/form_builder.rb +7 -4
- data/app/helpers/rails_admin/main_helper.rb +27 -43
- data/app/views/kaminari/ra-twitter-bootstrap/_gap.html.erb +5 -0
- data/app/views/kaminari/ra-twitter-bootstrap/_next_page.html.erb +9 -0
- data/app/views/kaminari/ra-twitter-bootstrap/_page.html.erb +9 -0
- data/app/views/kaminari/ra-twitter-bootstrap/_paginator.html.erb +13 -0
- data/app/views/kaminari/ra-twitter-bootstrap/_prev_page.html.erb +9 -0
- data/app/views/kaminari/ra-twitter-bootstrap/without_count/_next_page.html.erb +9 -0
- data/app/views/kaminari/ra-twitter-bootstrap/without_count/_paginator.html.erb +6 -0
- data/app/views/kaminari/ra-twitter-bootstrap/without_count/_prev_page.html.erb +9 -0
- data/app/views/layouts/rails_admin/_head.html.erb +17 -0
- data/app/views/layouts/rails_admin/_navigation.html.erb +21 -0
- data/app/views/layouts/rails_admin/_secondary_navigation.html.erb +24 -0
- data/app/views/layouts/rails_admin/_sidebar_navigation.html.erb +9 -0
- data/app/views/layouts/rails_admin/application.html.erb +27 -0
- data/app/views/layouts/rails_admin/modal.js.erb +7 -0
- data/app/views/layouts/rails_admin/pjax.html.erb +20 -0
- data/app/views/rails_admin/main/_dashboard_history.html.erb +45 -0
- data/app/views/rails_admin/main/_delete_notice.html.erb +35 -0
- data/app/views/rails_admin/main/_form_action_text.html.erb +7 -0
- data/app/views/rails_admin/main/_form_boolean.html.erb +16 -0
- data/app/views/rails_admin/main/{_form_ck_editor.html.haml → _form_ck_editor.html.erb} +3 -3
- data/app/views/rails_admin/main/_form_code_mirror.html.erb +9 -0
- data/app/views/rails_admin/main/_form_colorpicker.html.erb +1 -0
- data/app/views/rails_admin/main/_form_datetime.html.erb +9 -0
- data/app/views/rails_admin/main/_form_enumeration.html.erb +21 -0
- data/app/views/rails_admin/main/_form_field.html.erb +1 -0
- data/app/views/rails_admin/main/_form_file_upload.html.erb +17 -0
- data/app/views/rails_admin/main/{_form_filtering_multiselect.html.haml → _form_filtering_multiselect.html.erb} +11 -11
- data/app/views/rails_admin/main/{_form_filtering_select.html.haml → _form_filtering_select.html.erb} +13 -12
- data/app/views/rails_admin/main/_form_froala.html.erb +8 -0
- data/app/views/rails_admin/main/_form_multiple_file_upload.html.erb +20 -0
- data/app/views/rails_admin/main/_form_nested_many.html.erb +21 -0
- data/app/views/rails_admin/main/_form_nested_one.html.erb +21 -0
- data/app/views/rails_admin/main/_form_polymorphic_association.html.erb +27 -0
- data/app/views/rails_admin/main/_form_simple_mde.html.erb +8 -0
- data/app/views/rails_admin/main/_form_text.html.erb +1 -0
- data/app/views/rails_admin/main/_form_wysihtml5.html.erb +8 -0
- data/app/views/rails_admin/main/_submit_buttons.html.erb +25 -0
- data/app/views/rails_admin/main/bulk_delete.html.erb +19 -0
- data/app/views/rails_admin/main/dashboard.html.erb +64 -0
- data/app/views/rails_admin/main/delete.html.erb +21 -0
- data/app/views/rails_admin/main/edit.html.erb +3 -0
- data/app/views/rails_admin/main/export.html.erb +146 -0
- data/app/views/rails_admin/main/history.html.erb +78 -0
- data/app/views/rails_admin/main/index.html.erb +193 -0
- data/app/views/rails_admin/main/new.html.erb +3 -0
- data/app/views/rails_admin/main/show.html.erb +28 -0
- data/config/initializers/active_record_extensions.rb +3 -1
- data/config/initializers/mongoid_extensions.rb +1 -1
- data/config/locales/rails_admin.en.yml +6 -1
- data/lib/generators/rails_admin/install_generator.rb +51 -3
- data/lib/generators/rails_admin/templates/environment.js +6 -0
- data/lib/generators/rails_admin/templates/initializer.erb +2 -1
- data/lib/generators/rails_admin/templates/rails_admin.js.erb +2 -0
- data/lib/generators/rails_admin/templates/rails_admin.scss +1 -0
- data/lib/generators/rails_admin/templates/webpack.config.js +32 -0
- data/lib/rails_admin/abstract_model.rb +24 -10
- data/lib/rails_admin/adapters/active_record/association.rb +20 -1
- data/lib/rails_admin/adapters/active_record/object_extension.rb +29 -0
- data/lib/rails_admin/adapters/active_record/property.rb +1 -1
- data/lib/rails_admin/adapters/active_record.rb +27 -23
- data/lib/rails_admin/adapters/mongoid/association.rb +38 -9
- data/lib/rails_admin/adapters/mongoid/bson.rb +4 -5
- data/lib/rails_admin/adapters/mongoid/extension.rb +3 -1
- data/lib/rails_admin/adapters/mongoid/object_extension.rb +32 -0
- data/lib/rails_admin/adapters/mongoid/property.rb +2 -2
- data/lib/rails_admin/adapters/mongoid.rb +27 -19
- data/lib/rails_admin/config/actions/base.rb +7 -2
- data/lib/rails_admin/config/actions/bulk_delete.rb +2 -2
- data/lib/rails_admin/config/actions/dashboard.rb +4 -3
- data/lib/rails_admin/config/actions/delete.rb +5 -9
- data/lib/rails_admin/config/actions/edit.rb +7 -7
- data/lib/rails_admin/config/actions/export.rb +2 -2
- data/lib/rails_admin/config/actions/history_index.rb +2 -2
- data/lib/rails_admin/config/actions/history_show.rb +2 -2
- data/lib/rails_admin/config/actions/index.rb +5 -7
- data/lib/rails_admin/config/actions/new.rb +9 -9
- data/lib/rails_admin/config/actions/show.rb +1 -1
- data/lib/rails_admin/config/actions/show_in_app.rb +6 -2
- data/lib/rails_admin/config/actions.rb +4 -4
- data/lib/rails_admin/config/configurable.rb +2 -2
- data/lib/rails_admin/config/fields/association.rb +15 -12
- data/lib/rails_admin/config/fields/base.rb +44 -24
- data/lib/rails_admin/config/fields/factories/active_storage.rb +1 -0
- data/lib/rails_admin/config/fields/factories/association.rb +6 -8
- data/lib/rails_admin/config/fields/factories/carrierwave.rb +2 -1
- data/lib/rails_admin/config/fields/factories/devise.rb +2 -1
- data/lib/rails_admin/config/fields/factories/dragonfly.rb +2 -1
- data/lib/rails_admin/config/fields/factories/paperclip.rb +2 -1
- data/lib/rails_admin/config/fields/factories/shrine.rb +1 -1
- data/lib/rails_admin/config/fields/group.rb +1 -2
- data/lib/rails_admin/config/fields/types/active_record_enum.rb +2 -0
- data/lib/rails_admin/config/fields/types/active_storage.rb +9 -7
- data/lib/rails_admin/config/fields/types/all.rb +1 -0
- data/lib/rails_admin/config/fields/types/belongs_to_association.rb +4 -12
- data/lib/rails_admin/config/fields/types/boolean.rb +32 -8
- data/lib/rails_admin/config/fields/types/carrierwave.rb +1 -0
- data/lib/rails_admin/config/fields/types/citext.rb +13 -0
- data/lib/rails_admin/config/fields/types/color.rb +6 -2
- data/lib/rails_admin/config/fields/types/date.rb +5 -8
- data/lib/rails_admin/config/fields/types/datetime.rb +18 -21
- data/lib/rails_admin/config/fields/types/decimal.rb +9 -2
- data/lib/rails_admin/config/fields/types/dragonfly.rb +3 -1
- data/lib/rails_admin/config/fields/types/enum.rb +1 -1
- data/lib/rails_admin/config/fields/types/file_upload.rb +4 -3
- data/lib/rails_admin/config/fields/types/float.rb +9 -2
- data/lib/rails_admin/config/fields/types/has_many_association.rb +1 -5
- data/lib/rails_admin/config/fields/types/has_one_association.rb +1 -13
- data/lib/rails_admin/config/fields/types/integer.rb +2 -6
- data/lib/rails_admin/config/fields/types/multiple_active_storage.rb +8 -6
- data/lib/rails_admin/config/fields/types/multiple_carrierwave.rb +1 -0
- data/lib/rails_admin/config/fields/types/multiple_file_upload.rb +4 -3
- data/lib/rails_admin/config/fields/types/numeric.rb +18 -0
- data/lib/rails_admin/config/fields/types/polymorphic_association.rb +3 -2
- data/lib/rails_admin/config/fields/types/string.rb +1 -1
- data/lib/rails_admin/config/fields/types/time.rb +1 -4
- data/lib/rails_admin/config/fields/types/timestamp.rb +0 -4
- data/lib/rails_admin/config/fields/types.rb +1 -1
- data/lib/rails_admin/config/fields.rb +3 -1
- data/lib/rails_admin/config/has_fields.rb +5 -6
- data/lib/rails_admin/config/hideable.rb +1 -1
- data/lib/rails_admin/config/inspectable.rb +1 -3
- data/lib/rails_admin/config/model.rb +10 -10
- data/lib/rails_admin/config/sections/base.rb +2 -3
- data/lib/rails_admin/config/sections/list.rb +4 -15
- data/lib/rails_admin/config/sections.rb +1 -1
- data/lib/rails_admin/config.rb +73 -38
- data/lib/rails_admin/engine.rb +36 -23
- data/lib/rails_admin/extension.rb +6 -14
- data/lib/rails_admin/extensions/cancancan/authorization_adapter.rb +4 -2
- data/lib/rails_admin/extensions/paper_trail/auditing_adapter.rb +13 -8
- data/lib/rails_admin/extensions/pundit/authorization_adapter.rb +6 -7
- data/lib/rails_admin/support/csv_converter.rb +12 -13
- data/lib/rails_admin/support/datetime.rb +40 -74
- data/lib/rails_admin/support/esmodule_preprocessor.rb +32 -0
- data/lib/rails_admin/support/hash_helper.rb +6 -5
- data/lib/rails_admin/version.rb +7 -3
- data/lib/rails_admin.rb +1 -4
- data/lib/tasks/rails_admin.rake +3 -3
- data/package.json +28 -0
- data/src/rails_admin/base.js +21 -0
- data/src/rails_admin/filter-box.js +405 -0
- data/src/rails_admin/filtering-multiselect.js +394 -0
- data/src/rails_admin/filtering-select.js +302 -0
- data/src/rails_admin/i18n.js +19 -0
- data/src/rails_admin/nested-form-hooks.js +100 -0
- data/src/rails_admin/remote-form.js +190 -0
- data/src/rails_admin/sidescroll.js +20 -0
- data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/base/README.txt +0 -0
- data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/base/mixins.scss +0 -0
- data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/base/theming.scss +93 -34
- data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/base/variables.scss +0 -0
- data/src/rails_admin/styles/base.scss +64 -0
- data/src/rails_admin/styles/filtering-multiselect.scss +53 -0
- data/src/rails_admin/styles/filtering-select.scss +70 -0
- data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/cerulean/mixins.scss +0 -0
- data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/cerulean/theming.scss +23 -21
- data/src/rails_admin/styles/themes/cerulean/variables.scss +830 -0
- data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/default/mixins.scss +1 -1
- data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/default/theming.scss +0 -0
- data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/default/variables.scss +1 -1
- data/src/rails_admin/styles/widgets.scss +35 -0
- data/src/rails_admin/ui.js +172 -0
- data/src/rails_admin/vendor/jquery.pjax.js +899 -0
- data/src/rails_admin/vendor/jquery_nested_form.js +122 -0
- data/src/rails_admin/widgets.js +512 -0
- data/vendor/assets/fonts/rails_admin/fa-solid-900.eot +0 -0
- data/vendor/assets/fonts/rails_admin/fa-solid-900.svg +5034 -0
- data/vendor/assets/fonts/rails_admin/fa-solid-900.ttf +0 -0
- data/vendor/assets/fonts/rails_admin/fa-solid-900.woff +0 -0
- data/vendor/assets/fonts/rails_admin/fa-solid-900.woff2 +0 -0
- data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-affix.js +50 -28
- data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-alert.js +10 -7
- data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-button.js +35 -20
- data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-carousel.js +48 -25
- data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-collapse.js +70 -28
- data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-dropdown.js +56 -42
- data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-modal.js +118 -40
- data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-popover.js +26 -16
- data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-scrollspy.js +29 -27
- data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-tab.js +46 -19
- data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-tooltip.js +280 -60
- data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-transition.js +5 -5
- data/vendor/assets/javascripts/rails_admin/bootstrap-datetimepicker.js +317 -150
- data/vendor/assets/javascripts/rails_admin/jquery-ui/data.js +41 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/effect.js +1637 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/ie.js +17 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/keycode.js +47 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/position.js +500 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/safe-active-element.js +42 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/scroll-parent.js +47 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/unique-id.js +51 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/version.js +17 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/widget.js +735 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/widgets/autocomplete.js +689 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/widgets/menu.js +680 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/widgets/mouse.js +230 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/widgets/sortable.js +1561 -0
- data/vendor/assets/javascripts/rails_admin/jquery.pjax.js +317 -160
- data/vendor/assets/javascripts/rails_admin/jquery3.js +10872 -0
- data/vendor/assets/javascripts/rails_admin/moment-with-locales.js +11210 -9290
- data/vendor/assets/stylesheets/rails_admin/font-awesome.scss +4476 -2216
- metadata +118 -262
- data/app/assets/images/rails_admin/aristo/images/bg_fallback.png +0 -0
- data/app/assets/images/rails_admin/aristo/images/icon_sprite.png +0 -0
- data/app/assets/images/rails_admin/aristo/images/progress_bar.gif +0 -0
- data/app/assets/images/rails_admin/aristo/images/slider_handles.png +0 -0
- data/app/assets/images/rails_admin/aristo/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/images/rails_admin/aristo/images/ui-icons_454545_256x240.png +0 -0
- data/app/assets/images/rails_admin/bullet_black.png +0 -0
- data/app/assets/images/rails_admin/bullet_white.png +0 -0
- data/app/assets/images/rails_admin/calendar.png +0 -0
- data/app/assets/images/rails_admin/clock.png +0 -0
- data/app/assets/images/rails_admin/logo.png +0 -0
- data/app/assets/images/rails_admin/magnifier.png +0 -0
- data/app/assets/images/rails_admin/multiselect/icon_sprite.png +0 -0
- data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-n-dark.png +0 -0
- data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-n-light.png +0 -0
- data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-s-dark.png +0 -0
- data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-s-light.png +0 -0
- data/app/assets/javascripts/rails_admin/jquery-ui.js.erb +0 -8
- data/app/assets/javascripts/rails_admin/ra.filter-box.js +0 -248
- data/app/assets/javascripts/rails_admin/ra.filtering-multiselect.js +0 -331
- data/app/assets/javascripts/rails_admin/ra.filtering-select.js +0 -294
- data/app/assets/javascripts/rails_admin/ra.i18n.js +0 -28
- data/app/assets/javascripts/rails_admin/ra.nested-form-hooks.js +0 -59
- data/app/assets/javascripts/rails_admin/ra.remote-form.js +0 -155
- data/app/assets/javascripts/rails_admin/ra.sidescroll.js +0 -31
- data/app/assets/javascripts/rails_admin/ra.widgets.js +0 -379
- data/app/assets/javascripts/rails_admin/rails_admin.js +0 -20
- data/app/assets/javascripts/rails_admin/ui.js +0 -135
- data/app/assets/stylesheets/rails_admin/aristo/images/bg_fallback.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/icon_sprite.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/progress_bar.gif +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/slider_handles.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/ui-icons_454545_256x240.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/jquery-ui-1.8.7.custom.scss +0 -733
- data/app/assets/stylesheets/rails_admin/base/font-awesome-4-compability.scss +0 -153
- data/app/assets/stylesheets/rails_admin/ra.filtering-multiselect.scss +0 -88
- data/app/assets/stylesheets/rails_admin/ra.sidescroll.scss +0 -29
- data/app/assets/stylesheets/rails_admin/ra.widgets.scss +0 -17
- data/app/assets/stylesheets/rails_admin/rails_admin.scss.erb +0 -110
- data/app/assets/stylesheets/rails_admin/themes/cerulean/variables.scss +0 -857
- data/app/views/kaminari/ra-twitter-bootstrap/_gap.html.haml +0 -2
- data/app/views/kaminari/ra-twitter-bootstrap/_next_page.html.haml +0 -4
- data/app/views/kaminari/ra-twitter-bootstrap/_page.html.haml +0 -4
- data/app/views/kaminari/ra-twitter-bootstrap/_paginator.html.haml +0 -9
- data/app/views/kaminari/ra-twitter-bootstrap/_prev_page.html.haml +0 -4
- data/app/views/kaminari/ra-twitter-bootstrap/without_count/_next_page.html.haml +0 -4
- data/app/views/kaminari/ra-twitter-bootstrap/without_count/_paginator.html.haml +0 -4
- data/app/views/kaminari/ra-twitter-bootstrap/without_count/_prev_page.html.haml +0 -4
- data/app/views/layouts/rails_admin/_head.html.haml +0 -7
- data/app/views/layouts/rails_admin/_navigation.html.haml +0 -12
- data/app/views/layouts/rails_admin/_secondary_navigation.html.haml +0 -10
- data/app/views/layouts/rails_admin/_sidebar_navigation.html.haml +0 -3
- data/app/views/layouts/rails_admin/application.html.haml +0 -16
- data/app/views/layouts/rails_admin/pjax.html.haml +0 -12
- data/app/views/rails_admin/main/_dashboard_history.html.haml +0 -21
- data/app/views/rails_admin/main/_delete_notice.html.haml +0 -24
- data/app/views/rails_admin/main/_form_action_text.html.haml +0 -7
- data/app/views/rails_admin/main/_form_boolean.html.haml +0 -3
- data/app/views/rails_admin/main/_form_code_mirror.html.haml +0 -9
- data/app/views/rails_admin/main/_form_colorpicker.html.haml +0 -1
- data/app/views/rails_admin/main/_form_datetime.html.haml +0 -5
- data/app/views/rails_admin/main/_form_enumeration.html.haml +0 -19
- data/app/views/rails_admin/main/_form_field.html.haml +0 -1
- data/app/views/rails_admin/main/_form_file_upload.html.haml +0 -17
- data/app/views/rails_admin/main/_form_froala.html.haml +0 -8
- data/app/views/rails_admin/main/_form_multiple_file_upload.html.haml +0 -16
- data/app/views/rails_admin/main/_form_nested_many.html.haml +0 -15
- data/app/views/rails_admin/main/_form_nested_one.html.haml +0 -17
- data/app/views/rails_admin/main/_form_polymorphic_association.html.haml +0 -26
- data/app/views/rails_admin/main/_form_simple_mde.haml +0 -8
- data/app/views/rails_admin/main/_form_text.html.haml +0 -1
- data/app/views/rails_admin/main/_form_wysihtml5.html.haml +0 -8
- data/app/views/rails_admin/main/_submit_buttons.html.haml +0 -16
- data/app/views/rails_admin/main/bulk_delete.html.haml +0 -11
- data/app/views/rails_admin/main/dashboard.html.haml +0 -34
- data/app/views/rails_admin/main/delete.html.haml +0 -18
- data/app/views/rails_admin/main/edit.html.haml +0 -2
- data/app/views/rails_admin/main/export.html.haml +0 -92
- data/app/views/rails_admin/main/history.html.haml +0 -51
- data/app/views/rails_admin/main/index.html.haml +0 -126
- data/app/views/rails_admin/main/new.html.haml +0 -2
- data/app/views/rails_admin/main/show.html.haml +0 -15
- data/config/initializers/devise_patch.rb +0 -9
- data/config/initializers/haml.rb +0 -5
- data/lib/rails_admin/adapters/active_record/abstract_object.rb +0 -32
- data/lib/rails_admin/adapters/mongoid/abstract_object.rb +0 -42
- data/lib/rails_admin/bootstrap-sass/compass_functions.rb +0 -28
- data/lib/rails_admin/bootstrap-sass/sass_functions.rb +0 -16
- data/lib/rails_admin/bootstrap-sass.rb +0 -49
- data/lib/rails_admin/config/lazy_model.rb +0 -68
- data/lib/rails_admin/extensions/history/auditing_adapter.rb +0 -37
- data/lib/rails_admin/extensions/history/history.rb +0 -44
- data/lib/rails_admin/extensions/history.rb +0 -3
- data/lib/rails_admin/support/i18n.rb +0 -43
- data/vendor/assets/fonts/rails_admin/FontAwesome.otf +0 -0
- data/vendor/assets/fonts/rails_admin/fontawesome-webfont.eot +0 -0
- data/vendor/assets/fonts/rails_admin/fontawesome-webfont.svg +0 -2671
- data/vendor/assets/fonts/rails_admin/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/rails_admin/fontawesome-webfont.woff +0 -0
- data/vendor/assets/fonts/rails_admin/fontawesome-webfont.woff2 +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_background.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_hex.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_hsb_b.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_hsb_h.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_hsb_s.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_indic.gif +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_overlay.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_rgb_b.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_rgb_g.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_rgb_r.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_select.gif +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_submit.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_background.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_hex.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_hsb_b.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_hsb_h.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_hsb_s.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_indic.gif +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_rgb_b.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_rgb_g.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_rgb_r.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_submit.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/select.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/select2.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/slider.png +0 -0
- data/vendor/assets/javascripts/rails_admin/jquery.colorpicker.js +0 -484
- data/vendor/assets/stylesheets/rails_admin/jquery.colorpicker.scss +0 -182
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6a3860d340dafc631d3b97b72508bf26782d7f2732daddeba6aa629b72ac60b
|
4
|
+
data.tar.gz: 7d7cd7eac8ca04528958f760d2bd59acd68f72f9a24878775c8893ba40c7cf05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6351ecf1eb04ab4d5602de37ebb0befb45da0a718002090ea9d8934add568b8d1dba427e4c2cfeb5b55ee6312949a572a0877a8314b082433d2be43a12512286
|
7
|
+
data.tar.gz: fb0d398eee9cc4ba0b5580ad382d7ef10c33c45a5b4ea2b644f15dc4c7375fbc0d5a12592d28e75c74f8eb0f9090f120aad0d001da5708a27e16cf6e6596b819
|
data/Gemfile
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
gem 'appraisal', '>= 2.0'
|
4
|
-
gem 'rails'
|
5
|
-
gem 'haml'
|
6
4
|
gem 'devise'
|
5
|
+
gem 'rails'
|
6
|
+
gem 'webpacker', require: false
|
7
|
+
gem 'webrick', '~> 1.7'
|
7
8
|
|
8
9
|
group :active_record do
|
9
10
|
gem 'paper_trail'
|
@@ -21,30 +22,27 @@ end
|
|
21
22
|
group :test do
|
22
23
|
gem 'cancancan', '~> 3.0'
|
23
24
|
gem 'carrierwave', ['>= 2.0.0.rc', '< 3']
|
24
|
-
gem '
|
25
|
+
gem 'cuprite'
|
26
|
+
gem 'database_cleaner-active_record', '>= 2.0', require: false
|
27
|
+
gem 'database_cleaner-mongoid', '>= 2.0', require: false
|
25
28
|
gem 'dragonfly', '~> 1.0'
|
26
29
|
gem 'factory_bot', '>= 4.2'
|
27
30
|
gem 'generator_spec', '>= 0.8'
|
28
31
|
gem 'launchy', '>= 2.2'
|
29
32
|
gem 'mini_magick', '>= 3.4'
|
30
|
-
gem 'poltergeist', '~> 1.5'
|
31
33
|
gem 'pundit'
|
32
34
|
gem 'rack-cache', require: 'rack/cache'
|
33
|
-
gem 'rspec-rails', '>= 2.14'
|
34
35
|
gem 'rspec-expectations', '!= 3.8.3'
|
36
|
+
gem 'rspec-rails', '>= 2.14'
|
35
37
|
gem 'rspec-retry'
|
36
|
-
gem 'rubocop', '~>
|
38
|
+
gem 'rubocop', ['~> 1.20', '!= 1.22.2'], require: false
|
37
39
|
gem 'rubocop-performance', require: false
|
38
40
|
gem 'simplecov', '>= 0.9', require: false
|
39
41
|
gem 'simplecov-lcov', require: false
|
40
42
|
gem 'timecop', '>= 0.5'
|
41
43
|
|
42
|
-
platforms :ruby_19 do
|
43
|
-
gem 'tins', '~> 1.6.0', require: false
|
44
|
-
end
|
45
|
-
|
46
44
|
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
47
|
-
gem 'tzinfo-data', platforms: %i
|
45
|
+
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
|
48
46
|
end
|
49
47
|
|
50
48
|
gemspec
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
[![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=rails_admin&package-manager=bundler&version-scheme=semver)][semver]
|
9
9
|
|
10
10
|
[gem]: https://rubygems.org/gems/rails_admin
|
11
|
-
[ghactions]: https://github.com/
|
11
|
+
[ghactions]: https://github.com/railsadminteam/rails_admin/actions
|
12
12
|
[coveralls]: https://coveralls.io/r/sferik/rails_admin
|
13
13
|
[inch]: http://inch-ci.org/github/sferik/rails_admin
|
14
14
|
[codeclimate]: https://codeclimate.com/github/sferik/rails_admin
|
@@ -20,49 +20,56 @@ RailsAdmin is a Rails engine that provides an easy-to-use interface for managing
|
|
20
20
|
|
21
21
|
### [Action required] Security issue
|
22
22
|
|
23
|
-
**RailsAdmin 2.0.1, 2.0.0 and up to 1.4.2 have been reported to have XSS vulnerability.** We strongly recommend that you upgrade RailsAdmin to 2.0.2 (and higher) or 1.4.3 as soon as possible, if you are on those versions. See [d72090ec](https://github.com/
|
23
|
+
**RailsAdmin 2.0.1, 2.0.0 and up to 1.4.2 have been reported to have XSS vulnerability.** We strongly recommend that you upgrade RailsAdmin to 2.0.2 (and higher) or 1.4.3 as soon as possible, if you are on those versions. See [d72090ec](https://github.com/railsadminteam/rails_admin/commit/d72090ec6a07c3b9b7b48ab50f3d405f91ff4375) for the detail.
|
24
24
|
|
25
25
|
## Getting started
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
- Check out [the docs][docs].
|
28
|
+
- Try the [live demo][demo]. ([Source code][dummy_app])
|
29
29
|
|
30
30
|
[demo]: http://rails-admin-tb.herokuapp.com/
|
31
31
|
[dummy_app]: https://github.com/bbenezech/dummy_app
|
32
|
-
[docs]: https://github.com/
|
32
|
+
[docs]: https://github.com/railsadminteam/rails_admin/wiki
|
33
33
|
|
34
34
|
## Features
|
35
|
-
* CRUD any data with ease
|
36
|
-
* Custom actions
|
37
|
-
* Automatic form validation
|
38
|
-
* Search and filtering
|
39
|
-
* Export data to CSV/JSON/XML
|
40
|
-
* Authentication (via [Devise](https://github.com/plataformatec/devise) or other)
|
41
|
-
* Authorization (via [CanCanCan](https://github.com/CanCanCommunity/cancancan) or [Pundit](https://github.com/elabs/pundit))
|
42
|
-
* User action history (via [PaperTrail](https://github.com/airblade/paper_trail))
|
43
|
-
* Supported ORMs
|
44
|
-
* ActiveRecord
|
45
|
-
* Mongoid
|
46
|
-
|
47
35
|
|
36
|
+
- CRUD any data with ease
|
37
|
+
- Custom actions
|
38
|
+
- Automatic form validation
|
39
|
+
- Search and filtering
|
40
|
+
- Export data to CSV/JSON/XML
|
41
|
+
- Authentication (via [Devise](https://github.com/plataformatec/devise) or other)
|
42
|
+
- Authorization (via [CanCanCan](https://github.com/CanCanCommunity/cancancan) or [Pundit](https://github.com/elabs/pundit))
|
43
|
+
- User action history (via [PaperTrail](https://github.com/airblade/paper_trail))
|
44
|
+
- Supported ORMs
|
45
|
+
- ActiveRecord
|
46
|
+
- Mongoid
|
48
47
|
|
49
48
|
## Installation
|
50
49
|
|
51
|
-
1. On your gemfile: `gem 'rails_admin', '
|
50
|
+
1. On your gemfile: `gem 'rails_admin', ['>= 3.0.0.beta', '< 4']`
|
52
51
|
2. Run `bundle install`
|
53
52
|
3. Run `rails g rails_admin:install`
|
54
53
|
4. Provide a namespace for the routes when asked
|
55
54
|
5. Start a server `rails s` and administer your data at [/admin](http://localhost:3000/admin). (if you chose default namespace: /admin)
|
56
55
|
|
56
|
+
## Upgrading from 2.x
|
57
|
+
|
58
|
+
Due to introduction of Webpack/Webpacker support, some additional dependency and configuration will be needed.
|
59
|
+
Running `rails g rails_admin:install` will suggest you some required changes, based on current setup of your app.
|
60
|
+
|
57
61
|
## Configuration
|
62
|
+
|
58
63
|
### Global
|
64
|
+
|
59
65
|
In `config/initializers/rails_admin.rb`:
|
60
66
|
|
61
|
-
[Details](https://github.com/
|
67
|
+
[Details](https://github.com/railsadminteam/rails_admin/wiki/Base-configuration)
|
62
68
|
|
63
|
-
To begin with, you may be interested in setting up [Devise](https://github.com/
|
69
|
+
To begin with, you may be interested in setting up [Devise](https://github.com/railsadminteam/rails_admin/wiki/Devise), [CanCanCan](https://github.com/railsadminteam/rails_admin/wiki/Cancancan) or [Papertrail](https://github.com/railsadminteam/rails_admin/wiki/Papertrail)!
|
64
70
|
|
65
71
|
### Per model
|
72
|
+
|
66
73
|
```ruby
|
67
74
|
class Ball < ActiveRecord::Base
|
68
75
|
validates :name, presence: true
|
@@ -76,31 +83,30 @@ class Ball < ActiveRecord::Base
|
|
76
83
|
end
|
77
84
|
```
|
78
85
|
|
79
|
-
Details: [Models](https://github.com/
|
86
|
+
Details: [Models](https://github.com/railsadminteam/rails_admin/wiki/Models), [Groups](https://github.com/railsadminteam/rails_admin/wiki/Groups), [Fields](https://github.com/railsadminteam/rails_admin/wiki/Fields)
|
80
87
|
|
81
88
|
## Support
|
89
|
+
|
82
90
|
If you have a question, please check this README, the wiki, and the [list of
|
83
91
|
known issues][troubleshoot].
|
84
92
|
|
85
|
-
[troubleshoot]: https://github.com/
|
93
|
+
[troubleshoot]: https://github.com/railsadminteam/rails_admin/wiki/Troubleshoot
|
86
94
|
|
87
95
|
If you still have a question, you can ask the [official RailsAdmin mailing
|
88
96
|
list][list].
|
89
97
|
|
90
98
|
[list]: http://groups.google.com/group/rails_admin
|
91
99
|
|
92
|
-
If you think you found a bug in RailsAdmin, you can [submit an issue](https://github.com/
|
100
|
+
If you think you found a bug in RailsAdmin, you can [submit an issue](https://github.com/railsadminteam/rails_admin/issues/new).
|
93
101
|
|
94
102
|
## Supported Ruby Versions
|
103
|
+
|
95
104
|
This library aims to support and is [tested against][ghactions] the following Ruby implementations:
|
96
105
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
* Ruby 2.7
|
103
|
-
* Ruby 3.0
|
104
|
-
* [JRuby][]
|
106
|
+
- Ruby 2.5
|
107
|
+
- Ruby 2.6
|
108
|
+
- Ruby 2.7
|
109
|
+
- Ruby 3.0
|
110
|
+
- [JRuby][]
|
105
111
|
|
106
112
|
[jruby]: http://jruby.org/
|
data/Rakefile
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
//= require 'rails-ujs'
|
2
|
+
//= require 'rails_admin/jquery3'
|
3
|
+
//= require 'rails_admin/jquery.pjax'
|
4
|
+
//= require 'jquery_nested_form'
|
5
|
+
//= require 'rails_admin/jquery-ui/effect'
|
6
|
+
//= require 'rails_admin/jquery-ui/widgets/sortable'
|
7
|
+
//= require 'rails_admin/jquery-ui/widgets/autocomplete'
|
8
|
+
//= require 'rails_admin/moment-with-locales'
|
9
|
+
//= require 'rails_admin/bootstrap-datetimepicker'
|
10
|
+
//= require 'rails_admin/bootstrap/bootstrap'
|
11
|
+
|
12
|
+
//= require 'rails_admin/filter-box'
|
13
|
+
//= require 'rails_admin/filtering-multiselect'
|
14
|
+
//= require 'rails_admin/filtering-select'
|
15
|
+
//= require 'rails_admin/remote-form'
|
16
|
+
//= require 'rails_admin/nested-form-hooks'
|
17
|
+
//= require 'rails_admin/i18n'
|
18
|
+
//= require 'rails_admin/widgets'
|
19
|
+
//= require 'rails_admin/sidescroll'
|
20
|
+
//= require 'rails_admin/ui'
|
21
|
+
//= require 'rails_admin/custom/ui'
|
@@ -6,6 +6,6 @@
|
|
6
6
|
Available mixins to use/override:
|
7
7
|
|
8
8
|
https://github.com/twbs/bootstrap-sass/tree/master/assets/stylesheets/bootstrap/mixins
|
9
|
-
https://github.com/
|
9
|
+
https://github.com/railsadminteam/rails_admin/blob/master/src/rails_admin/styles/base/mixins.scss
|
10
10
|
Plus the ones from your theme.
|
11
11
|
*/
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Available variables to use/override:
|
7
7
|
|
8
8
|
https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/bootstrap/_variables.scss
|
9
|
-
https://github.com/
|
9
|
+
https://github.com/railsadminteam/rails_admin/blob/master/src/rails_admin/styles/base/variables.scss
|
10
10
|
Plus the ones from your themes.
|
11
11
|
|
12
12
|
Test me: pink links
|
@@ -0,0 +1,76 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
|
3
|
+
<%
|
4
|
+
theme = ENV['RAILS_ADMIN_THEME'] || :default
|
5
|
+
%>
|
6
|
+
|
7
|
+
/*** Variables ***/
|
8
|
+
|
9
|
+
@import "rails_admin/custom/variables";
|
10
|
+
@import "rails_admin/bootstrap/variables";
|
11
|
+
@import "rails_admin/styles/base/variables";
|
12
|
+
@import "rails_admin/styles/themes/<%= theme %>/variables";
|
13
|
+
|
14
|
+
/*** Mixins ***/
|
15
|
+
|
16
|
+
@import "rails_admin/bootstrap/mixins";
|
17
|
+
@import "rails_admin/styles/base/mixins";
|
18
|
+
@import "rails_admin/styles/themes/<%= theme %>/mixins";
|
19
|
+
@import "rails_admin/custom/mixins";
|
20
|
+
|
21
|
+
/*** Libraries ***/
|
22
|
+
|
23
|
+
@import "rails_admin/bootstrap-datetimepicker-build";
|
24
|
+
@import "rails_admin/styles/filtering-select";
|
25
|
+
@import "rails_admin/styles/filtering-multiselect";
|
26
|
+
@import "rails_admin/styles/widgets";
|
27
|
+
|
28
|
+
|
29
|
+
/*** Font-awesome ***/
|
30
|
+
|
31
|
+
@import 'rails_admin/font-awesome';
|
32
|
+
|
33
|
+
/*** Bootstrap Theming ***/
|
34
|
+
|
35
|
+
@import "rails_admin/bootstrap/normalize";
|
36
|
+
@import "rails_admin/bootstrap/scaffolding";
|
37
|
+
@import "rails_admin/bootstrap/grid";
|
38
|
+
<%# @import "rails_admin/bootstrap/layouts"; %>
|
39
|
+
@import "rails_admin/bootstrap/type";
|
40
|
+
@import "rails_admin/bootstrap/forms";
|
41
|
+
@import "rails_admin/bootstrap/tables";
|
42
|
+
@import "rails_admin/bootstrap/dropdowns";
|
43
|
+
@import "rails_admin/bootstrap/wells";
|
44
|
+
@import "rails_admin/bootstrap/component-animations";
|
45
|
+
@import "rails_admin/bootstrap/close";
|
46
|
+
@import "rails_admin/bootstrap/buttons";
|
47
|
+
@import "rails_admin/bootstrap/button-groups";
|
48
|
+
@import "rails_admin/bootstrap/input-groups";
|
49
|
+
@import "rails_admin/bootstrap/alerts";
|
50
|
+
@import "rails_admin/bootstrap/navs";
|
51
|
+
@import "rails_admin/bootstrap/navbar";
|
52
|
+
@import "rails_admin/bootstrap/breadcrumbs";
|
53
|
+
@import "rails_admin/bootstrap/pagination";
|
54
|
+
@import "rails_admin/bootstrap/pager";
|
55
|
+
@import "rails_admin/bootstrap/modals";
|
56
|
+
@import "rails_admin/bootstrap/tooltip";
|
57
|
+
@import "rails_admin/bootstrap/popovers";
|
58
|
+
@import "rails_admin/bootstrap/thumbnails";
|
59
|
+
@import "rails_admin/bootstrap/labels";
|
60
|
+
@import "rails_admin/bootstrap/panels";
|
61
|
+
@import "rails_admin/bootstrap/badges";
|
62
|
+
@import "rails_admin/bootstrap/progress-bars";
|
63
|
+
<%# @import "rails_admin/bootstrap/accordion"; %>
|
64
|
+
@import "rails_admin/bootstrap/carousel";
|
65
|
+
<%# @import "rails_admin/bootstrap/hero-unit"; %>
|
66
|
+
@import "rails_admin/bootstrap/utilities";
|
67
|
+
@import "rails_admin/bootstrap/responsive-utilities";
|
68
|
+
|
69
|
+
/*** RailsAdmin Theming ***/
|
70
|
+
|
71
|
+
@import "rails_admin/styles/base/theming";
|
72
|
+
@import "rails_admin/styles/themes/<%= theme %>/theming";
|
73
|
+
@import "rails_admin/custom/theming";
|
74
|
+
|
75
|
+
|
76
|
+
|
@@ -25,13 +25,14 @@ module RailsAdmin
|
|
25
25
|
|
26
26
|
def get_model
|
27
27
|
@model_name = to_model_name(params[:model_name])
|
28
|
-
raise
|
29
|
-
raise
|
28
|
+
raise RailsAdmin::ModelNotFound unless (@abstract_model = RailsAdmin::AbstractModel.new(@model_name))
|
29
|
+
raise RailsAdmin::ModelNotFound if (@model_config = @abstract_model.config).excluded?
|
30
|
+
|
30
31
|
@properties = @abstract_model.properties
|
31
32
|
end
|
32
33
|
|
33
34
|
def get_object
|
34
|
-
raise
|
35
|
+
raise RailsAdmin::ObjectNotFound unless (@object = @abstract_model.get(params[:id]))
|
35
36
|
end
|
36
37
|
|
37
38
|
def to_model_name(param)
|
@@ -6,31 +6,16 @@ module RailsAdmin
|
|
6
6
|
|
7
7
|
layout :get_layout
|
8
8
|
|
9
|
-
before_action :get_model, except: RailsAdmin::Config::Actions.all(:root).collect(&:action_name)
|
10
|
-
before_action :get_object, only: RailsAdmin::Config::Actions.all(:member).collect(&:action_name)
|
11
9
|
before_action :check_for_cancel
|
12
10
|
|
13
|
-
RailsAdmin::Config::Actions.all.each do |action|
|
14
|
-
class_eval <<-EOS, __FILE__, __LINE__ + 1
|
15
|
-
def #{action.action_name}
|
16
|
-
action = RailsAdmin::Config::Actions.find('#{action.action_name}'.to_sym)
|
17
|
-
@authorization_adapter.try(:authorize, action.authorization_key, @abstract_model, @object)
|
18
|
-
@action = action.with({controller: self, abstract_model: @abstract_model, object: @object})
|
19
|
-
fail(ActionNotAllowed) unless @action.enabled?
|
20
|
-
@page_name = wording_for(:title)
|
21
|
-
|
22
|
-
instance_eval &@action.controller
|
23
|
-
end
|
24
|
-
EOS
|
25
|
-
end
|
26
|
-
|
27
11
|
def bulk_action
|
28
|
-
|
12
|
+
get_model
|
13
|
+
process(params[:bulk_action]) if params[:bulk_action].in?(RailsAdmin::Config::Actions.all(controller: self, abstract_model: @abstract_model).select(&:bulkable?).collect(&:route_fragment))
|
29
14
|
end
|
30
15
|
|
31
16
|
def list_entries(model_config = @model_config, auth_scope_key = :index, additional_scope = get_association_scope_from_params, pagination = !(params[:associated_collection] || params[:all] || params[:bulk_ids]))
|
32
17
|
scope = model_config.abstract_model.scoped
|
33
|
-
if auth_scope = @authorization_adapter
|
18
|
+
if auth_scope = @authorization_adapter&.query(auth_scope_key, model_config.abstract_model)
|
34
19
|
scope = scope.merge(auth_scope)
|
35
20
|
end
|
36
21
|
scope = scope.instance_eval(&additional_scope) if additional_scope
|
@@ -39,6 +24,38 @@ module RailsAdmin
|
|
39
24
|
|
40
25
|
private
|
41
26
|
|
27
|
+
def action_missing(name, *_args)
|
28
|
+
action = RailsAdmin::Config::Actions.find(name.to_sym)
|
29
|
+
raise AbstractController::ActionNotFound.new("The action '#{name}' could not be found for #{self.class.name}") unless action
|
30
|
+
|
31
|
+
get_model unless action.root?
|
32
|
+
get_object if action.member?
|
33
|
+
@authorization_adapter.try(:authorize, action.authorization_key, @abstract_model, @object)
|
34
|
+
@action = action.with({controller: self, abstract_model: @abstract_model, object: @object})
|
35
|
+
raise(ActionNotAllowed) unless @action.enabled?
|
36
|
+
|
37
|
+
@page_name = wording_for(:title)
|
38
|
+
|
39
|
+
instance_eval(&@action.controller)
|
40
|
+
end
|
41
|
+
|
42
|
+
def method_missing(name, *args, &block)
|
43
|
+
action = RailsAdmin::Config::Actions.find(name.to_sym)
|
44
|
+
if action
|
45
|
+
action_missing name, *args, &block
|
46
|
+
else
|
47
|
+
super
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def respond_to_missing?(sym, include_private)
|
52
|
+
if RailsAdmin::Config::Actions.find(name.to_sym)
|
53
|
+
true
|
54
|
+
else
|
55
|
+
super
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
42
59
|
def get_layout
|
43
60
|
"rails_admin/#{request.headers['X-PJAX'] ? 'pjax' : 'application'}"
|
44
61
|
end
|
@@ -54,7 +71,7 @@ module RailsAdmin
|
|
54
71
|
params[:sort_reverse] ||= 'false'
|
55
72
|
|
56
73
|
field = model_config.list.fields.detect { |f| f.name.to_s == params[:sort] }
|
57
|
-
column =
|
74
|
+
column =
|
58
75
|
if field.nil? || field.sortable == true # use params[:sort] on the base table
|
59
76
|
"#{abstract_model.table_name}.#{params[:sort]}"
|
60
77
|
elsif field.sortable == false # use default sort, asked field is not sortable
|
@@ -68,7 +85,6 @@ module RailsAdmin
|
|
68
85
|
else # use described column in the field conf.
|
69
86
|
"#{abstract_model.table_name}.#{field.sortable}"
|
70
87
|
end
|
71
|
-
end
|
72
88
|
|
73
89
|
reversed_sort = (field ? field.sort_reverse? : model_config.list.sort_reverse?)
|
74
90
|
{sort: column, sort_reverse: (params[:sort_reverse] == reversed_sort.to_s)}
|
@@ -91,6 +107,7 @@ module RailsAdmin
|
|
91
107
|
|
92
108
|
def sanitize_params_for!(action, model_config = @model_config, target_params = params[@abstract_model.param_key])
|
93
109
|
return unless target_params.present?
|
110
|
+
|
94
111
|
fields = visible_fields(action, model_config)
|
95
112
|
allowed_methods = fields.collect(&:allowed_methods).flatten.uniq.collect(&:to_s) << 'id' << '_destroy'
|
96
113
|
fields.each { |field| field.parse_input(target_params) }
|
@@ -110,20 +127,21 @@ module RailsAdmin
|
|
110
127
|
|
111
128
|
respond_to do |format|
|
112
129
|
format.html { render whereto, status: :not_acceptable }
|
113
|
-
format.js { render whereto, layout:
|
130
|
+
format.js { render whereto, layout: 'rails_admin/modal', status: :not_acceptable, content_type: Mime[:html].to_s }
|
114
131
|
end
|
115
132
|
end
|
116
133
|
|
117
134
|
def check_for_cancel
|
118
135
|
return unless params[:_continue] || (params[:bulk_action] && !params[:bulk_ids])
|
136
|
+
|
119
137
|
redirect_to(back_or_index, notice: I18n.t('admin.flash.noaction'))
|
120
138
|
end
|
121
139
|
|
122
140
|
def get_collection(model_config, scope, pagination)
|
123
|
-
|
141
|
+
eager_loads = model_config.list.fields.flat_map(&:eager_load_values)
|
124
142
|
options = {}
|
125
143
|
options = options.merge(page: (params[Kaminari.config.param_name] || 1).to_i, per: (params[:per] || model_config.list.items_per_page)) if pagination
|
126
|
-
options = options.merge(include:
|
144
|
+
options = options.merge(include: eager_loads) unless eager_loads.blank?
|
127
145
|
options = options.merge(get_sort_hash(model_config))
|
128
146
|
options = options.merge(query: params[:query]) if params[:query].present?
|
129
147
|
options = options.merge(filters: params[:f]) if params[:f].present?
|
@@ -133,10 +151,11 @@ module RailsAdmin
|
|
133
151
|
|
134
152
|
def get_association_scope_from_params
|
135
153
|
return nil unless params[:associated_collection].present?
|
154
|
+
|
136
155
|
source_abstract_model = RailsAdmin::AbstractModel.new(to_model_name(params[:source_abstract_model]))
|
137
156
|
source_model_config = source_abstract_model.config
|
138
157
|
source_object = source_abstract_model.get(params[:source_object_id])
|
139
|
-
action = params[:current_action].in?(%w
|
158
|
+
action = params[:current_action].in?(%w[create update]) ? params[:current_action] : 'edit'
|
140
159
|
@association = source_model_config.send(action).fields.detect { |f| f.name == params[:associated_collection].to_sym }.with(controller: self, object: source_object)
|
141
160
|
@association.associated_collection_scope
|
142
161
|
end
|