rails_admin 2.1.0 → 3.0.0.beta
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rails_admin might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile +9 -11
- data/README.md +37 -31
- data/Rakefile +2 -2
- data/app/assets/javascripts/rails_admin.js +21 -0
- data/app/assets/stylesheets/rails_admin/custom/mixins.scss +1 -1
- data/app/assets/stylesheets/rails_admin/custom/variables.scss +1 -1
- data/app/assets/stylesheets/rails_admin.scss.erb +76 -0
- data/app/controllers/rails_admin/application_controller.rb +4 -3
- data/app/controllers/rails_admin/main_controller.rb +43 -24
- data/app/helpers/rails_admin/application_helper.rb +69 -52
- data/app/helpers/rails_admin/form_builder.rb +7 -4
- data/app/helpers/rails_admin/main_helper.rb +27 -43
- data/app/views/kaminari/ra-twitter-bootstrap/_gap.html.erb +5 -0
- data/app/views/kaminari/ra-twitter-bootstrap/_next_page.html.erb +9 -0
- data/app/views/kaminari/ra-twitter-bootstrap/_page.html.erb +9 -0
- data/app/views/kaminari/ra-twitter-bootstrap/_paginator.html.erb +13 -0
- data/app/views/kaminari/ra-twitter-bootstrap/_prev_page.html.erb +9 -0
- data/app/views/kaminari/ra-twitter-bootstrap/without_count/_next_page.html.erb +9 -0
- data/app/views/kaminari/ra-twitter-bootstrap/without_count/_paginator.html.erb +6 -0
- data/app/views/kaminari/ra-twitter-bootstrap/without_count/_prev_page.html.erb +9 -0
- data/app/views/layouts/rails_admin/_head.html.erb +17 -0
- data/app/views/layouts/rails_admin/_navigation.html.erb +21 -0
- data/app/views/layouts/rails_admin/_secondary_navigation.html.erb +24 -0
- data/app/views/layouts/rails_admin/_sidebar_navigation.html.erb +9 -0
- data/app/views/layouts/rails_admin/application.html.erb +27 -0
- data/app/views/layouts/rails_admin/modal.js.erb +7 -0
- data/app/views/layouts/rails_admin/pjax.html.erb +20 -0
- data/app/views/rails_admin/main/_dashboard_history.html.erb +45 -0
- data/app/views/rails_admin/main/_delete_notice.html.erb +35 -0
- data/app/views/rails_admin/main/_form_action_text.html.erb +7 -0
- data/app/views/rails_admin/main/_form_boolean.html.erb +16 -0
- data/app/views/rails_admin/main/{_form_ck_editor.html.haml → _form_ck_editor.html.erb} +3 -3
- data/app/views/rails_admin/main/_form_code_mirror.html.erb +9 -0
- data/app/views/rails_admin/main/_form_colorpicker.html.erb +1 -0
- data/app/views/rails_admin/main/_form_datetime.html.erb +9 -0
- data/app/views/rails_admin/main/_form_enumeration.html.erb +21 -0
- data/app/views/rails_admin/main/_form_field.html.erb +1 -0
- data/app/views/rails_admin/main/_form_file_upload.html.erb +17 -0
- data/app/views/rails_admin/main/{_form_filtering_multiselect.html.haml → _form_filtering_multiselect.html.erb} +11 -11
- data/app/views/rails_admin/main/{_form_filtering_select.html.haml → _form_filtering_select.html.erb} +13 -12
- data/app/views/rails_admin/main/_form_froala.html.erb +8 -0
- data/app/views/rails_admin/main/_form_multiple_file_upload.html.erb +20 -0
- data/app/views/rails_admin/main/_form_nested_many.html.erb +21 -0
- data/app/views/rails_admin/main/_form_nested_one.html.erb +21 -0
- data/app/views/rails_admin/main/_form_polymorphic_association.html.erb +27 -0
- data/app/views/rails_admin/main/_form_simple_mde.html.erb +8 -0
- data/app/views/rails_admin/main/_form_text.html.erb +1 -0
- data/app/views/rails_admin/main/_form_wysihtml5.html.erb +8 -0
- data/app/views/rails_admin/main/_submit_buttons.html.erb +25 -0
- data/app/views/rails_admin/main/bulk_delete.html.erb +19 -0
- data/app/views/rails_admin/main/dashboard.html.erb +64 -0
- data/app/views/rails_admin/main/delete.html.erb +21 -0
- data/app/views/rails_admin/main/edit.html.erb +3 -0
- data/app/views/rails_admin/main/export.html.erb +146 -0
- data/app/views/rails_admin/main/history.html.erb +78 -0
- data/app/views/rails_admin/main/index.html.erb +193 -0
- data/app/views/rails_admin/main/new.html.erb +3 -0
- data/app/views/rails_admin/main/show.html.erb +28 -0
- data/config/initializers/active_record_extensions.rb +3 -1
- data/config/initializers/mongoid_extensions.rb +1 -1
- data/config/locales/rails_admin.en.yml +6 -1
- data/lib/generators/rails_admin/install_generator.rb +51 -3
- data/lib/generators/rails_admin/templates/environment.js +6 -0
- data/lib/generators/rails_admin/templates/initializer.erb +2 -1
- data/lib/generators/rails_admin/templates/rails_admin.js.erb +2 -0
- data/lib/generators/rails_admin/templates/rails_admin.scss +1 -0
- data/lib/generators/rails_admin/templates/webpack.config.js +32 -0
- data/lib/rails_admin/abstract_model.rb +24 -10
- data/lib/rails_admin/adapters/active_record/association.rb +20 -1
- data/lib/rails_admin/adapters/active_record/object_extension.rb +29 -0
- data/lib/rails_admin/adapters/active_record/property.rb +1 -1
- data/lib/rails_admin/adapters/active_record.rb +27 -23
- data/lib/rails_admin/adapters/mongoid/association.rb +38 -9
- data/lib/rails_admin/adapters/mongoid/bson.rb +4 -5
- data/lib/rails_admin/adapters/mongoid/extension.rb +3 -1
- data/lib/rails_admin/adapters/mongoid/object_extension.rb +32 -0
- data/lib/rails_admin/adapters/mongoid/property.rb +2 -2
- data/lib/rails_admin/adapters/mongoid.rb +27 -19
- data/lib/rails_admin/config/actions/base.rb +7 -2
- data/lib/rails_admin/config/actions/bulk_delete.rb +2 -2
- data/lib/rails_admin/config/actions/dashboard.rb +4 -3
- data/lib/rails_admin/config/actions/delete.rb +5 -9
- data/lib/rails_admin/config/actions/edit.rb +7 -7
- data/lib/rails_admin/config/actions/export.rb +2 -2
- data/lib/rails_admin/config/actions/history_index.rb +2 -2
- data/lib/rails_admin/config/actions/history_show.rb +2 -2
- data/lib/rails_admin/config/actions/index.rb +5 -7
- data/lib/rails_admin/config/actions/new.rb +9 -9
- data/lib/rails_admin/config/actions/show.rb +1 -1
- data/lib/rails_admin/config/actions/show_in_app.rb +6 -2
- data/lib/rails_admin/config/actions.rb +4 -4
- data/lib/rails_admin/config/configurable.rb +2 -2
- data/lib/rails_admin/config/fields/association.rb +15 -12
- data/lib/rails_admin/config/fields/base.rb +44 -24
- data/lib/rails_admin/config/fields/factories/active_storage.rb +1 -0
- data/lib/rails_admin/config/fields/factories/association.rb +6 -8
- data/lib/rails_admin/config/fields/factories/carrierwave.rb +2 -1
- data/lib/rails_admin/config/fields/factories/devise.rb +2 -1
- data/lib/rails_admin/config/fields/factories/dragonfly.rb +2 -1
- data/lib/rails_admin/config/fields/factories/paperclip.rb +2 -1
- data/lib/rails_admin/config/fields/factories/shrine.rb +1 -1
- data/lib/rails_admin/config/fields/group.rb +1 -2
- data/lib/rails_admin/config/fields/types/active_record_enum.rb +2 -0
- data/lib/rails_admin/config/fields/types/active_storage.rb +9 -7
- data/lib/rails_admin/config/fields/types/all.rb +1 -0
- data/lib/rails_admin/config/fields/types/belongs_to_association.rb +4 -12
- data/lib/rails_admin/config/fields/types/boolean.rb +32 -8
- data/lib/rails_admin/config/fields/types/carrierwave.rb +1 -0
- data/lib/rails_admin/config/fields/types/citext.rb +13 -0
- data/lib/rails_admin/config/fields/types/color.rb +6 -2
- data/lib/rails_admin/config/fields/types/date.rb +5 -8
- data/lib/rails_admin/config/fields/types/datetime.rb +18 -21
- data/lib/rails_admin/config/fields/types/decimal.rb +9 -2
- data/lib/rails_admin/config/fields/types/dragonfly.rb +3 -1
- data/lib/rails_admin/config/fields/types/enum.rb +1 -1
- data/lib/rails_admin/config/fields/types/file_upload.rb +4 -3
- data/lib/rails_admin/config/fields/types/float.rb +9 -2
- data/lib/rails_admin/config/fields/types/has_many_association.rb +1 -5
- data/lib/rails_admin/config/fields/types/has_one_association.rb +1 -13
- data/lib/rails_admin/config/fields/types/integer.rb +2 -6
- data/lib/rails_admin/config/fields/types/multiple_active_storage.rb +8 -6
- data/lib/rails_admin/config/fields/types/multiple_carrierwave.rb +1 -0
- data/lib/rails_admin/config/fields/types/multiple_file_upload.rb +4 -3
- data/lib/rails_admin/config/fields/types/numeric.rb +18 -0
- data/lib/rails_admin/config/fields/types/polymorphic_association.rb +3 -2
- data/lib/rails_admin/config/fields/types/string.rb +1 -1
- data/lib/rails_admin/config/fields/types/time.rb +1 -4
- data/lib/rails_admin/config/fields/types/timestamp.rb +0 -4
- data/lib/rails_admin/config/fields/types.rb +1 -1
- data/lib/rails_admin/config/fields.rb +3 -1
- data/lib/rails_admin/config/has_fields.rb +5 -6
- data/lib/rails_admin/config/hideable.rb +1 -1
- data/lib/rails_admin/config/inspectable.rb +1 -3
- data/lib/rails_admin/config/model.rb +10 -10
- data/lib/rails_admin/config/sections/base.rb +2 -3
- data/lib/rails_admin/config/sections/list.rb +4 -15
- data/lib/rails_admin/config/sections.rb +1 -1
- data/lib/rails_admin/config.rb +73 -38
- data/lib/rails_admin/engine.rb +36 -23
- data/lib/rails_admin/extension.rb +6 -14
- data/lib/rails_admin/extensions/cancancan/authorization_adapter.rb +4 -2
- data/lib/rails_admin/extensions/paper_trail/auditing_adapter.rb +13 -8
- data/lib/rails_admin/extensions/pundit/authorization_adapter.rb +6 -7
- data/lib/rails_admin/support/csv_converter.rb +12 -13
- data/lib/rails_admin/support/datetime.rb +40 -74
- data/lib/rails_admin/support/esmodule_preprocessor.rb +32 -0
- data/lib/rails_admin/support/hash_helper.rb +6 -5
- data/lib/rails_admin/version.rb +7 -3
- data/lib/rails_admin.rb +1 -4
- data/lib/tasks/rails_admin.rake +3 -3
- data/package.json +28 -0
- data/src/rails_admin/base.js +21 -0
- data/src/rails_admin/filter-box.js +405 -0
- data/src/rails_admin/filtering-multiselect.js +394 -0
- data/src/rails_admin/filtering-select.js +302 -0
- data/src/rails_admin/i18n.js +19 -0
- data/src/rails_admin/nested-form-hooks.js +100 -0
- data/src/rails_admin/remote-form.js +190 -0
- data/src/rails_admin/sidescroll.js +20 -0
- data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/base/README.txt +0 -0
- data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/base/mixins.scss +0 -0
- data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/base/theming.scss +93 -34
- data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/base/variables.scss +0 -0
- data/src/rails_admin/styles/base.scss +64 -0
- data/src/rails_admin/styles/filtering-multiselect.scss +53 -0
- data/src/rails_admin/styles/filtering-select.scss +70 -0
- data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/cerulean/mixins.scss +0 -0
- data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/cerulean/theming.scss +23 -21
- data/src/rails_admin/styles/themes/cerulean/variables.scss +830 -0
- data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/default/mixins.scss +1 -1
- data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/default/theming.scss +0 -0
- data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/default/variables.scss +1 -1
- data/src/rails_admin/styles/widgets.scss +35 -0
- data/src/rails_admin/ui.js +172 -0
- data/src/rails_admin/vendor/jquery.pjax.js +899 -0
- data/src/rails_admin/vendor/jquery_nested_form.js +122 -0
- data/src/rails_admin/widgets.js +512 -0
- data/vendor/assets/fonts/rails_admin/fa-solid-900.eot +0 -0
- data/vendor/assets/fonts/rails_admin/fa-solid-900.svg +5034 -0
- data/vendor/assets/fonts/rails_admin/fa-solid-900.ttf +0 -0
- data/vendor/assets/fonts/rails_admin/fa-solid-900.woff +0 -0
- data/vendor/assets/fonts/rails_admin/fa-solid-900.woff2 +0 -0
- data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-affix.js +50 -28
- data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-alert.js +10 -7
- data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-button.js +35 -20
- data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-carousel.js +48 -25
- data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-collapse.js +70 -28
- data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-dropdown.js +56 -42
- data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-modal.js +118 -40
- data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-popover.js +26 -16
- data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-scrollspy.js +29 -27
- data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-tab.js +46 -19
- data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-tooltip.js +280 -60
- data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-transition.js +5 -5
- data/vendor/assets/javascripts/rails_admin/bootstrap-datetimepicker.js +317 -150
- data/vendor/assets/javascripts/rails_admin/jquery-ui/data.js +41 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/effect.js +1637 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/ie.js +17 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/keycode.js +47 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/position.js +500 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/safe-active-element.js +42 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/scroll-parent.js +47 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/unique-id.js +51 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/version.js +17 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/widget.js +735 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/widgets/autocomplete.js +689 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/widgets/menu.js +680 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/widgets/mouse.js +230 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/widgets/sortable.js +1561 -0
- data/vendor/assets/javascripts/rails_admin/jquery.pjax.js +317 -160
- data/vendor/assets/javascripts/rails_admin/jquery3.js +10872 -0
- data/vendor/assets/javascripts/rails_admin/moment-with-locales.js +11210 -9290
- data/vendor/assets/stylesheets/rails_admin/font-awesome.scss +4476 -2216
- metadata +118 -262
- data/app/assets/images/rails_admin/aristo/images/bg_fallback.png +0 -0
- data/app/assets/images/rails_admin/aristo/images/icon_sprite.png +0 -0
- data/app/assets/images/rails_admin/aristo/images/progress_bar.gif +0 -0
- data/app/assets/images/rails_admin/aristo/images/slider_handles.png +0 -0
- data/app/assets/images/rails_admin/aristo/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/images/rails_admin/aristo/images/ui-icons_454545_256x240.png +0 -0
- data/app/assets/images/rails_admin/bullet_black.png +0 -0
- data/app/assets/images/rails_admin/bullet_white.png +0 -0
- data/app/assets/images/rails_admin/calendar.png +0 -0
- data/app/assets/images/rails_admin/clock.png +0 -0
- data/app/assets/images/rails_admin/logo.png +0 -0
- data/app/assets/images/rails_admin/magnifier.png +0 -0
- data/app/assets/images/rails_admin/multiselect/icon_sprite.png +0 -0
- data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-n-dark.png +0 -0
- data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-n-light.png +0 -0
- data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-s-dark.png +0 -0
- data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-s-light.png +0 -0
- data/app/assets/javascripts/rails_admin/jquery-ui.js.erb +0 -8
- data/app/assets/javascripts/rails_admin/ra.filter-box.js +0 -248
- data/app/assets/javascripts/rails_admin/ra.filtering-multiselect.js +0 -331
- data/app/assets/javascripts/rails_admin/ra.filtering-select.js +0 -294
- data/app/assets/javascripts/rails_admin/ra.i18n.js +0 -28
- data/app/assets/javascripts/rails_admin/ra.nested-form-hooks.js +0 -59
- data/app/assets/javascripts/rails_admin/ra.remote-form.js +0 -155
- data/app/assets/javascripts/rails_admin/ra.sidescroll.js +0 -31
- data/app/assets/javascripts/rails_admin/ra.widgets.js +0 -379
- data/app/assets/javascripts/rails_admin/rails_admin.js +0 -20
- data/app/assets/javascripts/rails_admin/ui.js +0 -135
- data/app/assets/stylesheets/rails_admin/aristo/images/bg_fallback.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/icon_sprite.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/progress_bar.gif +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/slider_handles.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/ui-icons_454545_256x240.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/jquery-ui-1.8.7.custom.scss +0 -733
- data/app/assets/stylesheets/rails_admin/base/font-awesome-4-compability.scss +0 -153
- data/app/assets/stylesheets/rails_admin/ra.filtering-multiselect.scss +0 -88
- data/app/assets/stylesheets/rails_admin/ra.sidescroll.scss +0 -29
- data/app/assets/stylesheets/rails_admin/ra.widgets.scss +0 -17
- data/app/assets/stylesheets/rails_admin/rails_admin.scss.erb +0 -110
- data/app/assets/stylesheets/rails_admin/themes/cerulean/variables.scss +0 -857
- data/app/views/kaminari/ra-twitter-bootstrap/_gap.html.haml +0 -2
- data/app/views/kaminari/ra-twitter-bootstrap/_next_page.html.haml +0 -4
- data/app/views/kaminari/ra-twitter-bootstrap/_page.html.haml +0 -4
- data/app/views/kaminari/ra-twitter-bootstrap/_paginator.html.haml +0 -9
- data/app/views/kaminari/ra-twitter-bootstrap/_prev_page.html.haml +0 -4
- data/app/views/kaminari/ra-twitter-bootstrap/without_count/_next_page.html.haml +0 -4
- data/app/views/kaminari/ra-twitter-bootstrap/without_count/_paginator.html.haml +0 -4
- data/app/views/kaminari/ra-twitter-bootstrap/without_count/_prev_page.html.haml +0 -4
- data/app/views/layouts/rails_admin/_head.html.haml +0 -7
- data/app/views/layouts/rails_admin/_navigation.html.haml +0 -12
- data/app/views/layouts/rails_admin/_secondary_navigation.html.haml +0 -10
- data/app/views/layouts/rails_admin/_sidebar_navigation.html.haml +0 -3
- data/app/views/layouts/rails_admin/application.html.haml +0 -16
- data/app/views/layouts/rails_admin/pjax.html.haml +0 -12
- data/app/views/rails_admin/main/_dashboard_history.html.haml +0 -21
- data/app/views/rails_admin/main/_delete_notice.html.haml +0 -24
- data/app/views/rails_admin/main/_form_action_text.html.haml +0 -7
- data/app/views/rails_admin/main/_form_boolean.html.haml +0 -3
- data/app/views/rails_admin/main/_form_code_mirror.html.haml +0 -9
- data/app/views/rails_admin/main/_form_colorpicker.html.haml +0 -1
- data/app/views/rails_admin/main/_form_datetime.html.haml +0 -5
- data/app/views/rails_admin/main/_form_enumeration.html.haml +0 -19
- data/app/views/rails_admin/main/_form_field.html.haml +0 -1
- data/app/views/rails_admin/main/_form_file_upload.html.haml +0 -17
- data/app/views/rails_admin/main/_form_froala.html.haml +0 -8
- data/app/views/rails_admin/main/_form_multiple_file_upload.html.haml +0 -16
- data/app/views/rails_admin/main/_form_nested_many.html.haml +0 -15
- data/app/views/rails_admin/main/_form_nested_one.html.haml +0 -17
- data/app/views/rails_admin/main/_form_polymorphic_association.html.haml +0 -26
- data/app/views/rails_admin/main/_form_simple_mde.haml +0 -8
- data/app/views/rails_admin/main/_form_text.html.haml +0 -1
- data/app/views/rails_admin/main/_form_wysihtml5.html.haml +0 -8
- data/app/views/rails_admin/main/_submit_buttons.html.haml +0 -16
- data/app/views/rails_admin/main/bulk_delete.html.haml +0 -11
- data/app/views/rails_admin/main/dashboard.html.haml +0 -34
- data/app/views/rails_admin/main/delete.html.haml +0 -18
- data/app/views/rails_admin/main/edit.html.haml +0 -2
- data/app/views/rails_admin/main/export.html.haml +0 -92
- data/app/views/rails_admin/main/history.html.haml +0 -51
- data/app/views/rails_admin/main/index.html.haml +0 -126
- data/app/views/rails_admin/main/new.html.haml +0 -2
- data/app/views/rails_admin/main/show.html.haml +0 -15
- data/config/initializers/devise_patch.rb +0 -9
- data/config/initializers/haml.rb +0 -5
- data/lib/rails_admin/adapters/active_record/abstract_object.rb +0 -32
- data/lib/rails_admin/adapters/mongoid/abstract_object.rb +0 -42
- data/lib/rails_admin/bootstrap-sass/compass_functions.rb +0 -28
- data/lib/rails_admin/bootstrap-sass/sass_functions.rb +0 -16
- data/lib/rails_admin/bootstrap-sass.rb +0 -49
- data/lib/rails_admin/config/lazy_model.rb +0 -68
- data/lib/rails_admin/extensions/history/auditing_adapter.rb +0 -37
- data/lib/rails_admin/extensions/history/history.rb +0 -44
- data/lib/rails_admin/extensions/history.rb +0 -3
- data/lib/rails_admin/support/i18n.rb +0 -43
- data/vendor/assets/fonts/rails_admin/FontAwesome.otf +0 -0
- data/vendor/assets/fonts/rails_admin/fontawesome-webfont.eot +0 -0
- data/vendor/assets/fonts/rails_admin/fontawesome-webfont.svg +0 -2671
- data/vendor/assets/fonts/rails_admin/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/rails_admin/fontawesome-webfont.woff +0 -0
- data/vendor/assets/fonts/rails_admin/fontawesome-webfont.woff2 +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_background.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_hex.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_hsb_b.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_hsb_h.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_hsb_s.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_indic.gif +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_overlay.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_rgb_b.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_rgb_g.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_rgb_r.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_select.gif +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_submit.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_background.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_hex.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_hsb_b.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_hsb_h.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_hsb_s.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_indic.gif +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_rgb_b.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_rgb_g.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_rgb_r.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_submit.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/select.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/select2.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/slider.png +0 -0
- data/vendor/assets/javascripts/rails_admin/jquery.colorpicker.js +0 -484
- data/vendor/assets/stylesheets/rails_admin/jquery.colorpicker.scss +0 -182
@@ -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: strip_tags(value.to_s)}= 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,32 +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
|
-
def method_missing(method_name, *args, &block)
|
27
|
-
object.send(method_name, *args, &block)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
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!
|
@@ -1,68 +0,0 @@
|
|
1
|
-
require 'rails_admin/config/model'
|
2
|
-
|
3
|
-
module RailsAdmin
|
4
|
-
module Config
|
5
|
-
class LazyModel < BasicObject
|
6
|
-
def initialize(entity, &block)
|
7
|
-
@entity = entity
|
8
|
-
@deferred_blocks = [*block]
|
9
|
-
@existing_blocks = []
|
10
|
-
end
|
11
|
-
|
12
|
-
def add_deferred_block(&block)
|
13
|
-
@deferred_blocks << block
|
14
|
-
end
|
15
|
-
|
16
|
-
def target
|
17
|
-
@model ||= ::RailsAdmin::Config::Model.new(@entity)
|
18
|
-
# When evaluating multiple configuration blocks, the order of
|
19
|
-
# execution is important. As one would expect (in my opinion),
|
20
|
-
# options defined within a resource should take precedence over
|
21
|
-
# more general options defined in an initializer. This way,
|
22
|
-
# general settings for a number of resources could be specified
|
23
|
-
# in the initializer, while models could override these settings
|
24
|
-
# later, if required.
|
25
|
-
#
|
26
|
-
# CAVEAT: It cannot be guaranteed that blocks defined in an initializer
|
27
|
-
# will be loaded (and adde to @deferred_blocks) first. For instance, if
|
28
|
-
# the initializer references a model class before defining
|
29
|
-
# a RailsAdmin configuration block, the configuration from the
|
30
|
-
# resource will get added to @deferred_blocks first:
|
31
|
-
#
|
32
|
-
# # app/models/some_model.rb
|
33
|
-
# class SomeModel
|
34
|
-
# rails_admin do
|
35
|
-
# :
|
36
|
-
# end
|
37
|
-
# end
|
38
|
-
#
|
39
|
-
# # config/initializers/rails_admin.rb
|
40
|
-
# model = 'SomeModel'.constantize # blocks from SomeModel get loaded
|
41
|
-
# model.config model do # blocks from initializer gets loaded
|
42
|
-
# :
|
43
|
-
# end
|
44
|
-
#
|
45
|
-
# Thus, sort all blocks to excute for a resource by Proc.source_path,
|
46
|
-
# to guarantee that blocks from 'config/initializers' evaluate before
|
47
|
-
# blocks defined within a model class.
|
48
|
-
unless @deferred_blocks.empty?
|
49
|
-
@existing_blocks += @deferred_blocks
|
50
|
-
@existing_blocks.
|
51
|
-
partition { |block| block.source_location.first =~ %r{config\/initializers} }.
|
52
|
-
flatten.
|
53
|
-
each { |block| @model.instance_eval(&block) }
|
54
|
-
@deferred_blocks = []
|
55
|
-
end
|
56
|
-
@model
|
57
|
-
end
|
58
|
-
|
59
|
-
def method_missing(method_name, *args, &block)
|
60
|
-
target.send(method_name, *args, &block)
|
61
|
-
end
|
62
|
-
|
63
|
-
def respond_to?(method_name, include_private = false)
|
64
|
-
super || target.respond_to?(method_name, include_private)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
module RailsAdmin
|
2
|
-
module Extensions
|
3
|
-
module History
|
4
|
-
class AuditingAdapter
|
5
|
-
def initialize(controller, user_class = User)
|
6
|
-
@controller = controller
|
7
|
-
@user_class = user_class.to_s.constantize
|
8
|
-
require 'rails_admin/extensions/history/history'
|
9
|
-
end
|
10
|
-
|
11
|
-
def latest(count = 100)
|
12
|
-
::RailsAdmin::History.latest(count)
|
13
|
-
end
|
14
|
-
|
15
|
-
def delete_object(object, model, user)
|
16
|
-
::RailsAdmin::History.create_history_item('delete', object, model, user)
|
17
|
-
end
|
18
|
-
|
19
|
-
def update_object(object, model, user, changes)
|
20
|
-
::RailsAdmin::History.create_history_item(changes.collect { |k, v| "#{k}: #{v.collect(&:inspect).join(' -> ')}" }, object, model, user)
|
21
|
-
end
|
22
|
-
|
23
|
-
def create_object(object, model, user)
|
24
|
-
::RailsAdmin::History.create_history_item('new', object, model, user)
|
25
|
-
end
|
26
|
-
|
27
|
-
def listing_for_model(model, query, sort, sort_reverse, all, page, per_page = (RailsAdmin::Config.default_items_per_page || 20))
|
28
|
-
::RailsAdmin::History.history_for_model(model, query, sort, sort_reverse, all, page, per_page)
|
29
|
-
end
|
30
|
-
|
31
|
-
def listing_for_object(model, object, query, sort, sort_reverse, all, page, per_page = (RailsAdmin::Config.default_items_per_page || 20))
|
32
|
-
::RailsAdmin::History.history_for_object(model, object, query, sort, sort_reverse, all, page, per_page)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
module RailsAdmin
|
2
|
-
class History < ActiveRecord::Base
|
3
|
-
self.table_name = :rails_admin_histories
|
4
|
-
|
5
|
-
IGNORED_ATTRS = Set[:id, :created_at, :created_on, :deleted_at, :updated_at, :updated_on, :deleted_on]
|
6
|
-
|
7
|
-
if defined?(ActiveModel::MassAssignmentSecurity) && ancestors.include?(ActiveModel::MassAssignmentSecurity)
|
8
|
-
attr_accessible :message, :item, :table, :username
|
9
|
-
end
|
10
|
-
|
11
|
-
default_scope { order('id DESC') }
|
12
|
-
|
13
|
-
class << self
|
14
|
-
def latest(count = 100)
|
15
|
-
limit(count)
|
16
|
-
end
|
17
|
-
|
18
|
-
def create_history_item(message, object, abstract_model, user)
|
19
|
-
create(message: [message].flatten.join(', '),
|
20
|
-
item: object.id,
|
21
|
-
table: abstract_model.to_s,
|
22
|
-
username: user.try(:email))
|
23
|
-
end
|
24
|
-
|
25
|
-
def history_for_model(abstract_model, query, sort, sort_reverse, all, page, per_page = (RailsAdmin::Config.default_items_per_page || 20))
|
26
|
-
history = where(table: abstract_model.to_s)
|
27
|
-
history_for_model_or_object(history, abstract_model, query, sort, sort_reverse, all, page, per_page)
|
28
|
-
end
|
29
|
-
|
30
|
-
def history_for_object(abstract_model, object, query, sort, sort_reverse, all, page, per_page = (RailsAdmin::Config.default_items_per_page || 20))
|
31
|
-
history = where(table: abstract_model.to_s, item: object.id)
|
32
|
-
history_for_model_or_object(history, abstract_model, query, sort, sort_reverse, all, page, per_page)
|
33
|
-
end
|
34
|
-
|
35
|
-
protected
|
36
|
-
|
37
|
-
def history_for_model_or_object(history, _abstract_model, query, sort, sort_reverse, all, page, per_page)
|
38
|
-
history = history.where('message LIKE ? OR username LIKE ?', "%#{query}%", "%#{query}%") if query
|
39
|
-
history = history.order(sort_reverse == 'true' ? "#{sort} DESC" : sort) if sort
|
40
|
-
all ? history : history.send(Kaminari.config.page_method_name, page.presence || '1').per(per_page)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'i18n'
|
2
|
-
|
3
|
-
module RailsAdmin
|
4
|
-
module Support
|
5
|
-
module I18n
|
6
|
-
def abbr_day_names
|
7
|
-
::I18n.t('date.abbr_day_names', raise: true)
|
8
|
-
rescue ::I18n::ArgumentError
|
9
|
-
["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
|
10
|
-
end
|
11
|
-
|
12
|
-
def abbr_month_names
|
13
|
-
begin
|
14
|
-
names = ::I18n.t('date.abbr_month_names', raise: true)
|
15
|
-
rescue ::I18n::ArgumentError
|
16
|
-
names = [nil, "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
|
17
|
-
end
|
18
|
-
names[1..-1]
|
19
|
-
end
|
20
|
-
|
21
|
-
def date_format
|
22
|
-
::I18n.t('date.formats.default', raise: true)
|
23
|
-
rescue
|
24
|
-
"%Y-%m-%d"
|
25
|
-
end
|
26
|
-
|
27
|
-
def day_names
|
28
|
-
::I18n.t('date.day_names', raise: true)
|
29
|
-
rescue ::I18n::ArgumentError
|
30
|
-
["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
|
31
|
-
end
|
32
|
-
|
33
|
-
def month_names
|
34
|
-
begin
|
35
|
-
names = ::I18n.t('date.month_names', raise: true)
|
36
|
-
rescue ::I18n::ArgumentError
|
37
|
-
names = [nil, "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
|
38
|
-
end
|
39
|
-
names[1..-1]
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
Binary file
|
Binary file
|