rails_admin 2.3.1 → 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 +5 -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 +5 -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 +19 -21
- 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 +25 -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 +12 -7
- 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 +8 -4
- 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/theming.scss +93 -34
- 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/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/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/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/jquery3.js +10872 -0
- data/vendor/assets/stylesheets/rails_admin/font-awesome.scss +4476 -2216
- metadata +118 -263
- 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/jquery.migrate.js +0 -3
- data/app/assets/javascripts/rails_admin/ra.filter-box.js +0 -253
- 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 -21
- 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/haml.rb +0 -5
- data/lib/rails_admin/adapters/active_record/abstract_object.rb +0 -38
- data/lib/rails_admin/adapters/active_record.rb.bak +0 -348
- 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
- /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/variables.scss +0 -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/default/theming.scss +0 -0
@@ -18,7 +18,7 @@ module RailsAdmin
|
|
18
18
|
|
19
19
|
register_instance_option :controller do
|
20
20
|
proc do
|
21
|
-
@history = @auditing_adapter
|
21
|
+
@history = @auditing_adapter&.latest(@action.auditing_versions_limit) || []
|
22
22
|
if @action.statistics?
|
23
23
|
@abstract_models = RailsAdmin::Config.visible_models(controller: self).collect(&:abstract_model)
|
24
24
|
|
@@ -26,11 +26,12 @@ module RailsAdmin
|
|
26
26
|
@count = {}
|
27
27
|
@max = 0
|
28
28
|
@abstract_models.each do |t|
|
29
|
-
scope = @authorization_adapter
|
29
|
+
scope = @authorization_adapter&.query(:index, t)
|
30
30
|
current_count = t.count({}, scope)
|
31
31
|
@max = current_count > @max ? current_count : @max
|
32
32
|
@count[t.model.name] = current_count
|
33
33
|
next unless t.properties.detect { |c| c.name == :created_at }
|
34
|
+
|
34
35
|
@most_recent_created[t.model.name] = t.model.last.try(:created_at)
|
35
36
|
end
|
36
37
|
end
|
@@ -43,7 +44,7 @@ module RailsAdmin
|
|
43
44
|
end
|
44
45
|
|
45
46
|
register_instance_option :link_icon do
|
46
|
-
'
|
47
|
+
'fas fa-home'
|
47
48
|
end
|
48
49
|
|
49
50
|
register_instance_option :statistics? do
|
@@ -13,7 +13,7 @@ module RailsAdmin
|
|
13
13
|
end
|
14
14
|
|
15
15
|
register_instance_option :http_methods do
|
16
|
-
[
|
16
|
+
%i[get delete]
|
17
17
|
end
|
18
18
|
|
19
19
|
register_instance_option :authorization_key do
|
@@ -31,24 +31,20 @@ module RailsAdmin
|
|
31
31
|
|
32
32
|
elsif request.delete? # DESTROY
|
33
33
|
|
34
|
-
|
35
|
-
@auditing_adapter && @auditing_adapter.delete_object(@object, @abstract_model, _current_user)
|
34
|
+
@auditing_adapter&.delete_object(@object, @abstract_model, _current_user)
|
36
35
|
if @object.destroy
|
37
36
|
flash[:success] = t('admin.flash.successful', name: @model_config.label, action: t('admin.actions.delete.done'))
|
38
|
-
|
37
|
+
redirect_to index_path
|
39
38
|
else
|
40
|
-
|
41
|
-
redirect_path = back_or_index
|
39
|
+
handle_save_error :delete
|
42
40
|
end
|
43
41
|
|
44
|
-
redirect_to redirect_path
|
45
|
-
|
46
42
|
end
|
47
43
|
end
|
48
44
|
end
|
49
45
|
|
50
46
|
register_instance_option :link_icon do
|
51
|
-
'
|
47
|
+
'fas fa-times'
|
52
48
|
end
|
53
49
|
end
|
54
50
|
end
|
@@ -9,7 +9,7 @@ module RailsAdmin
|
|
9
9
|
end
|
10
10
|
|
11
11
|
register_instance_option :http_methods do
|
12
|
-
[
|
12
|
+
%i[get put]
|
13
13
|
end
|
14
14
|
|
15
15
|
register_instance_option :controller do
|
@@ -18,20 +18,20 @@ module RailsAdmin
|
|
18
18
|
|
19
19
|
respond_to do |format|
|
20
20
|
format.html { render @action.template_name }
|
21
|
-
format.js { render @action.template_name, layout:
|
21
|
+
format.js { render @action.template_name, layout: 'rails_admin/modal', content_type: Mime[:html].to_s }
|
22
22
|
end
|
23
23
|
|
24
24
|
elsif request.put? # UPDATE
|
25
25
|
sanitize_params_for!(request.xhr? ? :modal : :update)
|
26
26
|
|
27
|
-
@object.
|
28
|
-
@authorization_adapter
|
27
|
+
@object.assign_attributes(params[@abstract_model.param_key])
|
28
|
+
@authorization_adapter&.authorize(:update, @abstract_model, @object)
|
29
29
|
changes = @object.changes
|
30
30
|
if @object.save
|
31
|
-
@auditing_adapter
|
31
|
+
@auditing_adapter&.update_object(@object, @abstract_model, _current_user, changes)
|
32
32
|
respond_to do |format|
|
33
33
|
format.html { redirect_to_on_success }
|
34
|
-
format.
|
34
|
+
format.json { render json: {id: @object.id.to_s, label: @model_config.with(object: @object).object_label} }
|
35
35
|
end
|
36
36
|
else
|
37
37
|
handle_save_error :edit
|
@@ -42,7 +42,7 @@ module RailsAdmin
|
|
42
42
|
end
|
43
43
|
|
44
44
|
register_instance_option :link_icon do
|
45
|
-
'
|
45
|
+
'fas fa-pencil-alt'
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -9,7 +9,7 @@ module RailsAdmin
|
|
9
9
|
end
|
10
10
|
|
11
11
|
register_instance_option :http_methods do
|
12
|
-
[
|
12
|
+
%i[get post]
|
13
13
|
end
|
14
14
|
|
15
15
|
register_instance_option :controller do
|
@@ -30,7 +30,7 @@ module RailsAdmin
|
|
30
30
|
end
|
31
31
|
|
32
32
|
register_instance_option :link_icon do
|
33
|
-
'
|
33
|
+
'fas fa-file-export'
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -19,7 +19,7 @@ module RailsAdmin
|
|
19
19
|
register_instance_option :controller do
|
20
20
|
proc do
|
21
21
|
@general = true
|
22
|
-
@history = @auditing_adapter
|
22
|
+
@history = @auditing_adapter&.listing_for_model(@abstract_model, params[:query], params[:sort], params[:sort_reverse], params[:all], params[Kaminari.config.param_name]) || []
|
23
23
|
|
24
24
|
render @action.template_name
|
25
25
|
end
|
@@ -30,7 +30,7 @@ module RailsAdmin
|
|
30
30
|
end
|
31
31
|
|
32
32
|
register_instance_option :link_icon do
|
33
|
-
'
|
33
|
+
'fas fa-book'
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -19,7 +19,7 @@ module RailsAdmin
|
|
19
19
|
register_instance_option :controller do
|
20
20
|
proc do
|
21
21
|
@general = false
|
22
|
-
@history = @auditing_adapter
|
22
|
+
@history = @auditing_adapter&.listing_for_object(@abstract_model, @object, params[:query], params[:sort], params[:sort_reverse], params[:all], params[Kaminari.config.param_name]) || []
|
23
23
|
|
24
24
|
render @action.template_name
|
25
25
|
end
|
@@ -30,7 +30,7 @@ module RailsAdmin
|
|
30
30
|
end
|
31
31
|
|
32
32
|
register_instance_option :link_icon do
|
33
|
-
'
|
33
|
+
'fas fa-book'
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -11,7 +11,7 @@ module RailsAdmin
|
|
11
11
|
end
|
12
12
|
|
13
13
|
register_instance_option :http_methods do
|
14
|
-
[
|
14
|
+
%i[get post]
|
15
15
|
end
|
16
16
|
|
17
17
|
register_instance_option :route_fragment do
|
@@ -33,9 +33,7 @@ module RailsAdmin
|
|
33
33
|
|
34
34
|
unless @model_config.list.scopes.empty?
|
35
35
|
if params[:scope].blank?
|
36
|
-
unless @model_config.list.scopes.first.nil?
|
37
|
-
@objects = @objects.send(@model_config.list.scopes.first)
|
38
|
-
end
|
36
|
+
@objects = @objects.send(@model_config.list.scopes.first) unless @model_config.list.scopes.first.nil?
|
39
37
|
elsif @model_config.list.scopes.collect(&:to_s).include?(params[:scope])
|
40
38
|
@objects = @objects.send(params[:scope].to_sym)
|
41
39
|
end
|
@@ -47,7 +45,7 @@ module RailsAdmin
|
|
47
45
|
end
|
48
46
|
|
49
47
|
format.json do
|
50
|
-
output =
|
48
|
+
output =
|
51
49
|
if params[:compact]
|
52
50
|
primary_key_method = @association ? @association.associated_primary_key : @model_config.abstract_model.primary_key
|
53
51
|
label_method = @model_config.object_label_method
|
@@ -55,7 +53,7 @@ module RailsAdmin
|
|
55
53
|
else
|
56
54
|
@objects.to_json(@schema)
|
57
55
|
end
|
58
|
-
|
56
|
+
|
59
57
|
if params[:send_data]
|
60
58
|
send_data output, filename: "#{params[:model_name]}_#{DateTime.now.strftime('%Y-%m-%d_%Hh%Mm%S')}.json"
|
61
59
|
else
|
@@ -87,7 +85,7 @@ module RailsAdmin
|
|
87
85
|
end
|
88
86
|
|
89
87
|
register_instance_option :link_icon do
|
90
|
-
'
|
88
|
+
'fas fa-th-list'
|
91
89
|
end
|
92
90
|
end
|
93
91
|
end
|
@@ -9,7 +9,7 @@ module RailsAdmin
|
|
9
9
|
end
|
10
10
|
|
11
11
|
register_instance_option :http_methods do
|
12
|
-
[
|
12
|
+
%i[get post] # NEW / CREATE
|
13
13
|
end
|
14
14
|
|
15
15
|
register_instance_option :controller do
|
@@ -17,16 +17,16 @@ module RailsAdmin
|
|
17
17
|
if request.get? # NEW
|
18
18
|
|
19
19
|
@object = @abstract_model.new
|
20
|
-
@authorization_adapter
|
20
|
+
@authorization_adapter&.attributes_for(:new, @abstract_model)&.each do |name, value|
|
21
21
|
@object.send("#{name}=", value)
|
22
22
|
end
|
23
23
|
if object_params = params[@abstract_model.param_key]
|
24
24
|
sanitize_params_for!(request.xhr? ? :modal : :create)
|
25
|
-
@object.
|
25
|
+
@object.assign_attributes(@object.attributes.merge(object_params.to_h))
|
26
26
|
end
|
27
27
|
respond_to do |format|
|
28
28
|
format.html { render @action.template_name }
|
29
|
-
format.js { render @action.template_name, layout:
|
29
|
+
format.js { render @action.template_name, layout: 'rails_admin/modal', content_type: Mime[:html].to_s }
|
30
30
|
end
|
31
31
|
|
32
32
|
elsif request.post? # CREATE
|
@@ -35,14 +35,14 @@ module RailsAdmin
|
|
35
35
|
@object = @abstract_model.new
|
36
36
|
sanitize_params_for!(request.xhr? ? :modal : :create)
|
37
37
|
|
38
|
-
@object.
|
39
|
-
@authorization_adapter
|
38
|
+
@object.assign_attributes(params[@abstract_model.param_key])
|
39
|
+
@authorization_adapter&.authorize(:create, @abstract_model, @object)
|
40
40
|
|
41
41
|
if @object.save
|
42
|
-
@auditing_adapter
|
42
|
+
@auditing_adapter&.create_object(@object, @abstract_model, _current_user)
|
43
43
|
respond_to do |format|
|
44
44
|
format.html { redirect_to_on_success }
|
45
|
-
format.
|
45
|
+
format.json { render json: {id: @object.id.to_s, label: @model_config.with(object: @object).object_label} }
|
46
46
|
end
|
47
47
|
else
|
48
48
|
handle_save_error
|
@@ -53,7 +53,7 @@ module RailsAdmin
|
|
53
53
|
end
|
54
54
|
|
55
55
|
register_instance_option :link_icon do
|
56
|
-
'
|
56
|
+
'fas fa-plus'
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
@@ -9,7 +9,11 @@ module RailsAdmin
|
|
9
9
|
end
|
10
10
|
|
11
11
|
register_instance_option :visible? do
|
12
|
-
authorized? &&
|
12
|
+
authorized? && begin
|
13
|
+
bindings[:controller].main_app.url_for(bindings[:object])
|
14
|
+
rescue StandardError
|
15
|
+
false
|
16
|
+
end
|
13
17
|
end
|
14
18
|
|
15
19
|
register_instance_option :controller do
|
@@ -19,7 +23,7 @@ module RailsAdmin
|
|
19
23
|
end
|
20
24
|
|
21
25
|
register_instance_option :link_icon do
|
22
|
-
'
|
26
|
+
'fas fa-eye'
|
23
27
|
end
|
24
28
|
|
25
29
|
register_instance_option :pjax? do
|
@@ -9,7 +9,7 @@ module RailsAdmin
|
|
9
9
|
end
|
10
10
|
scope ||= :all
|
11
11
|
init_actions!
|
12
|
-
actions =
|
12
|
+
actions =
|
13
13
|
case scope
|
14
14
|
when :all
|
15
15
|
@@actions
|
@@ -22,7 +22,7 @@ module RailsAdmin
|
|
22
22
|
when :member
|
23
23
|
@@actions.select(&:member?)
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
actions = actions.collect { |action| action.with(bindings) }
|
27
27
|
bindings[:controller] ? actions.select(&:visible?) : actions
|
28
28
|
end
|
@@ -52,7 +52,7 @@ module RailsAdmin
|
|
52
52
|
def key
|
53
53
|
:#{key}
|
54
54
|
end
|
55
|
-
))
|
55
|
+
), __FILE__, __LINE__ - 5)
|
56
56
|
add_action_custom_key(a, &block)
|
57
57
|
end
|
58
58
|
|
@@ -71,7 +71,7 @@ module RailsAdmin
|
|
71
71
|
action = #{klass}.new
|
72
72
|
add_action_custom_key(action, &block)
|
73
73
|
end
|
74
|
-
}
|
74
|
+
}, __FILE__, __LINE__ - 5
|
75
75
|
end
|
76
76
|
|
77
77
|
private
|
@@ -9,7 +9,7 @@ module RailsAdmin
|
|
9
9
|
|
10
10
|
def has_option?(name) # rubocop:disable Naming/PredicateName
|
11
11
|
options = self.class.instance_variable_get('@config_options')
|
12
|
-
options
|
12
|
+
options&.key?(name)
|
13
13
|
end
|
14
14
|
|
15
15
|
# Register an instance option for this object only
|
@@ -87,7 +87,7 @@ module RailsAdmin
|
|
87
87
|
elsif block_given?
|
88
88
|
yield
|
89
89
|
else
|
90
|
-
raise
|
90
|
+
raise "The #{option_name} configuration option is removed without replacement."
|
91
91
|
end
|
92
92
|
end
|
93
93
|
end
|
@@ -5,15 +5,15 @@ module RailsAdmin
|
|
5
5
|
module Config
|
6
6
|
module Fields
|
7
7
|
class Association < RailsAdmin::Config::Fields::Base
|
8
|
-
def self.inherited(klass)
|
9
|
-
super(klass)
|
10
|
-
end
|
11
|
-
|
12
8
|
# Reader for the association information hash
|
13
9
|
def association
|
14
10
|
@properties
|
15
11
|
end
|
16
12
|
|
13
|
+
def method_name
|
14
|
+
association.key_accessor
|
15
|
+
end
|
16
|
+
|
17
17
|
register_instance_option :pretty_value do
|
18
18
|
v = bindings[:view]
|
19
19
|
[value].flatten.select(&:present?).collect do |associated|
|
@@ -22,7 +22,7 @@ module RailsAdmin
|
|
22
22
|
wording = associated.send(amc.object_label_method)
|
23
23
|
can_see = !am.embedded? && (show_action = v.action(:show, am, associated))
|
24
24
|
can_see ? v.link_to(wording, v.url_for(action: show_action.action_name, model_name: am.to_param, id: associated.id), class: 'pjax') : ERB::Util.html_escape(wording)
|
25
|
-
end.to_sentence.html_safe
|
25
|
+
end.to_sentence.html_safe.presence || '-'
|
26
26
|
end
|
27
27
|
|
28
28
|
# Accessor whether association is visible or not. By default
|
@@ -62,10 +62,18 @@ module RailsAdmin
|
|
62
62
|
association.foreign_key_nullable?
|
63
63
|
end
|
64
64
|
|
65
|
-
register_instance_option :eager_load
|
65
|
+
register_instance_option :eager_load do
|
66
66
|
!!searchable
|
67
67
|
end
|
68
68
|
|
69
|
+
register_instance_option :inline_add do
|
70
|
+
true
|
71
|
+
end
|
72
|
+
|
73
|
+
register_instance_option :inline_edit do
|
74
|
+
true
|
75
|
+
end
|
76
|
+
|
69
77
|
# Reader for the association's child model's configuration
|
70
78
|
def associated_model_config
|
71
79
|
@associated_model_config ||= RailsAdmin.config(association.klass)
|
@@ -78,12 +86,7 @@ module RailsAdmin
|
|
78
86
|
|
79
87
|
# Reader for associated primary key
|
80
88
|
def associated_primary_key
|
81
|
-
|
82
|
-
end
|
83
|
-
|
84
|
-
# Reader for the association's key
|
85
|
-
def foreign_key
|
86
|
-
association.foreign_key
|
89
|
+
association.primary_key
|
87
90
|
end
|
88
91
|
|
89
92
|
# Reader whether this is a polymorphic association
|
@@ -14,13 +14,12 @@ module RailsAdmin
|
|
14
14
|
include RailsAdmin::Config::Groupable
|
15
15
|
include RailsAdmin::Config::Inspectable
|
16
16
|
|
17
|
-
attr_reader :name, :properties, :abstract_model
|
17
|
+
attr_reader :name, :properties, :abstract_model, :parent, :root
|
18
18
|
attr_accessor :defined, :order, :section
|
19
|
-
attr_reader :parent, :root
|
20
19
|
|
21
|
-
NAMED_INSTANCE_VARIABLES = [
|
22
|
-
|
23
|
-
|
20
|
+
NAMED_INSTANCE_VARIABLES = %i[
|
21
|
+
@parent @root @section @children_fields_registered
|
22
|
+
@associated_model_config @group
|
24
23
|
].freeze
|
25
24
|
|
26
25
|
def initialize(parent, name, properties)
|
@@ -36,7 +35,7 @@ module RailsAdmin
|
|
36
35
|
end
|
37
36
|
|
38
37
|
register_instance_option :css_class do
|
39
|
-
"#{
|
38
|
+
"#{name}_field"
|
40
39
|
end
|
41
40
|
|
42
41
|
def type_css_class
|
@@ -51,6 +50,10 @@ module RailsAdmin
|
|
51
50
|
nil
|
52
51
|
end
|
53
52
|
|
53
|
+
register_instance_option :sticky? do
|
54
|
+
false
|
55
|
+
end
|
56
|
+
|
54
57
|
register_instance_option :sortable do
|
55
58
|
!virtual? || children_fields.first || false
|
56
59
|
end
|
@@ -78,7 +81,7 @@ module RailsAdmin
|
|
78
81
|
|
79
82
|
# list of columns I should search for that field [{ column: 'table_name.column', type: field.type }, {..}]
|
80
83
|
register_instance_option :searchable_columns do
|
81
|
-
@searchable_columns ||=
|
84
|
+
@searchable_columns ||=
|
82
85
|
case searchable
|
83
86
|
when true
|
84
87
|
[{column: "#{abstract_model.table_name}.#{name}", type: type}]
|
@@ -93,22 +96,21 @@ module RailsAdmin
|
|
93
96
|
table_name, column = f.split '.'
|
94
97
|
type = nil
|
95
98
|
elsif f.is_a?(Hash) # <Model|table_name> => <attribute|column>
|
96
|
-
am = f.keys.first
|
97
|
-
table_name = am
|
99
|
+
am = AbstractModel.new(f.keys.first) if f.keys.first.is_a?(Class)
|
100
|
+
table_name = am&.table_name || f.keys.first
|
98
101
|
column = f.values.first
|
99
|
-
property = am
|
100
|
-
type = property
|
102
|
+
property = am&.properties&.detect { |p| p.name == f.values.first.to_sym }
|
103
|
+
type = property&.type
|
101
104
|
else # <attribute|column>
|
102
105
|
am = (association? ? associated_model_config.abstract_model : abstract_model)
|
103
106
|
table_name = am.table_name
|
104
107
|
column = f
|
105
108
|
property = am.properties.detect { |p| p.name == f.to_sym }
|
106
|
-
type = property
|
109
|
+
type = property&.type
|
107
110
|
end
|
108
111
|
{column: "#{table_name}.#{column}", type: (type || :string)}
|
109
112
|
end
|
110
113
|
end
|
111
|
-
end
|
112
114
|
end
|
113
115
|
|
114
116
|
register_instance_option :formatted_value do
|
@@ -155,7 +157,7 @@ module RailsAdmin
|
|
155
157
|
#
|
156
158
|
# @see RailsAdmin::AbstractModel.properties
|
157
159
|
register_instance_option :length do
|
158
|
-
@length ||= properties
|
160
|
+
@length ||= properties&.length
|
159
161
|
end
|
160
162
|
|
161
163
|
# Accessor for field's length restrictions per validations
|
@@ -172,17 +174,17 @@ module RailsAdmin
|
|
172
174
|
#
|
173
175
|
# @see RailsAdmin::AbstractModel.properties
|
174
176
|
register_instance_option :required? do
|
175
|
-
context =
|
177
|
+
context =
|
176
178
|
if bindings && bindings[:object]
|
177
179
|
bindings[:object].persisted? ? :update : :create
|
178
180
|
else
|
179
181
|
:nil
|
180
182
|
end
|
181
|
-
|
183
|
+
|
182
184
|
(@required ||= {})[context] ||= !!([name] + children_fields).uniq.detect do |column_name|
|
183
185
|
abstract_model.model.validators_on(column_name).detect do |v|
|
184
186
|
!(v.options[:allow_nil] || v.options[:allow_blank]) &&
|
185
|
-
[
|
187
|
+
%i[presence numericality attachment_presence].include?(v.kind) &&
|
186
188
|
(v.options[:on] == context || v.options[:on].blank?) &&
|
187
189
|
(v.options[:if].blank? && v.options[:unless].blank?)
|
188
190
|
end
|
@@ -193,7 +195,7 @@ module RailsAdmin
|
|
193
195
|
#
|
194
196
|
# @see RailsAdmin::AbstractModel.properties
|
195
197
|
register_instance_option :serial? do
|
196
|
-
properties
|
198
|
+
properties&.serial?
|
197
199
|
end
|
198
200
|
|
199
201
|
register_instance_option :view_helper do
|
@@ -213,6 +215,7 @@ module RailsAdmin
|
|
213
215
|
returned = true
|
214
216
|
(RailsAdmin.config.default_hidden_fields || {}).each do |section, fields|
|
215
217
|
next unless self.section.is_a?("RailsAdmin::Config::Sections::#{section.to_s.camelize}".constantize)
|
218
|
+
|
216
219
|
returned = false if fields.include?(name)
|
217
220
|
end
|
218
221
|
returned
|
@@ -223,14 +226,31 @@ module RailsAdmin
|
|
223
226
|
[]
|
224
227
|
end
|
225
228
|
|
226
|
-
register_instance_option :render do
|
227
|
-
bindings[:view].render partial: "rails_admin/main/#{partial}", locals: {field: self, form: bindings[:form]}
|
228
|
-
end
|
229
|
-
|
230
229
|
register_instance_option :default_filter_operator do
|
231
230
|
nil
|
232
231
|
end
|
233
232
|
|
233
|
+
register_instance_option :eager_load do
|
234
|
+
false
|
235
|
+
end
|
236
|
+
|
237
|
+
register_deprecated_instance_option :eager_load?, :eager_load
|
238
|
+
|
239
|
+
def eager_load_values
|
240
|
+
case eager_load
|
241
|
+
when true
|
242
|
+
[name]
|
243
|
+
when false, nil
|
244
|
+
[]
|
245
|
+
else
|
246
|
+
Array.wrap(eager_load)
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
register_instance_option :render do
|
251
|
+
bindings[:view].render partial: "rails_admin/main/#{partial}", locals: {field: self, form: bindings[:form]}
|
252
|
+
end
|
253
|
+
|
234
254
|
def editable?
|
235
255
|
!(@properties && @properties.read_only?)
|
236
256
|
end
|
@@ -259,7 +279,7 @@ module RailsAdmin
|
|
259
279
|
# @see RailsAdmin::Config::Fields::Base.register_instance_option :required?
|
260
280
|
def optional(state = nil, &block)
|
261
281
|
if !state.nil? || block
|
262
|
-
required state.nil? ? proc {
|
282
|
+
required state.nil? ? proc { instance_eval(&block) == false } : state == false
|
263
283
|
else
|
264
284
|
optional?
|
265
285
|
end
|
@@ -302,7 +322,7 @@ module RailsAdmin
|
|
302
322
|
end
|
303
323
|
|
304
324
|
def generic_help
|
305
|
-
|
325
|
+
"#{required? ? I18n.translate('admin.form.required') : I18n.translate('admin.form.optional')}. "
|
306
326
|
end
|
307
327
|
|
308
328
|
def generic_field_help
|
@@ -17,6 +17,7 @@ RailsAdmin::Config::Fields.register_factory do |parent, properties, fields|
|
|
17
17
|
end
|
18
18
|
children_fields = associations.map do |child_name|
|
19
19
|
next unless child_association = parent.abstract_model.associations.detect { |p| p.name.to_sym == child_name }
|
20
|
+
|
20
21
|
child_field = fields.detect { |f| f.name == child_name } || RailsAdmin::Config::Fields.default_factory.call(parent, child_association, fields)
|
21
22
|
child_field.hide unless field == child_field
|
22
23
|
child_field.filterable(false) unless field == child_field
|
@@ -3,18 +3,16 @@ require 'rails_admin/config/fields/types'
|
|
3
3
|
require 'rails_admin/config/fields/types/belongs_to_association'
|
4
4
|
|
5
5
|
RailsAdmin::Config::Fields.register_factory do |parent, properties, fields|
|
6
|
-
if association = parent.abstract_model.associations.detect { |a| a.foreign_key == properties.name && [
|
6
|
+
if association = parent.abstract_model.associations.detect { |a| a.foreign_key == properties.name && %i[belongs_to has_and_belongs_to_many].include?(a.type) }
|
7
7
|
field = RailsAdmin::Config::Fields::Types.load("#{association.polymorphic? ? :polymorphic : association.type}_association").new(parent, association.name, association)
|
8
8
|
fields << field
|
9
9
|
|
10
10
|
child_columns = []
|
11
|
-
possible_field_names =
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end.collect { |k| association.send(k) }.compact
|
17
|
-
end
|
11
|
+
possible_field_names = if association.polymorphic?
|
12
|
+
%i[foreign_key foreign_type foreign_inverse_of]
|
13
|
+
else
|
14
|
+
[:foreign_key]
|
15
|
+
end.collect { |k| association.send(k) }.compact
|
18
16
|
|
19
17
|
parent.abstract_model.properties.select { |p| possible_field_names.include? p.name }.each do |column|
|
20
18
|
unless child_field = fields.detect { |f| f.name.to_s == column.name.to_s }
|
@@ -7,12 +7,13 @@ RailsAdmin::Config::Fields.register_factory do |parent, properties, fields|
|
|
7
7
|
if defined?(::CarrierWave) && model.is_a?(CarrierWave::Mount) && model.uploaders.include?(attachment_name = properties.name.to_s.chomp('_file_name').to_sym)
|
8
8
|
columns = [model.uploader_options[attachment_name][:mount_on] || attachment_name, "#{attachment_name}_content_type".to_sym, "#{attachment_name}_file_size".to_sym]
|
9
9
|
field = RailsAdmin::Config::Fields::Types.load(
|
10
|
-
[
|
10
|
+
%i[serialized json].include?(properties.type) ? :multiple_carrierwave : :carrierwave,
|
11
11
|
).new(parent, attachment_name, properties)
|
12
12
|
fields << field
|
13
13
|
children_fields = []
|
14
14
|
columns.each do |children_column_name|
|
15
15
|
next unless child_properties = parent.abstract_model.properties.detect { |p| p.name.to_s == children_column_name.to_s }
|
16
|
+
|
16
17
|
children_field = fields.detect { |f| f.name == children_column_name } || RailsAdmin::Config::Fields.default_factory.call(parent, child_properties, fields)
|
17
18
|
children_field.hide unless field == children_field
|
18
19
|
children_field.filterable(false) unless field == children_field
|
@@ -5,12 +5,13 @@ require 'rails_admin/config/fields/types/password'
|
|
5
5
|
# Register a custom field factory for devise model
|
6
6
|
RailsAdmin::Config::Fields.register_factory do |parent, properties, fields|
|
7
7
|
if properties.name == :encrypted_password
|
8
|
-
extensions = [
|
8
|
+
extensions = %i[password_salt reset_password_token remember_token]
|
9
9
|
fields << RailsAdmin::Config::Fields::Types.load(:password).new(parent, :password, properties)
|
10
10
|
fields << RailsAdmin::Config::Fields::Types.load(:password).new(parent, :password_confirmation, properties)
|
11
11
|
extensions.each do |ext|
|
12
12
|
properties = parent.abstract_model.properties.detect { |p| ext == p.name }
|
13
13
|
next unless properties
|
14
|
+
|
14
15
|
unless field = fields.detect { |f| f.name == ext }
|
15
16
|
RailsAdmin::Config::Fields.default_factory.call(parent, properties, fields)
|
16
17
|
field = fields.last
|