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
@@ -0,0 +1,405 @@
|
|
1
|
+
import jQuery from "jquery";
|
2
|
+
import moment from "moment";
|
3
|
+
import I18n from "./i18n";
|
4
|
+
|
5
|
+
(function ($) {
|
6
|
+
var filters;
|
7
|
+
|
8
|
+
$.filters = filters = {
|
9
|
+
append: function (options) {
|
10
|
+
options = options || {};
|
11
|
+
var field_label = options["label"];
|
12
|
+
var field_name = options["name"];
|
13
|
+
var field_type = options["type"];
|
14
|
+
var field_value = options["value"];
|
15
|
+
var field_operator = options["operator"];
|
16
|
+
var select_options = options["select_options"];
|
17
|
+
var required = options["required"];
|
18
|
+
var index = options["index"];
|
19
|
+
var value_name = "f[" + field_name + "][" + index + "][v]";
|
20
|
+
var operator_name = "f[" + field_name + "][" + index + "][o]";
|
21
|
+
var control = null;
|
22
|
+
var additional_control = null;
|
23
|
+
|
24
|
+
switch (field_type) {
|
25
|
+
case "boolean":
|
26
|
+
control = $('<select class="input-sm form-control"></select>')
|
27
|
+
.prop("name", value_name)
|
28
|
+
.append('<option value="_discard">...</option>')
|
29
|
+
.append(
|
30
|
+
$('<option value="true"></option>')
|
31
|
+
.prop("selected", field_value == "true")
|
32
|
+
.text(I18n.t("true"))
|
33
|
+
)
|
34
|
+
.append(
|
35
|
+
$('<option value="false"></option>')
|
36
|
+
.prop("selected", field_value == "false")
|
37
|
+
.text(I18n.t("false"))
|
38
|
+
);
|
39
|
+
if (!required) {
|
40
|
+
control.append([
|
41
|
+
'<option disabled="disabled">---------</option>',
|
42
|
+
$('<option value="_present"></option>')
|
43
|
+
.prop("selected", field_value == "_present")
|
44
|
+
.text(I18n.t("is_present")),
|
45
|
+
$('<option value="_blank"></option>')
|
46
|
+
.prop("selected", field_value == "_blank")
|
47
|
+
.text(I18n.t("is_blank")),
|
48
|
+
]);
|
49
|
+
}
|
50
|
+
break;
|
51
|
+
case "date":
|
52
|
+
case "datetime":
|
53
|
+
case "timestamp":
|
54
|
+
case "time":
|
55
|
+
control =
|
56
|
+
control ||
|
57
|
+
$(
|
58
|
+
'<select class="switch-additional-fieldsets input-sm form-control"></select>'
|
59
|
+
)
|
60
|
+
.prop("name", operator_name)
|
61
|
+
.append(
|
62
|
+
$(
|
63
|
+
'<option data-additional-fieldset="default" value="default"></option>'
|
64
|
+
)
|
65
|
+
.prop("selected", field_operator == "default")
|
66
|
+
.text(I18n.t(field_type == "time" ? "time" : "date"))
|
67
|
+
)
|
68
|
+
.append(
|
69
|
+
$(
|
70
|
+
'<option data-additional-fieldset="between" value="between"></option>'
|
71
|
+
)
|
72
|
+
.prop("selected", field_operator == "between")
|
73
|
+
.text(I18n.t("between_and_"))
|
74
|
+
);
|
75
|
+
if (field_type != "time") {
|
76
|
+
control.append([
|
77
|
+
$('<option value="today"></option>')
|
78
|
+
.prop("selected", field_operator == "today")
|
79
|
+
.text(I18n.t("today")),
|
80
|
+
$('<option value="yesterday"></option>')
|
81
|
+
.prop("selected", field_operator == "yesterday")
|
82
|
+
.text(I18n.t("yesterday")),
|
83
|
+
$('<option value="this_week"></option>')
|
84
|
+
.prop("selected", field_operator == "this_week")
|
85
|
+
.text(I18n.t("this_week")),
|
86
|
+
$('<option value="last_week"></option>')
|
87
|
+
.prop("selected", field_operator == "last_week")
|
88
|
+
.text(I18n.t("last_week")),
|
89
|
+
]);
|
90
|
+
}
|
91
|
+
if (!required) {
|
92
|
+
control.append([
|
93
|
+
'<option disabled="disabled">---------</option>',
|
94
|
+
$('<option value="_not_null"></option>')
|
95
|
+
.prop("selected", field_operator == "_not_null")
|
96
|
+
.text(I18n.t("is_present")),
|
97
|
+
$('<option value="_null"></option>')
|
98
|
+
.prop("selected", field_operator == "_null")
|
99
|
+
.text(I18n.t("is_blank")),
|
100
|
+
]);
|
101
|
+
}
|
102
|
+
additional_control = $.map(
|
103
|
+
[undefined, "-∞", "∞"],
|
104
|
+
function (placeholder, index) {
|
105
|
+
var visible =
|
106
|
+
index == 0
|
107
|
+
? !field_operator || field_operator == "default"
|
108
|
+
: field_operator == "between";
|
109
|
+
return $('<span class="additional-fieldset"></span>')
|
110
|
+
.addClass(index == 0 ? "default" : "between")
|
111
|
+
.css("display", visible ? "inline-block" : "none")
|
112
|
+
.html(
|
113
|
+
$('<input type="hidden" />')
|
114
|
+
.prop("name", value_name + "[]")
|
115
|
+
.prop("value", field_value[index] || "")
|
116
|
+
.add(
|
117
|
+
$('<input class="input-sm form-control" type="text" />')
|
118
|
+
.addClass(field_type == "date" ? "date" : "datetime")
|
119
|
+
.prop(
|
120
|
+
"size",
|
121
|
+
field_type == "date" || field_type == "time" ? 20 : 25
|
122
|
+
)
|
123
|
+
.prop("placeholder", placeholder)
|
124
|
+
)
|
125
|
+
);
|
126
|
+
}
|
127
|
+
);
|
128
|
+
break;
|
129
|
+
case "enum":
|
130
|
+
var multiple_values = field_value instanceof Array ? true : false;
|
131
|
+
control = $(
|
132
|
+
'<select class="select-single input-sm form-control"></select>'
|
133
|
+
)
|
134
|
+
.css("display", multiple_values ? "none" : "inline-block")
|
135
|
+
.prop("name", multiple_values ? undefined : value_name)
|
136
|
+
.data("name", value_name)
|
137
|
+
.append('<option value="_discard">...</option>')
|
138
|
+
.append(
|
139
|
+
required
|
140
|
+
? []
|
141
|
+
: [
|
142
|
+
$('<option value="_present"></option>')
|
143
|
+
.prop("selected", field_value == "_present")
|
144
|
+
.text(I18n.t("is_present")),
|
145
|
+
$('<option value="_blank"></option>')
|
146
|
+
.prop("selected", field_value == "_blank")
|
147
|
+
.text(I18n.t("is_blank")),
|
148
|
+
'<option disabled="disabled">---------</option>',
|
149
|
+
]
|
150
|
+
)
|
151
|
+
.append(select_options)
|
152
|
+
.add(
|
153
|
+
$(
|
154
|
+
'<select multiple="multiple" class="select-multiple input-sm form-control"></select>'
|
155
|
+
)
|
156
|
+
.css("display", multiple_values ? "inline-block" : "none")
|
157
|
+
.prop("name", multiple_values ? value_name + "[]" : undefined)
|
158
|
+
.data("name", value_name + "[]")
|
159
|
+
.append(select_options)
|
160
|
+
)
|
161
|
+
.add(
|
162
|
+
$('<a href="#" class="switch-select"></a>').append(
|
163
|
+
$("<i></i>").addClass(
|
164
|
+
"fas fa-" + (multiple_values ? "minus" : "plus")
|
165
|
+
)
|
166
|
+
)
|
167
|
+
);
|
168
|
+
break;
|
169
|
+
case "citext":
|
170
|
+
case "string":
|
171
|
+
case "text":
|
172
|
+
case "belongs_to_association":
|
173
|
+
control = $(
|
174
|
+
'<select class="switch-additional-fieldsets input-sm form-control"></select>'
|
175
|
+
)
|
176
|
+
.prop("value", field_operator)
|
177
|
+
.prop("name", operator_name)
|
178
|
+
.append('<option value="_discard">...</option>')
|
179
|
+
.append(
|
180
|
+
$(
|
181
|
+
'<option data-additional-fieldset="additional-fieldset" value="like"></option>'
|
182
|
+
)
|
183
|
+
.prop("selected", field_operator == "like")
|
184
|
+
.text(I18n.t("contains"))
|
185
|
+
)
|
186
|
+
.append(
|
187
|
+
$(
|
188
|
+
'<option data-additional-fieldset="additional-fieldset" value="not_like"></option>'
|
189
|
+
)
|
190
|
+
.prop("selected", field_operator == "not_like")
|
191
|
+
.text(I18n.t("does_not_contain"))
|
192
|
+
)
|
193
|
+
.append(
|
194
|
+
$(
|
195
|
+
'<option data-additional-fieldset="additional-fieldset" value="is"></option>'
|
196
|
+
)
|
197
|
+
.prop("selected", field_operator == "is")
|
198
|
+
.text(I18n.t("is_exactly"))
|
199
|
+
)
|
200
|
+
.append(
|
201
|
+
$(
|
202
|
+
'<option data-additional-fieldset="additional-fieldset" value="starts_with"></option>'
|
203
|
+
)
|
204
|
+
.prop("selected", field_operator == "starts_with")
|
205
|
+
.text(I18n.t("starts_with"))
|
206
|
+
)
|
207
|
+
.append(
|
208
|
+
$(
|
209
|
+
'<option data-additional-fieldset="additional-fieldset" value="ends_with"></option>'
|
210
|
+
)
|
211
|
+
.prop("selected", field_operator == "ends_with")
|
212
|
+
.text(I18n.t("ends_with"))
|
213
|
+
);
|
214
|
+
if (!required) {
|
215
|
+
control.append([
|
216
|
+
'<option disabled="disabled">---------</option>',
|
217
|
+
$('<option value="_present"></option>')
|
218
|
+
.prop("selected", field_operator == "_present")
|
219
|
+
.text(I18n.t("is_present")),
|
220
|
+
$('<option value="_blank"></option>')
|
221
|
+
.prop("selected", field_operator == "_blank")
|
222
|
+
.text(I18n.t("is_blank")),
|
223
|
+
]);
|
224
|
+
}
|
225
|
+
additional_control = $(
|
226
|
+
'<input class="additional-fieldset input-sm form-control" type="text" />'
|
227
|
+
)
|
228
|
+
.css(
|
229
|
+
"display",
|
230
|
+
field_operator == "_present" || field_operator == "_blank"
|
231
|
+
? "none"
|
232
|
+
: "inline-block"
|
233
|
+
)
|
234
|
+
.prop("name", value_name)
|
235
|
+
.prop("value", field_value);
|
236
|
+
break;
|
237
|
+
case "integer":
|
238
|
+
case "decimal":
|
239
|
+
case "float":
|
240
|
+
control = $(
|
241
|
+
'<select class="switch-additional-fieldsets input-sm form-control"></select>'
|
242
|
+
)
|
243
|
+
.prop("name", operator_name)
|
244
|
+
.append(
|
245
|
+
$(
|
246
|
+
'<option data-additional-fieldset="default" value="default"></option>'
|
247
|
+
)
|
248
|
+
.prop("selected", field_operator == "default")
|
249
|
+
.text(I18n.t("number"))
|
250
|
+
)
|
251
|
+
.append(
|
252
|
+
$(
|
253
|
+
'<option data-additional-fieldset="between" value="between"></option>'
|
254
|
+
)
|
255
|
+
.prop("selected", field_operator == "between")
|
256
|
+
.text(I18n.t("between_and_"))
|
257
|
+
);
|
258
|
+
if (!required) {
|
259
|
+
control.append([
|
260
|
+
'<option disabled="disabled">---------</option>',
|
261
|
+
$('<option value="_not_null"></option>')
|
262
|
+
.prop("selected", field_operator == "_not_null")
|
263
|
+
.text(I18n.t("is_present")),
|
264
|
+
$('<option value="_null"></option>')
|
265
|
+
.prop("selected", field_operator == "_null")
|
266
|
+
.text(I18n.t("is_blank")),
|
267
|
+
]);
|
268
|
+
}
|
269
|
+
additional_control = $(
|
270
|
+
'<input class="additional-fieldset default input-sm form-control" type="text" />'
|
271
|
+
)
|
272
|
+
.css(
|
273
|
+
"display",
|
274
|
+
!field_operator || field_operator == "default"
|
275
|
+
? "inline-block"
|
276
|
+
: "none"
|
277
|
+
)
|
278
|
+
.prop("type", field_type)
|
279
|
+
.prop("name", value_name + "[]")
|
280
|
+
.prop("value", field_value[0] || "")
|
281
|
+
.add(
|
282
|
+
$(
|
283
|
+
'<input placeholder="-∞" class="additional-fieldset between input-sm form-control" />'
|
284
|
+
)
|
285
|
+
.css(
|
286
|
+
"display",
|
287
|
+
field_operator == "between" ? "inline-block" : "none"
|
288
|
+
)
|
289
|
+
.prop("type", field_type)
|
290
|
+
.prop("name", value_name + "[]")
|
291
|
+
.prop("value", field_value[1] || "")
|
292
|
+
)
|
293
|
+
.add(
|
294
|
+
$(
|
295
|
+
'<input placeholder="∞" class="additional-fieldset between input-sm form-control" />'
|
296
|
+
)
|
297
|
+
.css(
|
298
|
+
"display",
|
299
|
+
field_operator == "between" ? "inline-block" : "none"
|
300
|
+
)
|
301
|
+
.prop("type", field_type)
|
302
|
+
.prop("name", value_name + "[]")
|
303
|
+
.prop("value", field_value[2] || "")
|
304
|
+
);
|
305
|
+
break;
|
306
|
+
default:
|
307
|
+
control = $('<input type="text" class="input-sm form-control" />')
|
308
|
+
.prop("name", value_name)
|
309
|
+
.prop("value", field_value);
|
310
|
+
break;
|
311
|
+
}
|
312
|
+
|
313
|
+
var filterContainerId = field_name + "-" + index + "-filter-container";
|
314
|
+
$("p#" + filterContainerId).remove();
|
315
|
+
|
316
|
+
var $content = $("<p>")
|
317
|
+
.attr("id", filterContainerId)
|
318
|
+
.addClass("filter form-search")
|
319
|
+
.append(
|
320
|
+
$(
|
321
|
+
'<button type="button" class="btn btn-info btn-sm delete"></button>'
|
322
|
+
)
|
323
|
+
.append('<i class="fas fa-trash"></i>')
|
324
|
+
.append(document.createTextNode(field_label))
|
325
|
+
)
|
326
|
+
.append(" ")
|
327
|
+
.append(control)
|
328
|
+
.append(" ")
|
329
|
+
.append(additional_control);
|
330
|
+
|
331
|
+
$("#filters_box").append($content);
|
332
|
+
|
333
|
+
$content.find(".date, .datetime").each(function () {
|
334
|
+
$(this).datetimepicker({
|
335
|
+
date: moment($(this).siblings("[type=hidden]").val()),
|
336
|
+
locale: I18n.locale,
|
337
|
+
showTodayButton: true,
|
338
|
+
format: options["datetimepicker_format"],
|
339
|
+
});
|
340
|
+
$(this).on("dp.change", function (e) {
|
341
|
+
if (e.date) {
|
342
|
+
$(this)
|
343
|
+
.siblings("[type=hidden]")
|
344
|
+
.val(e.date.format("YYYY-MM-DD[T]HH:mm:ss"));
|
345
|
+
}
|
346
|
+
});
|
347
|
+
});
|
348
|
+
|
349
|
+
$("hr.filters_box:hidden").show("slow");
|
350
|
+
},
|
351
|
+
};
|
352
|
+
|
353
|
+
$(document).on("click", "#filters a", function (e) {
|
354
|
+
e.preventDefault();
|
355
|
+
$.filters.append({
|
356
|
+
label: $(this).data("field-label"),
|
357
|
+
name: $(this).data("field-name"),
|
358
|
+
type: $(this).data("field-type"),
|
359
|
+
value: $(this).data("field-value"),
|
360
|
+
operator: $(this).data("field-operator"),
|
361
|
+
select_options: $(this).data("field-options"),
|
362
|
+
required: $(this).data("field-required"),
|
363
|
+
index: $.now().toString().slice(6, 11),
|
364
|
+
datetimepicker_format: $(this).data("field-datetimepicker-format"),
|
365
|
+
});
|
366
|
+
});
|
367
|
+
|
368
|
+
$(document).on("click", "#filters_box .delete", function (e) {
|
369
|
+
e.preventDefault();
|
370
|
+
var form = $(this).parents("form");
|
371
|
+
$(this).parents(".filter").remove();
|
372
|
+
!$("#filters_box").children().length &&
|
373
|
+
$("hr.filters_box:visible").hide("slow");
|
374
|
+
});
|
375
|
+
|
376
|
+
$(document).on("click", "#filters_box .switch-select", function (e) {
|
377
|
+
e.preventDefault();
|
378
|
+
var selected_select = $(this).siblings("select:visible");
|
379
|
+
var not_selected_select = $(this).siblings("select:hidden");
|
380
|
+
not_selected_select
|
381
|
+
.attr("name", not_selected_select.data("name"))
|
382
|
+
.show("slow");
|
383
|
+
selected_select.attr("name", null).hide("slow");
|
384
|
+
$(this).find("i").toggleClass("fa-plus fa-minus");
|
385
|
+
});
|
386
|
+
|
387
|
+
$(document).on(
|
388
|
+
"change",
|
389
|
+
"#filters_box .switch-additional-fieldsets",
|
390
|
+
function (e) {
|
391
|
+
var selected_option = $(this).find("option:selected");
|
392
|
+
var klass = $(selected_option).data("additional-fieldset");
|
393
|
+
if (klass) {
|
394
|
+
$(this)
|
395
|
+
.siblings(".additional-fieldset:not(." + klass + ")")
|
396
|
+
.hide("slow");
|
397
|
+
$(this)
|
398
|
+
.siblings("." + klass)
|
399
|
+
.show("slow");
|
400
|
+
} else {
|
401
|
+
$(this).siblings(".additional-fieldset").hide("slow");
|
402
|
+
}
|
403
|
+
}
|
404
|
+
);
|
405
|
+
})(jQuery);
|