rails_admin 2.3.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 +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 +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/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
@@ -3,13 +3,14 @@ require 'rails_admin/config/fields/types'
|
|
3
3
|
require 'rails_admin/config/fields/types/file_upload'
|
4
4
|
|
5
5
|
RailsAdmin::Config::Fields.register_factory do |parent, properties, fields|
|
6
|
-
extensions = [
|
6
|
+
extensions = %i[name uid]
|
7
7
|
if (properties.name.to_s =~ /^(.+)_uid$/) && defined?(::Dragonfly) && parent.abstract_model.model.respond_to?(:dragonfly_attachment_classes) && parent.abstract_model.model.dragonfly_attachment_classes.collect(&:attribute).include?(attachment_name = Regexp.last_match[1].to_sym)
|
8
8
|
field = RailsAdmin::Config::Fields::Types.load(:dragonfly).new(parent, attachment_name, properties)
|
9
9
|
children_fields = []
|
10
10
|
extensions.each do |ext|
|
11
11
|
children_column_name = "#{attachment_name}_#{ext}".to_sym
|
12
12
|
next unless child_properties = parent.abstract_model.properties.detect { |p| p.name.to_s == children_column_name.to_s }
|
13
|
+
|
13
14
|
children_field = fields.detect { |f| f.name == children_column_name } || RailsAdmin::Config::Fields.default_factory.call(parent, child_properties, fields)
|
14
15
|
children_field.hide
|
15
16
|
children_field.filterable(false)
|
@@ -3,7 +3,7 @@ require 'rails_admin/config/fields/types'
|
|
3
3
|
require 'rails_admin/config/fields/types/file_upload'
|
4
4
|
|
5
5
|
RailsAdmin::Config::Fields.register_factory do |parent, properties, fields|
|
6
|
-
extensions = [
|
6
|
+
extensions = %i[file_name content_type file_size updated_at fingerprint]
|
7
7
|
model = parent.abstract_model.model
|
8
8
|
if (properties.name.to_s =~ /^(.+)_file_name$/) && defined?(::Paperclip) && model.try(:attachment_definitions) && model.attachment_definitions.key?(attachment_name = Regexp.last_match[1].to_sym)
|
9
9
|
field = RailsAdmin::Config::Fields::Types.load(:paperclip).new(parent, attachment_name, properties)
|
@@ -11,6 +11,7 @@ RailsAdmin::Config::Fields.register_factory do |parent, properties, fields|
|
|
11
11
|
extensions.each do |ext|
|
12
12
|
children_column_name = "#{attachment_name}_#{ext}".to_sym
|
13
13
|
next unless child_properties = parent.abstract_model.properties.detect { |p| p.name.to_s == children_column_name.to_s }
|
14
|
+
|
14
15
|
children_field = fields.detect { |f| f.name == children_column_name } || RailsAdmin::Config::Fields.default_factory.call(parent, child_properties, fields)
|
15
16
|
children_field.hide
|
16
17
|
children_field.filterable(false)
|
@@ -5,7 +5,7 @@ require 'rails_admin/config/fields/types/file_upload'
|
|
5
5
|
RailsAdmin::Config::Fields.register_factory do |parent, properties, fields|
|
6
6
|
next false unless defined?(::Shrine)
|
7
7
|
|
8
|
-
attachment_names = parent.abstract_model.model.ancestors.select { |m| m.is_a?(Shrine::Attachment) }.map { |a| a.instance_variable_get(
|
8
|
+
attachment_names = parent.abstract_model.model.ancestors.select { |m| m.is_a?(Shrine::Attachment) }.map { |a| a.instance_variable_get('@name') }
|
9
9
|
next false if attachment_names.blank?
|
10
10
|
|
11
11
|
attachment_name = attachment_names.detect { |a| a == properties.name.to_s.chomp('_data').to_sym }
|
@@ -12,9 +12,8 @@ module RailsAdmin
|
|
12
12
|
include RailsAdmin::Config::Configurable
|
13
13
|
include RailsAdmin::Config::Hideable
|
14
14
|
|
15
|
-
attr_reader :name, :abstract_model
|
15
|
+
attr_reader :name, :abstract_model, :parent, :root
|
16
16
|
attr_accessor :section
|
17
|
-
attr_reader :parent, :root
|
18
17
|
|
19
18
|
def initialize(parent, name)
|
20
19
|
@parent = parent
|
@@ -29,12 +29,14 @@ module RailsAdmin
|
|
29
29
|
|
30
30
|
def parse_value(value)
|
31
31
|
return unless value.present?
|
32
|
+
|
32
33
|
abstract_model.model.attribute_types[name.to_s].serialize(value)
|
33
34
|
end
|
34
35
|
|
35
36
|
def parse_input(params)
|
36
37
|
value = params[name]
|
37
38
|
return unless value
|
39
|
+
|
38
40
|
params[name] = parse_input_value(value)
|
39
41
|
end
|
40
42
|
|
@@ -8,11 +8,7 @@ module RailsAdmin
|
|
8
8
|
RailsAdmin::Config::Fields::Types.register(self)
|
9
9
|
|
10
10
|
register_instance_option :thumb_method do
|
11
|
-
|
12
|
-
{resize_to_limit: [100, 100]}
|
13
|
-
else
|
14
|
-
{resize: '100x100>'}
|
15
|
-
end
|
11
|
+
{resize_to_limit: [100, 100]}
|
16
12
|
end
|
17
13
|
|
18
14
|
register_instance_option :delete_method do
|
@@ -21,12 +17,18 @@ module RailsAdmin
|
|
21
17
|
|
22
18
|
register_instance_option :image? do
|
23
19
|
if value
|
24
|
-
value.filename.
|
20
|
+
mime_type = Mime::Type.lookup_by_extension(value.filename.extension_without_delimiter)
|
21
|
+
mime_type.to_s.match?(/^image/)
|
25
22
|
end
|
26
23
|
end
|
27
24
|
|
25
|
+
register_instance_option :eager_load do
|
26
|
+
{"#{name}_attachment": :blob}
|
27
|
+
end
|
28
|
+
|
28
29
|
def resource_url(thumb = false)
|
29
30
|
return nil unless value
|
31
|
+
|
30
32
|
if thumb && value.variable?
|
31
33
|
thumb = thumb_method if thumb == true
|
32
34
|
variant = value.variant(thumb)
|
@@ -40,7 +42,7 @@ module RailsAdmin
|
|
40
42
|
|
41
43
|
def value
|
42
44
|
attachment = super
|
43
|
-
attachment if attachment
|
45
|
+
attachment if attachment&.attached?
|
44
46
|
end
|
45
47
|
end
|
46
48
|
end
|
@@ -23,28 +23,20 @@ module RailsAdmin
|
|
23
23
|
nested_form ? :form_nested_one : :form_filtering_select
|
24
24
|
end
|
25
25
|
|
26
|
-
register_instance_option :
|
27
|
-
true
|
28
|
-
end
|
29
|
-
|
30
|
-
register_instance_option :inline_edit do
|
31
|
-
true
|
32
|
-
end
|
33
|
-
|
34
|
-
register_instance_option :eager_load? do
|
26
|
+
register_instance_option :eager_load do
|
35
27
|
true
|
36
28
|
end
|
37
29
|
|
38
30
|
def associated_primary_key
|
39
|
-
|
31
|
+
association.primary_key
|
40
32
|
end
|
41
33
|
|
42
34
|
def selected_id
|
43
|
-
bindings[:object].send(
|
35
|
+
bindings[:object].send(association.key_accessor)
|
44
36
|
end
|
45
37
|
|
46
38
|
def method_name
|
47
|
-
nested_form ? "#{name}_attributes".to_sym :
|
39
|
+
nested_form ? "#{name}_attributes".to_sym : super
|
48
40
|
end
|
49
41
|
|
50
42
|
def multiple?
|
@@ -6,19 +6,32 @@ module RailsAdmin
|
|
6
6
|
# Register field type for the type loader
|
7
7
|
RailsAdmin::Config::Fields::Types.register(self)
|
8
8
|
|
9
|
+
register_instance_option :labels do
|
10
|
+
{
|
11
|
+
true => %(<span class="fas fa-check"></span>),
|
12
|
+
false => %(<span class="fas fa-times"></span>),
|
13
|
+
nil => %(<span class="fas fa-minus"></span>),
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
register_instance_option :css_classes do
|
18
|
+
{
|
19
|
+
true => 'success',
|
20
|
+
false => 'danger',
|
21
|
+
nil => 'default',
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
register_instance_option :nullable? do
|
26
|
+
properties&.nullable?
|
27
|
+
end
|
28
|
+
|
9
29
|
register_instance_option :view_helper do
|
10
30
|
:check_box
|
11
31
|
end
|
12
32
|
|
13
33
|
register_instance_option :pretty_value do
|
14
|
-
|
15
|
-
when nil
|
16
|
-
%(<span class='label label-default'>‒</span>)
|
17
|
-
when false
|
18
|
-
%(<span class='label label-danger'>✘</span>)
|
19
|
-
when true
|
20
|
-
%(<span class='label label-success'>✓</span>)
|
21
|
-
end.html_safe
|
34
|
+
%(<span class="label label-#{css_classes[form_value]}">#{labels[form_value]}</span>).html_safe
|
22
35
|
end
|
23
36
|
|
24
37
|
register_instance_option :export_value do
|
@@ -29,10 +42,21 @@ module RailsAdmin
|
|
29
42
|
:form_boolean
|
30
43
|
end
|
31
44
|
|
45
|
+
def form_value
|
46
|
+
case value
|
47
|
+
when true, false
|
48
|
+
value
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
32
52
|
# Accessor for field's help text displayed below input field.
|
33
53
|
def generic_help
|
34
54
|
''
|
35
55
|
end
|
56
|
+
|
57
|
+
def parse_input(params)
|
58
|
+
params[name] = params[name].presence if params.key?(name)
|
59
|
+
end
|
36
60
|
end
|
37
61
|
end
|
38
62
|
end
|
@@ -15,10 +15,14 @@ module RailsAdmin
|
|
15
15
|
:form_colorpicker
|
16
16
|
end
|
17
17
|
|
18
|
+
register_instance_option :view_helper do
|
19
|
+
:color_field
|
20
|
+
end
|
21
|
+
|
18
22
|
register_instance_option :color do
|
19
23
|
if value.present?
|
20
|
-
if
|
21
|
-
|
24
|
+
if /^[0-9a-fA-F]{3,6}$/.match?(value)
|
25
|
+
"##{value}"
|
22
26
|
else
|
23
27
|
value
|
24
28
|
end
|
@@ -7,19 +7,16 @@ module RailsAdmin
|
|
7
7
|
class Date < RailsAdmin::Config::Fields::Types::Datetime
|
8
8
|
RailsAdmin::Config::Fields::Types.register(self)
|
9
9
|
|
10
|
+
def parse_value(value)
|
11
|
+
::Date.parse(value) if value.present?
|
12
|
+
end
|
13
|
+
|
10
14
|
register_instance_option :date_format do
|
11
15
|
:long
|
12
16
|
end
|
13
17
|
|
14
18
|
register_instance_option :i18n_scope do
|
15
|
-
[
|
16
|
-
end
|
17
|
-
|
18
|
-
register_instance_option :datepicker_options do
|
19
|
-
{
|
20
|
-
showTodayButton: true,
|
21
|
-
format: parser.to_momentjs,
|
22
|
-
}
|
19
|
+
%i[date formats]
|
23
20
|
end
|
24
21
|
|
25
22
|
register_instance_option :html_attributes do
|
@@ -8,47 +8,36 @@ module RailsAdmin
|
|
8
8
|
class Datetime < RailsAdmin::Config::Fields::Base
|
9
9
|
RailsAdmin::Config::Fields::Types.register(self)
|
10
10
|
|
11
|
-
def parser
|
12
|
-
RailsAdmin::Support::Datetime.new(strftime_format)
|
13
|
-
end
|
14
|
-
|
15
11
|
def parse_value(value)
|
16
|
-
|
12
|
+
::Time.zone.parse(value)
|
17
13
|
end
|
18
14
|
|
19
15
|
def parse_input(params)
|
20
16
|
params[name] = parse_value(params[name]) if params[name]
|
21
17
|
end
|
22
18
|
|
23
|
-
def value
|
24
|
-
parent_value = super
|
25
|
-
if %w(DateTime Date Time).include?(parent_value.class.name)
|
26
|
-
parent_value.in_time_zone
|
27
|
-
else
|
28
|
-
parent_value
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
19
|
register_instance_option :date_format do
|
33
20
|
:long
|
34
21
|
end
|
35
22
|
|
36
23
|
register_instance_option :i18n_scope do
|
37
|
-
[
|
24
|
+
%i[time formats]
|
38
25
|
end
|
39
26
|
|
40
27
|
register_instance_option :strftime_format do
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
28
|
+
::I18n.t(date_format, scope: i18n_scope, raise: true)
|
29
|
+
rescue ::I18n::ArgumentError
|
30
|
+
'%B %d, %Y %H:%M'
|
31
|
+
end
|
32
|
+
|
33
|
+
register_instance_option :momentjs_format do
|
34
|
+
RailsAdmin::Support::Datetime.to_momentjs(strftime_format)
|
46
35
|
end
|
47
36
|
|
48
37
|
register_instance_option :datepicker_options do
|
49
38
|
{
|
50
39
|
showTodayButton: true,
|
51
|
-
format:
|
40
|
+
format: momentjs_format,
|
52
41
|
}
|
53
42
|
end
|
54
43
|
|
@@ -63,6 +52,10 @@ module RailsAdmin
|
|
63
52
|
true
|
64
53
|
end
|
65
54
|
|
55
|
+
register_instance_option :queryable? do
|
56
|
+
false
|
57
|
+
end
|
58
|
+
|
66
59
|
register_instance_option :formatted_value do
|
67
60
|
if time = (value || default_value)
|
68
61
|
::I18n.l(time, format: strftime_format)
|
@@ -74,6 +67,10 @@ module RailsAdmin
|
|
74
67
|
register_instance_option :partial do
|
75
68
|
:form_datetime
|
76
69
|
end
|
70
|
+
|
71
|
+
def form_value
|
72
|
+
value&.in_time_zone&.strftime('%FT%T') || form_default_value
|
73
|
+
end
|
77
74
|
end
|
78
75
|
end
|
79
76
|
end
|
@@ -1,12 +1,19 @@
|
|
1
|
-
require 'rails_admin/config/fields/
|
1
|
+
require 'rails_admin/config/fields/types/numeric'
|
2
2
|
|
3
3
|
module RailsAdmin
|
4
4
|
module Config
|
5
5
|
module Fields
|
6
6
|
module Types
|
7
|
-
class Decimal < RailsAdmin::Config::Fields::
|
7
|
+
class Decimal < RailsAdmin::Config::Fields::Types::Numeric
|
8
8
|
# Register field type for the type loader
|
9
9
|
RailsAdmin::Config::Fields::Types.register(self)
|
10
|
+
|
11
|
+
register_instance_option :html_attributes do
|
12
|
+
{
|
13
|
+
required: required?,
|
14
|
+
step: 'any',
|
15
|
+
}
|
16
|
+
end
|
10
17
|
end
|
11
18
|
end
|
12
19
|
end
|
@@ -12,7 +12,8 @@ module RailsAdmin
|
|
12
12
|
register_instance_option :image? do
|
13
13
|
false unless value
|
14
14
|
if abstract_model.model.new.respond_to?("#{name}_name")
|
15
|
-
bindings[:object].send("#{name}_name").to_s.split('.').last
|
15
|
+
mime_type = Mime::Type.lookup_by_extension(bindings[:object].send("#{name}_name").to_s.split('.').last)
|
16
|
+
mime_type.to_s.match?(/^image/)
|
16
17
|
else
|
17
18
|
true # Dragonfly really is image oriented
|
18
19
|
end
|
@@ -32,6 +33,7 @@ module RailsAdmin
|
|
32
33
|
|
33
34
|
def resource_url(thumb = false)
|
34
35
|
return nil unless (v = value)
|
36
|
+
|
35
37
|
thumb ? v.thumb(thumb).try(:url) : v.url
|
36
38
|
end
|
37
39
|
end
|
@@ -21,7 +21,7 @@ module RailsAdmin
|
|
21
21
|
|
22
22
|
register_instance_option :pretty_value do
|
23
23
|
if enum.is_a?(::Hash)
|
24
|
-
enum.
|
24
|
+
enum.select { |_k, v| v.to_s == value.to_s }.keys.first.to_s.presence || value.presence || ' - '
|
25
25
|
elsif enum.is_a?(::Array) && enum.first.is_a?(::Array)
|
26
26
|
enum.detect { |e| e[1].to_s == value.to_s }.try(:first).to_s.presence || value.presence || ' - '
|
27
27
|
else
|
@@ -42,7 +42,7 @@ module RailsAdmin
|
|
42
42
|
if image
|
43
43
|
thumb_url = resource_url(thumb_method)
|
44
44
|
image_html = v.image_tag(thumb_url, class: 'img-thumbnail')
|
45
|
-
url
|
45
|
+
url == thumb_url ? image_html : v.link_to(image_html, url, target: '_blank', rel: 'noopener noreferrer')
|
46
46
|
else
|
47
47
|
v.link_to(link_name, url, target: '_blank', rel: 'noopener noreferrer')
|
48
48
|
end
|
@@ -50,7 +50,8 @@ module RailsAdmin
|
|
50
50
|
end
|
51
51
|
|
52
52
|
register_instance_option :image? do
|
53
|
-
|
53
|
+
mime_type = Mime::Type.lookup_by_extension(resource_url.to_s.split('.').last)
|
54
|
+
mime_type.to_s.match?(/^image/)
|
54
55
|
end
|
55
56
|
|
56
57
|
register_instance_option :allowed_methods do
|
@@ -65,7 +66,7 @@ module RailsAdmin
|
|
65
66
|
|
66
67
|
# virtual class
|
67
68
|
def resource_url
|
68
|
-
raise
|
69
|
+
raise 'not implemented'
|
69
70
|
end
|
70
71
|
|
71
72
|
def virtual?
|
@@ -1,12 +1,19 @@
|
|
1
|
-
require 'rails_admin/config/fields/
|
1
|
+
require 'rails_admin/config/fields/types/numeric'
|
2
2
|
|
3
3
|
module RailsAdmin
|
4
4
|
module Config
|
5
5
|
module Fields
|
6
6
|
module Types
|
7
|
-
class Float < RailsAdmin::Config::Fields::
|
7
|
+
class Float < RailsAdmin::Config::Fields::Types::Numeric
|
8
8
|
# Register field type for the type loader
|
9
9
|
RailsAdmin::Config::Fields::Types.register(self)
|
10
|
+
|
11
|
+
register_instance_option :html_attributes do
|
12
|
+
{
|
13
|
+
required: required?,
|
14
|
+
step: 'any',
|
15
|
+
}
|
16
|
+
end
|
10
17
|
end
|
11
18
|
end
|
12
19
|
end
|
@@ -17,12 +17,8 @@ module RailsAdmin
|
|
17
17
|
false
|
18
18
|
end
|
19
19
|
|
20
|
-
register_instance_option :inline_add do
|
21
|
-
true
|
22
|
-
end
|
23
|
-
|
24
20
|
def method_name
|
25
|
-
nested_form ? "#{
|
21
|
+
nested_form ? "#{name}_attributes".to_sym : super
|
26
22
|
end
|
27
23
|
|
28
24
|
# Reader for validation errors of the bound object
|
@@ -17,24 +17,12 @@ module RailsAdmin
|
|
17
17
|
(o = value) && o.send(associated_model_config.object_label_method)
|
18
18
|
end
|
19
19
|
|
20
|
-
register_instance_option :inline_add do
|
21
|
-
true
|
22
|
-
end
|
23
|
-
|
24
|
-
register_instance_option :inline_edit do
|
25
|
-
true
|
26
|
-
end
|
27
|
-
|
28
|
-
def editable?
|
29
|
-
(nested_form || abstract_model.model.new.respond_to?("#{name}_id=")) && super
|
30
|
-
end
|
31
|
-
|
32
20
|
def selected_id
|
33
21
|
value.try :id
|
34
22
|
end
|
35
23
|
|
36
24
|
def method_name
|
37
|
-
nested_form ? "#{name}_attributes".to_sym :
|
25
|
+
nested_form ? "#{name}_attributes".to_sym : super
|
38
26
|
end
|
39
27
|
|
40
28
|
def multiple?
|
@@ -1,17 +1,13 @@
|
|
1
|
-
require 'rails_admin/config/fields/
|
1
|
+
require 'rails_admin/config/fields/types/numeric'
|
2
2
|
|
3
3
|
module RailsAdmin
|
4
4
|
module Config
|
5
5
|
module Fields
|
6
6
|
module Types
|
7
|
-
class Integer < RailsAdmin::Config::Fields::
|
7
|
+
class Integer < RailsAdmin::Config::Fields::Types::Numeric
|
8
8
|
# Register field type for the type loader
|
9
9
|
RailsAdmin::Config::Fields::Types.register(self)
|
10
10
|
|
11
|
-
register_instance_option :view_helper do
|
12
|
-
:number_field
|
13
|
-
end
|
14
|
-
|
15
11
|
register_instance_option :sort_reverse? do
|
16
12
|
serial?
|
17
13
|
end
|
@@ -9,11 +9,7 @@ module RailsAdmin
|
|
9
9
|
|
10
10
|
class ActiveStorageAttachment < RailsAdmin::Config::Fields::Types::MultipleFileUpload::AbstractAttachment
|
11
11
|
register_instance_option :thumb_method do
|
12
|
-
|
13
|
-
{resize_to_limit: [100, 100]}
|
14
|
-
else
|
15
|
-
{resize: '100x100>'}
|
16
|
-
end
|
12
|
+
{resize_to_limit: [100, 100]}
|
17
13
|
end
|
18
14
|
|
19
15
|
register_instance_option :delete_value do
|
@@ -22,12 +18,14 @@ module RailsAdmin
|
|
22
18
|
|
23
19
|
register_instance_option :image? do
|
24
20
|
if value
|
25
|
-
value.filename.
|
21
|
+
mime_type = Mime::Type.lookup_by_extension(value.filename.extension_without_delimiter)
|
22
|
+
mime_type.to_s.match?(/^image/)
|
26
23
|
end
|
27
24
|
end
|
28
25
|
|
29
26
|
def resource_url(thumb = false)
|
30
27
|
return nil unless value
|
28
|
+
|
31
29
|
if thumb && value.variable?
|
32
30
|
variant = value.variant(thumb_method)
|
33
31
|
Rails.application.routes.url_helpers.rails_blob_representation_path(
|
@@ -46,6 +44,10 @@ module RailsAdmin
|
|
46
44
|
register_instance_option :delete_method do
|
47
45
|
"remove_#{name}" if bindings[:object].respond_to?("remove_#{name}")
|
48
46
|
end
|
47
|
+
|
48
|
+
register_instance_option :eager_load do
|
49
|
+
{"#{name}_attachments": :blob}
|
50
|
+
end
|
49
51
|
end
|
50
52
|
end
|
51
53
|
end
|
@@ -36,7 +36,7 @@ module RailsAdmin
|
|
36
36
|
if image
|
37
37
|
thumb_url = resource_url(thumb_method)
|
38
38
|
image_html = v.image_tag(thumb_url, class: 'img-thumbnail')
|
39
|
-
url
|
39
|
+
url == thumb_url ? image_html : v.link_to(image_html, url, target: '_blank', rel: 'noopener noreferrer')
|
40
40
|
else
|
41
41
|
display_value = value.respond_to?(:filename) ? value.filename : value
|
42
42
|
v.link_to(display_value, url, target: '_blank', rel: 'noopener noreferrer')
|
@@ -45,11 +45,12 @@ module RailsAdmin
|
|
45
45
|
end
|
46
46
|
|
47
47
|
register_instance_option :image? do
|
48
|
-
|
48
|
+
mime_type = Mime::Type.lookup_by_extension(resource_url.to_s.split('.').last)
|
49
|
+
mime_type.to_s.match?(/^image/)
|
49
50
|
end
|
50
51
|
|
51
52
|
def resource_url(_thumb = false)
|
52
|
-
raise
|
53
|
+
raise 'not implemented'
|
53
54
|
end
|
54
55
|
end
|
55
56
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rails_admin/config/fields/base'
|
2
|
+
|
3
|
+
module RailsAdmin
|
4
|
+
module Config
|
5
|
+
module Fields
|
6
|
+
module Types
|
7
|
+
class Numeric < RailsAdmin::Config::Fields::Base
|
8
|
+
# Register field type for the type loader
|
9
|
+
RailsAdmin::Config::Fields::Types.register(self)
|
10
|
+
|
11
|
+
register_instance_option :view_helper do
|
12
|
+
:number_field
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -45,12 +45,13 @@ module RailsAdmin
|
|
45
45
|
[children_fields]
|
46
46
|
end
|
47
47
|
|
48
|
-
register_instance_option :eager_load
|
48
|
+
register_instance_option :eager_load do
|
49
49
|
false
|
50
50
|
end
|
51
51
|
|
52
52
|
def associated_collection(type)
|
53
53
|
return [] if type.blank?
|
54
|
+
|
54
55
|
config = RailsAdmin.config(type)
|
55
56
|
config.abstract_model.all.collect do |object|
|
56
57
|
[object.send(config.object_label_method), object.id]
|
@@ -58,7 +59,7 @@ module RailsAdmin
|
|
58
59
|
end
|
59
60
|
|
60
61
|
def associated_model_config
|
61
|
-
@associated_model_config ||= association.klass.collect { |type| RailsAdmin.config(type) }.
|
62
|
+
@associated_model_config ||= association.klass.collect { |type| RailsAdmin.config(type) }.reject(&:excluded?)
|
62
63
|
end
|
63
64
|
|
64
65
|
def polymorphic_type_collection
|
@@ -20,7 +20,7 @@ module RailsAdmin
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def generic_help
|
23
|
-
text =
|
23
|
+
text = "#{required? ? I18n.translate('admin.form.required') : I18n.translate('admin.form.optional')}. "
|
24
24
|
if valid_length.present? && valid_length[:is].present?
|
25
25
|
text += "#{I18n.translate('admin.form.char_length_of').capitalize} #{valid_length[:is]}."
|
26
26
|
else
|