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
@@ -1,126 +0,0 @@
|
|
1
|
-
:ruby
|
2
|
-
query = params[:query]
|
3
|
-
params = request.params.except(:authenticity_token, :action, :controller, :utf8, :bulk_export, :_pjax)
|
4
|
-
params.delete(:query) if params[:query].blank?
|
5
|
-
params.delete(:sort_reverse) unless params[:sort_reverse] == 'true'
|
6
|
-
sort_reverse = params[:sort_reverse]
|
7
|
-
sort = params[:sort]
|
8
|
-
params.delete(:sort) if params[:sort] == @model_config.list.sort_by.to_s
|
9
|
-
export_action = RailsAdmin::Config::Actions.find(:export, { controller: self.controller, abstract_model: @abstract_model })
|
10
|
-
export_action = nil unless export_action && authorized?(export_action.authorization_key, @abstract_model)
|
11
|
-
description = RailsAdmin.config(@abstract_model.model_name).description
|
12
|
-
properties = @model_config.list.with(controller: self.controller, view: self, object: @abstract_model.model.new).visible_fields
|
13
|
-
checkboxes = @model_config.list.checkboxes?
|
14
|
-
# columns paginate
|
15
|
-
unless (frozen_columns = @model_config.list.sidescroll_frozen_columns)
|
16
|
-
sets = get_column_sets(properties)
|
17
|
-
properties = sets[params[:set].to_i] || []
|
18
|
-
other_left = ((params[:set].to_i - 1) >= 0) && sets[params[:set].to_i - 1].present?
|
19
|
-
other_right = sets[params[:set].to_i + 1].present?
|
20
|
-
end
|
21
|
-
|
22
|
-
- content_for :contextual_tabs do
|
23
|
-
- if checkboxes
|
24
|
-
= bulk_menu
|
25
|
-
- if filterable_fields.present?
|
26
|
-
%li.dropdown{style: 'float:right'}
|
27
|
-
%a.dropdown-toggle{href: '#', :'data-toggle' => "dropdown"}
|
28
|
-
= t('admin.misc.add_filter')
|
29
|
-
%b.caret
|
30
|
-
%ul.dropdown-menu#filters{style: 'left:auto; right:0;'}
|
31
|
-
- filterable_fields.each do |field|
|
32
|
-
- field_options = case field.type
|
33
|
-
- when :enum
|
34
|
-
- options_for_select(field.with(object: @abstract_model.model.new).enum)
|
35
|
-
- else
|
36
|
-
- ''
|
37
|
-
%li
|
38
|
-
%a{href: '#', :"data-field-label" => field.label, :"data-field-name" => field.name, :"data-field-operator" => field.default_filter_operator, :"data-field-options" => field_options.html_safe, :"data-field-required" => field.required.to_s, :"data-field-type" => field.type, :"data-field-value" => "", :"data-field-datetimepicker-format" => (field.try(:parser) && field.parser.to_momentjs)}= capitalize_first_letter(field.label)
|
39
|
-
|
40
|
-
%style
|
41
|
-
- properties.select{ |p| p.column_width.present? }.each do |property|
|
42
|
-
= "#list th.#{property.css_class} { width: #{property.column_width}px; min-width: #{property.column_width}px; }"
|
43
|
-
= "#list td.#{property.css_class} { max-width: #{property.column_width}px; }"
|
44
|
-
|
45
|
-
#list
|
46
|
-
= form_tag(index_path(params.except(*%w[page f query])), method: :get, class: "pjax-form form-inline") do
|
47
|
-
.well
|
48
|
-
%span#filters_box{data: {options: ordered_filter_options.to_json}}
|
49
|
-
%hr.filters_box{style: "display:#{ordered_filters.empty? ? 'none' : 'block'}"}
|
50
|
-
.input-group
|
51
|
-
%input.form-control.input-small{name: "query", type: "search", value: query, placeholder: t("admin.misc.filter")}
|
52
|
-
%span.input-group-btn
|
53
|
-
%button.btn.btn-primary{type: 'submit', :'data-disable-with' => '<i class="icon-white icon-refresh"></i> '.html_safe + t('admin.misc.refresh')}
|
54
|
-
%i.icon-white.icon-refresh
|
55
|
-
= t('admin.misc.refresh')
|
56
|
-
%button#remove_filter.btn.btn-info{title: t('admin.misc.reset_filters')}
|
57
|
-
%i.icon-white.icon-remove
|
58
|
-
- if export_action
|
59
|
-
%span{style: 'float:right'}= link_to wording_for(:link, export_action), export_path(params.except('set').except('page')), class: 'btn btn-info'
|
60
|
-
|
61
|
-
- unless @model_config.list.scopes.empty?
|
62
|
-
%ul.nav.nav-tabs#scope_selector
|
63
|
-
- @model_config.list.scopes.each_with_index do |scope, index|
|
64
|
-
- scope = '_all' if scope.nil?
|
65
|
-
%li{class: "#{'active' if scope.to_s == params[:scope] || (params[:scope].blank? && index == 0)}"}
|
66
|
-
%a{href: index_path(params.merge(scope: scope, page: nil)), class: 'pjax'}= I18n.t("admin.scopes.#{@abstract_model.to_param}.#{scope}", default: I18n.t("admin.scopes.#{scope}", default: scope.to_s.titleize))
|
67
|
-
|
68
|
-
= form_tag bulk_action_path(model_name: @abstract_model.to_param), method: :post, id: "bulk_form", class: ["form", frozen_columns ? 'ra-sidescroll' : nil], data: (frozen_columns ? {ra_sidescroll: frozen_columns} : {}) do
|
69
|
-
= hidden_field_tag :bulk_action
|
70
|
-
- if description.present?
|
71
|
-
%p
|
72
|
-
%strong= description
|
73
|
-
|
74
|
-
%table.table.table-condensed.table-striped
|
75
|
-
%thead
|
76
|
-
%tr
|
77
|
-
- if checkboxes
|
78
|
-
%th.shrink
|
79
|
-
%input.toggle{type: "checkbox"}
|
80
|
-
- if frozen_columns
|
81
|
-
%th.last.shrink
|
82
|
-
- if other_left
|
83
|
-
%th.other.left.shrink= "..."
|
84
|
-
- properties.each do |property|
|
85
|
-
- selected = (sort == property.name.to_s)
|
86
|
-
- if property.sortable
|
87
|
-
- sort_location = index_path params.except('sort_reverse').except('page').merge(sort: property.name).merge(selected && sort_reverse != "true" ? {sort_reverse: "true"} : {})
|
88
|
-
- sort_direction = (sort_reverse == 'true' ? "headerSortUp" : "headerSortDown" if selected)
|
89
|
-
%th{class: "#{property.sortable && "header pjax" || nil} #{sort_direction if property.sortable && sort_direction} #{property.css_class} #{property.type_css_class}", :'data-href' => (property.sortable && sort_location), rel: "tooltip", title: "#{property.hint}"}= capitalize_first_letter(property.label)
|
90
|
-
- if other_right
|
91
|
-
%th.other.right.shrink= "..."
|
92
|
-
- unless frozen_columns
|
93
|
-
%th.last.shrink
|
94
|
-
%tbody
|
95
|
-
- @objects.each do |object|
|
96
|
-
%tr{class: "#{@abstract_model.param_key}_row #{@model_config.list.with(object: object).row_css_class}"}
|
97
|
-
- if checkboxes
|
98
|
-
%td= check_box_tag "bulk_ids[]", object.id, false
|
99
|
-
- if frozen_columns
|
100
|
-
%td.last.links
|
101
|
-
%ul.inline.list-inline= menu_for :member, @abstract_model, object, true
|
102
|
-
- if @other_left_link ||= other_left && index_path(params.except('set').merge(params[:set].to_i != 1 ? {set: (params[:set].to_i - 1)} : {}))
|
103
|
-
%td.other.left= link_to "...", @other_left_link, class: 'pjax'
|
104
|
-
- properties.map{ |property| property.bind(:object, object) }.each do |property|
|
105
|
-
- value = property.pretty_value
|
106
|
-
%td{class: "#{property.css_class} #{property.type_css_class}", title: value}= value
|
107
|
-
- if @other_right_link ||= other_right && index_path(params.merge(set: (params[:set].to_i + 1)))
|
108
|
-
%td.other.right= link_to "...", @other_right_link, class: 'pjax'
|
109
|
-
- unless frozen_columns
|
110
|
-
%td.last.links
|
111
|
-
%ul.inline.list-inline= menu_for :member, @abstract_model, object, true
|
112
|
-
|
113
|
-
- if @model_config.list.limited_pagination
|
114
|
-
.row
|
115
|
-
.col-md-6= paginate(@objects, theme: 'ra-twitter-bootstrap/without_count', total_pages: Float::INFINITY, remote: true)
|
116
|
-
|
117
|
-
- elsif @objects.respond_to?(:total_count)
|
118
|
-
- total_count = @objects.total_count.to_i
|
119
|
-
.row
|
120
|
-
.col-md-6= paginate(@objects, theme: 'ra-twitter-bootstrap', remote: true)
|
121
|
-
.row
|
122
|
-
.col-md-6= link_to(t("admin.misc.show_all"), index_path(params.merge(all: true)), class: "show-all btn btn-default clearfix pjax") unless total_count > 100 || total_count <= @objects.to_a.size
|
123
|
-
.clearfix.total-count= "#{total_count} #{@model_config.pluralize(total_count).downcase}"
|
124
|
-
|
125
|
-
- else
|
126
|
-
.clearfix.total-count= "#{@objects.size} #{@model_config.pluralize(@objects.size).downcase}"
|
@@ -1,15 +0,0 @@
|
|
1
|
-
- @model_config.show.with(object: @object, view: self, controller: self.controller).visible_groups.each do |fieldset|
|
2
|
-
- unless (fields = fieldset.with(object: @object, view: self, controller: self.controller).visible_fields).empty?
|
3
|
-
- unless (fields = fields.reject{ |f| RailsAdmin::config.compact_show_view && (f.formatted_value.nil? || f.formatted_value == '') }).empty?
|
4
|
-
.fieldset
|
5
|
-
%h4
|
6
|
-
= fieldset.label
|
7
|
-
- if fieldset.help
|
8
|
-
%p= fieldset.help
|
9
|
-
%dl
|
10
|
-
- fields.each_with_index do |field, index|
|
11
|
-
%dt
|
12
|
-
%span.label.label-info{class: "#{field.type_css_class} #{field.css_class}"}
|
13
|
-
= field.label
|
14
|
-
%dd.well
|
15
|
-
= field.pretty_value
|
data/config/initializers/haml.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
module RailsAdmin
|
2
|
-
module Adapters
|
3
|
-
module ActiveRecord
|
4
|
-
class AbstractObject
|
5
|
-
# undef almost all of this class's methods so it will pass almost
|
6
|
-
# everything through to its delegate using method_missing (below).
|
7
|
-
instance_methods.each { |m| undef_method m unless m.to_s =~ /(^__|^send$|^object_id$)/ }
|
8
|
-
# ^^^^^
|
9
|
-
# the unnecessary "to_s" above is a workaround for meta_where, see
|
10
|
-
# https://github.com/sferik/rails_admin/issues/374
|
11
|
-
|
12
|
-
attr_accessor :object
|
13
|
-
|
14
|
-
def initialize(object)
|
15
|
-
self.object = object
|
16
|
-
end
|
17
|
-
|
18
|
-
def set_attributes(attributes)
|
19
|
-
object.assign_attributes(attributes) if attributes
|
20
|
-
end
|
21
|
-
|
22
|
-
def save(options = {validate: true})
|
23
|
-
object.save(**options)
|
24
|
-
end
|
25
|
-
|
26
|
-
if RUBY_VERSION >= '2.7'
|
27
|
-
def method_missing(method_name, *args, **kwargs, &block)
|
28
|
-
object.send(method_name, *args, **kwargs, &block)
|
29
|
-
end
|
30
|
-
else
|
31
|
-
def method_missing(method_name, *args, &block)
|
32
|
-
object.send(method_name, *args, &block)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,348 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'active_record'
|
4
|
-
require 'rails_admin/adapters/active_record/association'
|
5
|
-
require 'rails_admin/adapters/active_record/model_extension'
|
6
|
-
require 'rails_admin/adapters/active_record/property'
|
7
|
-
|
8
|
-
module RailsAdmin
|
9
|
-
module Adapters
|
10
|
-
module ActiveRecord
|
11
|
-
DISABLED_COLUMN_TYPES = %i[tsvector blob binary spatial hstore geometry].freeze
|
12
|
-
|
13
|
-
def model_with_extension
|
14
|
-
@model_with_extension ||=
|
15
|
-
begin
|
16
|
-
klass = Class.new(model) do
|
17
|
-
include ModelExtension
|
18
|
-
end
|
19
|
-
klass.instance_eval <<-RUBY, __FILE__, __LINE__+1
|
20
|
-
def name
|
21
|
-
"#{@model_name.to_s}"
|
22
|
-
end
|
23
|
-
RUBY
|
24
|
-
klass
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def new(params = {})
|
29
|
-
model_with_extension.new(params)
|
30
|
-
end
|
31
|
-
|
32
|
-
def get(id, scope = nil)
|
33
|
-
scope = model_with_extension.merge(scope || scoped)
|
34
|
-
scope.where(primary_key => id).first
|
35
|
-
end
|
36
|
-
|
37
|
-
def scoped
|
38
|
-
model_with_extension.all
|
39
|
-
end
|
40
|
-
|
41
|
-
def first(options = {}, scope = nil)
|
42
|
-
all(options, scope).first
|
43
|
-
end
|
44
|
-
|
45
|
-
def all(options = {}, scope = nil)
|
46
|
-
scope = model_with_extension.merge(scope || scoped)
|
47
|
-
scope = scope.includes(options[:include]) if options[:include]
|
48
|
-
scope = scope.limit(options[:limit]) if options[:limit]
|
49
|
-
scope = bulk_scope(scope, options) if options[:bulk_ids]
|
50
|
-
scope = query_scope(scope, options[:query]) if options[:query]
|
51
|
-
scope = filter_scope(scope, options[:filters]) if options[:filters]
|
52
|
-
scope = scope.send(Kaminari.config.page_method_name, options[:page]).per(options[:per]) if options[:page] && options[:per]
|
53
|
-
scope = sort_scope(scope, options) if options[:sort]
|
54
|
-
scope
|
55
|
-
end
|
56
|
-
|
57
|
-
def count(options = {}, scope = nil)
|
58
|
-
all(options.merge(limit: false, page: false), scope).count(:all)
|
59
|
-
end
|
60
|
-
|
61
|
-
def destroy(objects)
|
62
|
-
Array.wrap(objects).each(&:destroy)
|
63
|
-
end
|
64
|
-
|
65
|
-
def associations
|
66
|
-
model.reflect_on_all_associations.collect do |association|
|
67
|
-
Association.new(association, model)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
def properties
|
72
|
-
columns = model.columns.reject do |c|
|
73
|
-
c.type.blank? ||
|
74
|
-
DISABLED_COLUMN_TYPES.include?(c.type.to_sym) ||
|
75
|
-
c.try(:array)
|
76
|
-
end
|
77
|
-
columns.collect do |property|
|
78
|
-
Property.new(property, model)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def base_class
|
83
|
-
model.base_class
|
84
|
-
end
|
85
|
-
|
86
|
-
delegate :primary_key, :table_name, to: :model, prefix: false
|
87
|
-
|
88
|
-
def quoted_table_name
|
89
|
-
model.quoted_table_name
|
90
|
-
end
|
91
|
-
|
92
|
-
def quote_column_name(name)
|
93
|
-
model.connection.quote_column_name(name)
|
94
|
-
end
|
95
|
-
|
96
|
-
def encoding
|
97
|
-
adapter =
|
98
|
-
if ::ActiveRecord::Base.respond_to?(:connection_db_config)
|
99
|
-
::ActiveRecord::Base.connection_db_config.configuration_hash[:adapter]
|
100
|
-
else
|
101
|
-
::ActiveRecord::Base.connection_config[:adapter]
|
102
|
-
end
|
103
|
-
case adapter
|
104
|
-
when 'postgresql'
|
105
|
-
::ActiveRecord::Base.connection.select_one("SELECT ''::text AS str;").values.first.encoding
|
106
|
-
when 'mysql2'
|
107
|
-
if RUBY_ENGINE == 'jruby'
|
108
|
-
::ActiveRecord::Base.connection.select_one("SELECT '' AS str;").values.first.encoding
|
109
|
-
else
|
110
|
-
::ActiveRecord::Base.connection.raw_connection.encoding
|
111
|
-
end
|
112
|
-
when 'oracle_enhanced'
|
113
|
-
::ActiveRecord::Base.connection.select_one('SELECT dummy FROM DUAL').values.first.encoding
|
114
|
-
else
|
115
|
-
::ActiveRecord::Base.connection.select_one("SELECT '' AS str;").values.first.encoding
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
def embedded?
|
120
|
-
false
|
121
|
-
end
|
122
|
-
|
123
|
-
def cyclic?
|
124
|
-
false
|
125
|
-
end
|
126
|
-
|
127
|
-
def adapter_supports_joins?
|
128
|
-
true
|
129
|
-
end
|
130
|
-
|
131
|
-
private
|
132
|
-
|
133
|
-
def bulk_scope(scope, options)
|
134
|
-
scope.where(primary_key => options[:bulk_ids])
|
135
|
-
end
|
136
|
-
|
137
|
-
def sort_scope(scope, options)
|
138
|
-
direction = options[:sort_reverse] ? :asc : :desc
|
139
|
-
case options[:sort]
|
140
|
-
when String, Symbol
|
141
|
-
scope.reorder("#{options[:sort]} #{direction}")
|
142
|
-
when Array
|
143
|
-
scope.reorder(options[:sort].zip(Array.new(options[:sort].size) { direction }).to_h)
|
144
|
-
when Hash
|
145
|
-
scope.reorder(options[:sort].map { |table_name, column| "#{table_name}.#{column}" }.
|
146
|
-
zip(Array.new(options[:sort].size) { direction }).to_h)
|
147
|
-
else
|
148
|
-
raise ArgumentError.new("Unsupported sort value: #{options[:sort]}")
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
class WhereBuilder
|
153
|
-
def initialize(scope)
|
154
|
-
@statements = []
|
155
|
-
@values = []
|
156
|
-
@tables = []
|
157
|
-
@scope = scope
|
158
|
-
end
|
159
|
-
|
160
|
-
def add(field, value, operator)
|
161
|
-
field.searchable_columns.flatten.each do |column_infos|
|
162
|
-
statement, value1, value2 = StatementBuilder.new(column_infos[:column], column_infos[:type], value, operator, @scope.connection.adapter_name).to_statement
|
163
|
-
@statements << statement if statement.present?
|
164
|
-
@values << value1 unless value1.nil?
|
165
|
-
@values << value2 unless value2.nil?
|
166
|
-
table, column = column_infos[:column].split('.')
|
167
|
-
@tables.push(table) if column
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
def build
|
172
|
-
scope = @scope.where(@statements.join(' OR '), *@values)
|
173
|
-
scope = scope.references(*@tables.uniq) if @tables.any?
|
174
|
-
scope
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
def query_scope(scope, query, fields = config.list.fields.select(&:queryable?))
|
179
|
-
if config.list.search_by
|
180
|
-
scope.send(config.list.search_by, query)
|
181
|
-
else
|
182
|
-
wb = WhereBuilder.new(scope)
|
183
|
-
fields.each do |field|
|
184
|
-
value = parse_field_value(field, query)
|
185
|
-
wb.add(field, value, field.search_operator)
|
186
|
-
end
|
187
|
-
# OR all query statements
|
188
|
-
wb.build
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
# filters example => {"string_field"=>{"0055"=>{"o"=>"like", "v"=>"test_value"}}, ...}
|
193
|
-
# "0055" is the filter index, no use here. o is the operator, v the value
|
194
|
-
def filter_scope(scope, filters, fields = config.list.fields.select(&:filterable?))
|
195
|
-
filters.each_pair do |field_name, filters_dump|
|
196
|
-
filters_dump.each_value do |filter_dump|
|
197
|
-
wb = WhereBuilder.new(scope)
|
198
|
-
field = fields.detect { |f| f.name.to_s == field_name }
|
199
|
-
value = parse_field_value(field, filter_dump[:v])
|
200
|
-
|
201
|
-
wb.add(field, value, (filter_dump[:o] || RailsAdmin::Config.default_search_operator))
|
202
|
-
# AND current filter statements to other filter statements
|
203
|
-
scope = wb.build
|
204
|
-
end
|
205
|
-
end
|
206
|
-
scope
|
207
|
-
end
|
208
|
-
|
209
|
-
def build_statement(column, type, value, operator)
|
210
|
-
StatementBuilder.new(column, type, value, operator, model.connection.adapter_name).to_statement
|
211
|
-
end
|
212
|
-
|
213
|
-
class StatementBuilder < RailsAdmin::AbstractModel::StatementBuilder
|
214
|
-
def initialize(column, type, value, operator, adapter_name)
|
215
|
-
super column, type, value, operator
|
216
|
-
@adapter_name = adapter_name
|
217
|
-
end
|
218
|
-
|
219
|
-
protected
|
220
|
-
|
221
|
-
def unary_operators
|
222
|
-
case @type
|
223
|
-
when :boolean
|
224
|
-
boolean_unary_operators
|
225
|
-
when :uuid
|
226
|
-
uuid_unary_operators
|
227
|
-
when :integer, :decimal, :float
|
228
|
-
numeric_unary_operators
|
229
|
-
else
|
230
|
-
generic_unary_operators
|
231
|
-
end
|
232
|
-
end
|
233
|
-
|
234
|
-
private
|
235
|
-
|
236
|
-
def generic_unary_operators
|
237
|
-
{
|
238
|
-
'_blank' => ["(#{@column} IS NULL OR #{@column} = '')"],
|
239
|
-
'_present' => ["(#{@column} IS NOT NULL AND #{@column} != '')"],
|
240
|
-
'_null' => ["(#{@column} IS NULL)"],
|
241
|
-
'_not_null' => ["(#{@column} IS NOT NULL)"],
|
242
|
-
'_empty' => ["(#{@column} = '')"],
|
243
|
-
'_not_empty' => ["(#{@column} != '')"],
|
244
|
-
}
|
245
|
-
end
|
246
|
-
|
247
|
-
def boolean_unary_operators
|
248
|
-
generic_unary_operators.merge(
|
249
|
-
'_blank' => ["(#{@column} IS NULL)"],
|
250
|
-
'_empty' => ["(#{@column} IS NULL)"],
|
251
|
-
'_present' => ["(#{@column} IS NOT NULL)"],
|
252
|
-
'_not_empty' => ["(#{@column} IS NOT NULL)"],
|
253
|
-
)
|
254
|
-
end
|
255
|
-
alias_method :numeric_unary_operators, :boolean_unary_operators
|
256
|
-
alias_method :uuid_unary_operators, :boolean_unary_operators
|
257
|
-
|
258
|
-
def range_filter(min, max)
|
259
|
-
if min && max && min == max
|
260
|
-
["(#{@column} = ?)", min]
|
261
|
-
elsif min && max
|
262
|
-
["(#{@column} BETWEEN ? AND ?)", min, max]
|
263
|
-
elsif min
|
264
|
-
["(#{@column} >= ?)", min]
|
265
|
-
elsif max
|
266
|
-
["(#{@column} <= ?)", max]
|
267
|
-
end
|
268
|
-
end
|
269
|
-
|
270
|
-
def build_statement_for_type
|
271
|
-
case @type
|
272
|
-
when :boolean then build_statement_for_boolean
|
273
|
-
when :integer, :decimal, :float then build_statement_for_integer_decimal_or_float
|
274
|
-
when :string, :text, :citext then build_statement_for_string_or_text
|
275
|
-
when :enum then build_statement_for_enum
|
276
|
-
when :belongs_to_association then build_statement_for_belongs_to_association
|
277
|
-
when :uuid then build_statement_for_uuid
|
278
|
-
end
|
279
|
-
end
|
280
|
-
|
281
|
-
def build_statement_for_boolean
|
282
|
-
case @value
|
283
|
-
when 'false', 'f', '0'
|
284
|
-
["(#{@column} IS NULL OR #{@column} = ?)", false]
|
285
|
-
when 'true', 't', '1'
|
286
|
-
["(#{@column} = ?)", true]
|
287
|
-
end
|
288
|
-
end
|
289
|
-
|
290
|
-
def column_for_value(value)
|
291
|
-
["(#{@column} = ?)", value]
|
292
|
-
end
|
293
|
-
|
294
|
-
def build_statement_for_belongs_to_association
|
295
|
-
return if @value.blank?
|
296
|
-
|
297
|
-
["(#{@column} = ?)", @value.to_i] if @value.to_i.to_s == @value
|
298
|
-
end
|
299
|
-
|
300
|
-
def build_statement_for_string_or_text
|
301
|
-
return if @value.blank?
|
302
|
-
|
303
|
-
return ["(#{@column} = ?)", @value] if ['is', '='].include?(@operator)
|
304
|
-
|
305
|
-
@value = @value.mb_chars.downcase unless %w[postgresql postgis].include? ar_adapter
|
306
|
-
|
307
|
-
@value =
|
308
|
-
case @operator
|
309
|
-
when 'default', 'like', 'not_like'
|
310
|
-
"%#{@value}%"
|
311
|
-
when 'starts_with'
|
312
|
-
"#{@value}%"
|
313
|
-
when 'ends_with'
|
314
|
-
"%#{@value}"
|
315
|
-
else
|
316
|
-
return
|
317
|
-
end
|
318
|
-
|
319
|
-
if %w[postgresql postgis].include? ar_adapter
|
320
|
-
if @operator == 'not_like'
|
321
|
-
["(#{@column} NOT ILIKE ?)", @value]
|
322
|
-
else
|
323
|
-
["(#{@column} ILIKE ?)", @value]
|
324
|
-
end
|
325
|
-
elsif @operator == 'not_like'
|
326
|
-
["(LOWER(#{@column}) NOT LIKE ?)", @value]
|
327
|
-
else
|
328
|
-
["(LOWER(#{@column}) LIKE ?)", @value]
|
329
|
-
end
|
330
|
-
end
|
331
|
-
|
332
|
-
def build_statement_for_enum
|
333
|
-
return if @value.blank?
|
334
|
-
|
335
|
-
["(#{@column} IN (?))", Array.wrap(@value)]
|
336
|
-
end
|
337
|
-
|
338
|
-
def build_statement_for_uuid
|
339
|
-
column_for_value(@value) if /\A[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}\z/.match?(@value.to_s)
|
340
|
-
end
|
341
|
-
|
342
|
-
def ar_adapter
|
343
|
-
@adapter_name.downcase
|
344
|
-
end
|
345
|
-
end
|
346
|
-
end
|
347
|
-
end
|
348
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'rails_admin/adapters/active_record/abstract_object'
|
2
|
-
|
3
|
-
module RailsAdmin
|
4
|
-
module Adapters
|
5
|
-
module Mongoid
|
6
|
-
class AbstractObject < RailsAdmin::Adapters::ActiveRecord::AbstractObject
|
7
|
-
def initialize(object)
|
8
|
-
super
|
9
|
-
object.associations.each do |name, association|
|
10
|
-
association = Association.new(association, object.class)
|
11
|
-
if [:has_many, :references_many].include? association.macro
|
12
|
-
instance_eval <<-RUBY, __FILE__, __LINE__ + 1
|
13
|
-
def #{name.to_s.singularize}_ids
|
14
|
-
#{name}.map{|item| item.id }
|
15
|
-
end
|
16
|
-
|
17
|
-
def #{name.to_s.singularize}_ids=(item_ids)
|
18
|
-
__items__ = Array.wrap(item_ids).map{|item_id| #{name}.klass.find(item_id) rescue nil }.compact
|
19
|
-
unless persisted?
|
20
|
-
__items__.each do |item|
|
21
|
-
item.update_attribute('#{association.foreign_key}', id)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
super __items__.map(&:id)
|
25
|
-
end
|
26
|
-
RUBY
|
27
|
-
elsif [:has_one, :references_one].include? association.macro
|
28
|
-
instance_eval <<-RUBY, __FILE__, __LINE__ + 1
|
29
|
-
def #{name}_id=(item_id)
|
30
|
-
item = (#{association.klass}.find(item_id) rescue nil)
|
31
|
-
return unless item
|
32
|
-
item.update_attribute('#{association.foreign_key}', id) unless persisted?
|
33
|
-
super item.id
|
34
|
-
end
|
35
|
-
RUBY
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module Sass
|
2
|
-
module Script
|
3
|
-
module Functions
|
4
|
-
def image_path(source, _options = {})
|
5
|
-
if defined?(::Sprockets)
|
6
|
-
::Sass::Script::String.new sprockets_context.image_path(source.value).to_s, :string
|
7
|
-
elsif defined?(::Compass)
|
8
|
-
image_url(source, Sass::Script::Bool.new(true))
|
9
|
-
else
|
10
|
-
# Revert to the old compass-agnostic path determination
|
11
|
-
asset_sans_quotes = source.value.delete('"')
|
12
|
-
Sass::Script::String.new("/images/#{asset_sans_quotes}", :string)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
protected
|
17
|
-
|
18
|
-
def sprockets_context # :nodoc:
|
19
|
-
if options.key?(:sprockets)
|
20
|
-
options[:sprockets][:context]
|
21
|
-
else
|
22
|
-
# Compatibility with sprockets pre 2.10.0
|
23
|
-
options[:importer].context
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Sass
|
2
|
-
module Script
|
3
|
-
module Functions
|
4
|
-
# LARS: Snatched from compass - 2011-11-29 - used for gradients in IE6-9
|
5
|
-
# returns an IE hex string for a color with an alpha channel
|
6
|
-
# suitable for passing to IE filters.
|
7
|
-
def ie_hex_str(color)
|
8
|
-
assert_type color, :Color
|
9
|
-
alpha = (color.alpha * 255).round
|
10
|
-
alphastr = alpha.to_s(16).rjust(2, '0')
|
11
|
-
Sass::Script::String.new("##{alphastr}#{color.send(:hex_str)[1..-1]}".upcase)
|
12
|
-
end
|
13
|
-
declare :ie_hex_str, [:color] if respond_to?(:declare)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
module RailsAdmin
|
2
|
-
module Bootstrap
|
3
|
-
class FrameworkNotFound < StandardError; end
|
4
|
-
|
5
|
-
# Inspired by Kaminari
|
6
|
-
def self.load!
|
7
|
-
if compass?
|
8
|
-
require 'rails_admin/bootstrap-sass/compass_functions'
|
9
|
-
register_compass_extension
|
10
|
-
elsif asset_pipeline?
|
11
|
-
require 'rails_admin/bootstrap-sass/sass_functions'
|
12
|
-
end
|
13
|
-
|
14
|
-
require 'sassc-rails' if rails?
|
15
|
-
|
16
|
-
unless rails? || compass?
|
17
|
-
raise(Bootstrap::FrameworkNotFound.new('bootstrap-sass requires either Rails > 3.1 or Compass, neither of which are loaded'))
|
18
|
-
end
|
19
|
-
|
20
|
-
if defined?(::Sass) && ::Sass.respond_to?(:load_paths)
|
21
|
-
stylesheets = File.expand_path(File.join('..', 'vendor', 'assets', 'stylesheets'))
|
22
|
-
fonts = File.expand_path(File.join('..', 'vendor', 'assets', 'fonts'))
|
23
|
-
::Sass.load_paths << stylesheets
|
24
|
-
::Sass.load_paths << fonts
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.asset_pipeline?
|
29
|
-
defined?(::Sprockets)
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.compass?
|
33
|
-
defined?(::Compass)
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.rails?
|
37
|
-
defined?(::Rails)
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.register_compass_extension
|
41
|
-
base = File.join(File.dirname(__FILE__), '..')
|
42
|
-
styles = File.join(base, 'vendor', 'assets', 'stylesheets')
|
43
|
-
templates = File.join(base, 'templates')
|
44
|
-
::Compass::Frameworks.register('bootstrap', path: base, stylesheets_directory: styles, templates_directory: templates)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
RailsAdmin::Bootstrap.load!
|