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,8 +1,8 @@
|
|
1
1
|
/* ========================================================================
|
2
|
-
* Bootstrap: tab.js v3.
|
3
|
-
*
|
2
|
+
* Bootstrap: tab.js v3.4.1
|
3
|
+
* https://getbootstrap.com/docs/3.4/javascript/#tabs
|
4
4
|
* ========================================================================
|
5
|
-
* Copyright 2011-
|
5
|
+
* Copyright 2011-2019 Twitter, Inc.
|
6
6
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
7
7
|
* ======================================================================== */
|
8
8
|
|
@@ -14,10 +14,14 @@
|
|
14
14
|
// ====================
|
15
15
|
|
16
16
|
var Tab = function (element) {
|
17
|
+
// jscs:disable requireDollarBeforejQueryAssignment
|
17
18
|
this.element = $(element)
|
19
|
+
// jscs:enable requireDollarBeforejQueryAssignment
|
18
20
|
}
|
19
21
|
|
20
|
-
Tab.VERSION = '3.
|
22
|
+
Tab.VERSION = '3.4.1'
|
23
|
+
|
24
|
+
Tab.TRANSITION_DURATION = 150
|
21
25
|
|
22
26
|
Tab.prototype.show = function () {
|
23
27
|
var $this = this.element
|
@@ -31,22 +35,30 @@
|
|
31
35
|
|
32
36
|
if ($this.parent('li').hasClass('active')) return
|
33
37
|
|
34
|
-
var previous = $ul.find('.active:last a')
|
35
|
-
var
|
36
|
-
relatedTarget:
|
38
|
+
var $previous = $ul.find('.active:last a')
|
39
|
+
var hideEvent = $.Event('hide.bs.tab', {
|
40
|
+
relatedTarget: $this[0]
|
41
|
+
})
|
42
|
+
var showEvent = $.Event('show.bs.tab', {
|
43
|
+
relatedTarget: $previous[0]
|
37
44
|
})
|
38
45
|
|
39
|
-
$
|
46
|
+
$previous.trigger(hideEvent)
|
47
|
+
$this.trigger(showEvent)
|
40
48
|
|
41
|
-
if (
|
49
|
+
if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
|
42
50
|
|
43
|
-
var $target = $(selector)
|
51
|
+
var $target = $(document).find(selector)
|
44
52
|
|
45
53
|
this.activate($this.closest('li'), $ul)
|
46
54
|
this.activate($target, $target.parent(), function () {
|
55
|
+
$previous.trigger({
|
56
|
+
type: 'hidden.bs.tab',
|
57
|
+
relatedTarget: $this[0]
|
58
|
+
})
|
47
59
|
$this.trigger({
|
48
60
|
type: 'shown.bs.tab',
|
49
|
-
relatedTarget: previous
|
61
|
+
relatedTarget: $previous[0]
|
50
62
|
})
|
51
63
|
})
|
52
64
|
}
|
@@ -55,15 +67,21 @@
|
|
55
67
|
var $active = container.find('> .active')
|
56
68
|
var transition = callback
|
57
69
|
&& $.support.transition
|
58
|
-
&& $active.hasClass('fade')
|
70
|
+
&& ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)
|
59
71
|
|
60
72
|
function next() {
|
61
73
|
$active
|
62
74
|
.removeClass('active')
|
63
75
|
.find('> .dropdown-menu > .active')
|
64
76
|
.removeClass('active')
|
77
|
+
.end()
|
78
|
+
.find('[data-toggle="tab"]')
|
79
|
+
.attr('aria-expanded', false)
|
65
80
|
|
66
|
-
element
|
81
|
+
element
|
82
|
+
.addClass('active')
|
83
|
+
.find('[data-toggle="tab"]')
|
84
|
+
.attr('aria-expanded', true)
|
67
85
|
|
68
86
|
if (transition) {
|
69
87
|
element[0].offsetWidth // reflow for transition
|
@@ -72,17 +90,22 @@
|
|
72
90
|
element.removeClass('fade')
|
73
91
|
}
|
74
92
|
|
75
|
-
if (element.parent('.dropdown-menu')) {
|
76
|
-
element
|
93
|
+
if (element.parent('.dropdown-menu').length) {
|
94
|
+
element
|
95
|
+
.closest('li.dropdown')
|
96
|
+
.addClass('active')
|
97
|
+
.end()
|
98
|
+
.find('[data-toggle="tab"]')
|
99
|
+
.attr('aria-expanded', true)
|
77
100
|
}
|
78
101
|
|
79
102
|
callback && callback()
|
80
103
|
}
|
81
104
|
|
82
|
-
transition ?
|
105
|
+
$active.length && transition ?
|
83
106
|
$active
|
84
107
|
.one('bsTransitionEnd', next)
|
85
|
-
.emulateTransitionEnd(
|
108
|
+
.emulateTransitionEnd(Tab.TRANSITION_DURATION) :
|
86
109
|
next()
|
87
110
|
|
88
111
|
$active.removeClass('in')
|
@@ -120,9 +143,13 @@
|
|
120
143
|
// TAB DATA-API
|
121
144
|
// ============
|
122
145
|
|
123
|
-
|
146
|
+
var clickHandler = function (e) {
|
124
147
|
e.preventDefault()
|
125
148
|
Plugin.call($(this), 'show')
|
126
|
-
}
|
149
|
+
}
|
150
|
+
|
151
|
+
$(document)
|
152
|
+
.on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
|
153
|
+
.on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
|
127
154
|
|
128
155
|
}(jQuery);
|
@@ -1,31 +1,164 @@
|
|
1
1
|
/* ========================================================================
|
2
|
-
* Bootstrap: tooltip.js v3.
|
3
|
-
*
|
2
|
+
* Bootstrap: tooltip.js v3.4.1
|
3
|
+
* https://getbootstrap.com/docs/3.4/javascript/#tooltip
|
4
4
|
* Inspired by the original jQuery.tipsy by Jason Frame
|
5
5
|
* ========================================================================
|
6
|
-
* Copyright 2011-
|
6
|
+
* Copyright 2011-2019 Twitter, Inc.
|
7
7
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
8
8
|
* ======================================================================== */
|
9
9
|
|
10
|
-
|
11
10
|
+function ($) {
|
12
11
|
'use strict';
|
13
12
|
|
13
|
+
var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']
|
14
|
+
|
15
|
+
var uriAttrs = [
|
16
|
+
'background',
|
17
|
+
'cite',
|
18
|
+
'href',
|
19
|
+
'itemtype',
|
20
|
+
'longdesc',
|
21
|
+
'poster',
|
22
|
+
'src',
|
23
|
+
'xlink:href'
|
24
|
+
]
|
25
|
+
|
26
|
+
var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i
|
27
|
+
|
28
|
+
var DefaultWhitelist = {
|
29
|
+
// Global attributes allowed on any supplied element below.
|
30
|
+
'*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
|
31
|
+
a: ['target', 'href', 'title', 'rel'],
|
32
|
+
area: [],
|
33
|
+
b: [],
|
34
|
+
br: [],
|
35
|
+
col: [],
|
36
|
+
code: [],
|
37
|
+
div: [],
|
38
|
+
em: [],
|
39
|
+
hr: [],
|
40
|
+
h1: [],
|
41
|
+
h2: [],
|
42
|
+
h3: [],
|
43
|
+
h4: [],
|
44
|
+
h5: [],
|
45
|
+
h6: [],
|
46
|
+
i: [],
|
47
|
+
img: ['src', 'alt', 'title', 'width', 'height'],
|
48
|
+
li: [],
|
49
|
+
ol: [],
|
50
|
+
p: [],
|
51
|
+
pre: [],
|
52
|
+
s: [],
|
53
|
+
small: [],
|
54
|
+
span: [],
|
55
|
+
sub: [],
|
56
|
+
sup: [],
|
57
|
+
strong: [],
|
58
|
+
u: [],
|
59
|
+
ul: []
|
60
|
+
}
|
61
|
+
|
62
|
+
/**
|
63
|
+
* A pattern that recognizes a commonly useful subset of URLs that are safe.
|
64
|
+
*
|
65
|
+
* Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
|
66
|
+
*/
|
67
|
+
var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi
|
68
|
+
|
69
|
+
/**
|
70
|
+
* A pattern that matches safe data URLs. Only matches image, video and audio types.
|
71
|
+
*
|
72
|
+
* Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
|
73
|
+
*/
|
74
|
+
var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i
|
75
|
+
|
76
|
+
function allowedAttribute(attr, allowedAttributeList) {
|
77
|
+
var attrName = attr.nodeName.toLowerCase()
|
78
|
+
|
79
|
+
if ($.inArray(attrName, allowedAttributeList) !== -1) {
|
80
|
+
if ($.inArray(attrName, uriAttrs) !== -1) {
|
81
|
+
return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN))
|
82
|
+
}
|
83
|
+
|
84
|
+
return true
|
85
|
+
}
|
86
|
+
|
87
|
+
var regExp = $(allowedAttributeList).filter(function (index, value) {
|
88
|
+
return value instanceof RegExp
|
89
|
+
})
|
90
|
+
|
91
|
+
// Check if a regular expression validates the attribute.
|
92
|
+
for (var i = 0, l = regExp.length; i < l; i++) {
|
93
|
+
if (attrName.match(regExp[i])) {
|
94
|
+
return true
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
return false
|
99
|
+
}
|
100
|
+
|
101
|
+
function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
|
102
|
+
if (unsafeHtml.length === 0) {
|
103
|
+
return unsafeHtml
|
104
|
+
}
|
105
|
+
|
106
|
+
if (sanitizeFn && typeof sanitizeFn === 'function') {
|
107
|
+
return sanitizeFn(unsafeHtml)
|
108
|
+
}
|
109
|
+
|
110
|
+
// IE 8 and below don't support createHTMLDocument
|
111
|
+
if (!document.implementation || !document.implementation.createHTMLDocument) {
|
112
|
+
return unsafeHtml
|
113
|
+
}
|
114
|
+
|
115
|
+
var createdDocument = document.implementation.createHTMLDocument('sanitization')
|
116
|
+
createdDocument.body.innerHTML = unsafeHtml
|
117
|
+
|
118
|
+
var whitelistKeys = $.map(whiteList, function (el, i) { return i })
|
119
|
+
var elements = $(createdDocument.body).find('*')
|
120
|
+
|
121
|
+
for (var i = 0, len = elements.length; i < len; i++) {
|
122
|
+
var el = elements[i]
|
123
|
+
var elName = el.nodeName.toLowerCase()
|
124
|
+
|
125
|
+
if ($.inArray(elName, whitelistKeys) === -1) {
|
126
|
+
el.parentNode.removeChild(el)
|
127
|
+
|
128
|
+
continue
|
129
|
+
}
|
130
|
+
|
131
|
+
var attributeList = $.map(el.attributes, function (el) { return el })
|
132
|
+
var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || [])
|
133
|
+
|
134
|
+
for (var j = 0, len2 = attributeList.length; j < len2; j++) {
|
135
|
+
if (!allowedAttribute(attributeList[j], whitelistedAttributes)) {
|
136
|
+
el.removeAttribute(attributeList[j].nodeName)
|
137
|
+
}
|
138
|
+
}
|
139
|
+
}
|
140
|
+
|
141
|
+
return createdDocument.body.innerHTML
|
142
|
+
}
|
143
|
+
|
14
144
|
// TOOLTIP PUBLIC CLASS DEFINITION
|
15
145
|
// ===============================
|
16
146
|
|
17
147
|
var Tooltip = function (element, options) {
|
18
|
-
this.type =
|
19
|
-
this.options =
|
20
|
-
this.enabled =
|
21
|
-
this.timeout =
|
22
|
-
this.hoverState =
|
148
|
+
this.type = null
|
149
|
+
this.options = null
|
150
|
+
this.enabled = null
|
151
|
+
this.timeout = null
|
152
|
+
this.hoverState = null
|
23
153
|
this.$element = null
|
154
|
+
this.inState = null
|
24
155
|
|
25
156
|
this.init('tooltip', element, options)
|
26
157
|
}
|
27
158
|
|
28
|
-
Tooltip.VERSION = '3.
|
159
|
+
Tooltip.VERSION = '3.4.1'
|
160
|
+
|
161
|
+
Tooltip.TRANSITION_DURATION = 150
|
29
162
|
|
30
163
|
Tooltip.DEFAULTS = {
|
31
164
|
animation: true,
|
@@ -40,7 +173,10 @@
|
|
40
173
|
viewport: {
|
41
174
|
selector: 'body',
|
42
175
|
padding: 0
|
43
|
-
}
|
176
|
+
},
|
177
|
+
sanitize : true,
|
178
|
+
sanitizeFn : null,
|
179
|
+
whiteList : DefaultWhitelist
|
44
180
|
}
|
45
181
|
|
46
182
|
Tooltip.prototype.init = function (type, element, options) {
|
@@ -48,7 +184,12 @@
|
|
48
184
|
this.type = type
|
49
185
|
this.$element = $(element)
|
50
186
|
this.options = this.getOptions(options)
|
51
|
-
this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport)
|
187
|
+
this.$viewport = this.options.viewport && $(document).find($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
|
188
|
+
this.inState = { click: false, hover: false, focus: false }
|
189
|
+
|
190
|
+
if (this.$element[0] instanceof document.constructor && !this.options.selector) {
|
191
|
+
throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
|
192
|
+
}
|
52
193
|
|
53
194
|
var triggers = this.options.trigger.split(' ')
|
54
195
|
|
@@ -76,7 +217,15 @@
|
|
76
217
|
}
|
77
218
|
|
78
219
|
Tooltip.prototype.getOptions = function (options) {
|
79
|
-
|
220
|
+
var dataAttributes = this.$element.data()
|
221
|
+
|
222
|
+
for (var dataAttr in dataAttributes) {
|
223
|
+
if (dataAttributes.hasOwnProperty(dataAttr) && $.inArray(dataAttr, DISALLOWED_ATTRIBUTES) !== -1) {
|
224
|
+
delete dataAttributes[dataAttr]
|
225
|
+
}
|
226
|
+
}
|
227
|
+
|
228
|
+
options = $.extend({}, this.getDefaults(), dataAttributes, options)
|
80
229
|
|
81
230
|
if (options.delay && typeof options.delay == 'number') {
|
82
231
|
options.delay = {
|
@@ -85,6 +234,10 @@
|
|
85
234
|
}
|
86
235
|
}
|
87
236
|
|
237
|
+
if (options.sanitize) {
|
238
|
+
options.template = sanitizeHtml(options.template, options.whiteList, options.sanitizeFn)
|
239
|
+
}
|
240
|
+
|
88
241
|
return options
|
89
242
|
}
|
90
243
|
|
@@ -108,6 +261,15 @@
|
|
108
261
|
$(obj.currentTarget).data('bs.' + this.type, self)
|
109
262
|
}
|
110
263
|
|
264
|
+
if (obj instanceof $.Event) {
|
265
|
+
self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true
|
266
|
+
}
|
267
|
+
|
268
|
+
if (self.tip().hasClass('in') || self.hoverState == 'in') {
|
269
|
+
self.hoverState = 'in'
|
270
|
+
return
|
271
|
+
}
|
272
|
+
|
111
273
|
clearTimeout(self.timeout)
|
112
274
|
|
113
275
|
self.hoverState = 'in'
|
@@ -119,6 +281,14 @@
|
|
119
281
|
}, self.options.delay.show)
|
120
282
|
}
|
121
283
|
|
284
|
+
Tooltip.prototype.isInStateTrue = function () {
|
285
|
+
for (var key in this.inState) {
|
286
|
+
if (this.inState[key]) return true
|
287
|
+
}
|
288
|
+
|
289
|
+
return false
|
290
|
+
}
|
291
|
+
|
122
292
|
Tooltip.prototype.leave = function (obj) {
|
123
293
|
var self = obj instanceof this.constructor ?
|
124
294
|
obj : $(obj.currentTarget).data('bs.' + this.type)
|
@@ -128,6 +298,12 @@
|
|
128
298
|
$(obj.currentTarget).data('bs.' + this.type, self)
|
129
299
|
}
|
130
300
|
|
301
|
+
if (obj instanceof $.Event) {
|
302
|
+
self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false
|
303
|
+
}
|
304
|
+
|
305
|
+
if (self.isInStateTrue()) return
|
306
|
+
|
131
307
|
clearTimeout(self.timeout)
|
132
308
|
|
133
309
|
self.hoverState = 'out'
|
@@ -145,7 +321,7 @@
|
|
145
321
|
if (this.hasContent() && this.enabled) {
|
146
322
|
this.$element.trigger(e)
|
147
323
|
|
148
|
-
var inDom = $.contains(
|
324
|
+
var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
|
149
325
|
if (e.isDefaultPrevented() || !inDom) return
|
150
326
|
var that = this
|
151
327
|
|
@@ -173,7 +349,8 @@
|
|
173
349
|
.addClass(placement)
|
174
350
|
.data('bs.' + this.type, this)
|
175
351
|
|
176
|
-
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
|
352
|
+
this.options.container ? $tip.appendTo($(document).find(this.options.container)) : $tip.insertAfter(this.$element)
|
353
|
+
this.$element.trigger('inserted.bs.' + this.type)
|
177
354
|
|
178
355
|
var pos = this.getPosition()
|
179
356
|
var actualWidth = $tip[0].offsetWidth
|
@@ -181,13 +358,12 @@
|
|
181
358
|
|
182
359
|
if (autoPlace) {
|
183
360
|
var orgPlacement = placement
|
184
|
-
var
|
185
|
-
var parentDim = this.getPosition($parent)
|
361
|
+
var viewportDim = this.getPosition(this.$viewport)
|
186
362
|
|
187
|
-
placement = placement == 'bottom' && pos.
|
188
|
-
placement == 'top' && pos.top
|
189
|
-
placement == 'right' && pos.right
|
190
|
-
placement == 'left' && pos.left
|
363
|
+
placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' :
|
364
|
+
placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' :
|
365
|
+
placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' :
|
366
|
+
placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' :
|
191
367
|
placement
|
192
368
|
|
193
369
|
$tip
|
@@ -200,14 +376,17 @@
|
|
200
376
|
this.applyPlacement(calculatedOffset, placement)
|
201
377
|
|
202
378
|
var complete = function () {
|
379
|
+
var prevHoverState = that.hoverState
|
203
380
|
that.$element.trigger('shown.bs.' + that.type)
|
204
381
|
that.hoverState = null
|
382
|
+
|
383
|
+
if (prevHoverState == 'out') that.leave(that)
|
205
384
|
}
|
206
385
|
|
207
386
|
$.support.transition && this.$tip.hasClass('fade') ?
|
208
387
|
$tip
|
209
388
|
.one('bsTransitionEnd', complete)
|
210
|
-
.emulateTransitionEnd(
|
389
|
+
.emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
|
211
390
|
complete()
|
212
391
|
}
|
213
392
|
}
|
@@ -225,8 +404,8 @@
|
|
225
404
|
if (isNaN(marginTop)) marginTop = 0
|
226
405
|
if (isNaN(marginLeft)) marginLeft = 0
|
227
406
|
|
228
|
-
offset.top
|
229
|
-
offset.left
|
407
|
+
offset.top += marginTop
|
408
|
+
offset.left += marginLeft
|
230
409
|
|
231
410
|
// $.fn.offset doesn't round pixel values
|
232
411
|
// so we use setOffset directly with our own function B-0
|
@@ -254,36 +433,50 @@
|
|
254
433
|
if (delta.left) offset.left += delta.left
|
255
434
|
else offset.top += delta.top
|
256
435
|
|
257
|
-
var
|
258
|
-
var
|
259
|
-
var arrowOffsetPosition =
|
436
|
+
var isVertical = /top|bottom/.test(placement)
|
437
|
+
var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
|
438
|
+
var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'
|
260
439
|
|
261
440
|
$tip.offset(offset)
|
262
|
-
this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition],
|
441
|
+
this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
|
263
442
|
}
|
264
443
|
|
265
|
-
Tooltip.prototype.replaceArrow = function (delta, dimension,
|
266
|
-
this.arrow()
|
444
|
+
Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {
|
445
|
+
this.arrow()
|
446
|
+
.css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
|
447
|
+
.css(isVertical ? 'top' : 'left', '')
|
267
448
|
}
|
268
449
|
|
269
450
|
Tooltip.prototype.setContent = function () {
|
270
451
|
var $tip = this.tip()
|
271
452
|
var title = this.getTitle()
|
272
453
|
|
273
|
-
|
454
|
+
if (this.options.html) {
|
455
|
+
if (this.options.sanitize) {
|
456
|
+
title = sanitizeHtml(title, this.options.whiteList, this.options.sanitizeFn)
|
457
|
+
}
|
458
|
+
|
459
|
+
$tip.find('.tooltip-inner').html(title)
|
460
|
+
} else {
|
461
|
+
$tip.find('.tooltip-inner').text(title)
|
462
|
+
}
|
463
|
+
|
274
464
|
$tip.removeClass('fade in top bottom left right')
|
275
465
|
}
|
276
466
|
|
277
|
-
Tooltip.prototype.hide = function () {
|
467
|
+
Tooltip.prototype.hide = function (callback) {
|
278
468
|
var that = this
|
279
|
-
var $tip = this
|
469
|
+
var $tip = $(this.$tip)
|
280
470
|
var e = $.Event('hide.bs.' + this.type)
|
281
471
|
|
282
|
-
this.$element.removeAttr('aria-describedby')
|
283
|
-
|
284
472
|
function complete() {
|
285
473
|
if (that.hoverState != 'in') $tip.detach()
|
286
|
-
that.$element
|
474
|
+
if (that.$element) { // TODO: Check whether guarding this code with this `if` is really necessary.
|
475
|
+
that.$element
|
476
|
+
.removeAttr('aria-describedby')
|
477
|
+
.trigger('hidden.bs.' + that.type)
|
478
|
+
}
|
479
|
+
callback && callback()
|
287
480
|
}
|
288
481
|
|
289
482
|
this.$element.trigger(e)
|
@@ -292,10 +485,10 @@
|
|
292
485
|
|
293
486
|
$tip.removeClass('in')
|
294
487
|
|
295
|
-
$.support.transition &&
|
488
|
+
$.support.transition && $tip.hasClass('fade') ?
|
296
489
|
$tip
|
297
490
|
.one('bsTransitionEnd', complete)
|
298
|
-
.emulateTransitionEnd(
|
491
|
+
.emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
|
299
492
|
complete()
|
300
493
|
|
301
494
|
this.hoverState = null
|
@@ -305,7 +498,7 @@
|
|
305
498
|
|
306
499
|
Tooltip.prototype.fixTitle = function () {
|
307
500
|
var $e = this.$element
|
308
|
-
if ($e.attr('title') || typeof
|
501
|
+
if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {
|
309
502
|
$e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
|
310
503
|
}
|
311
504
|
}
|
@@ -316,20 +509,30 @@
|
|
316
509
|
|
317
510
|
Tooltip.prototype.getPosition = function ($element) {
|
318
511
|
$element = $element || this.$element
|
512
|
+
|
319
513
|
var el = $element[0]
|
320
514
|
var isBody = el.tagName == 'BODY'
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
515
|
+
|
516
|
+
var elRect = el.getBoundingClientRect()
|
517
|
+
if (elRect.width == null) {
|
518
|
+
// width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
|
519
|
+
elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
|
520
|
+
}
|
521
|
+
var isSvg = window.SVGElement && el instanceof window.SVGElement
|
522
|
+
// Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3.
|
523
|
+
// See https://github.com/twbs/bootstrap/issues/20280
|
524
|
+
var elOffset = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset())
|
525
|
+
var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
|
526
|
+
var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
|
527
|
+
|
528
|
+
return $.extend({}, elRect, scroll, outerDims, elOffset)
|
326
529
|
}
|
327
530
|
|
328
531
|
Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
|
329
|
-
return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2
|
330
|
-
placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2
|
532
|
+
return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
|
533
|
+
placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
|
331
534
|
placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
|
332
|
-
/* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width
|
535
|
+
/* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
|
333
536
|
|
334
537
|
}
|
335
538
|
|
@@ -353,7 +556,7 @@
|
|
353
556
|
var rightEdgeOffset = pos.left + viewportPadding + actualWidth
|
354
557
|
if (leftEdgeOffset < viewportDimensions.left) { // left overflow
|
355
558
|
delta.left = viewportDimensions.left - leftEdgeOffset
|
356
|
-
} else if (rightEdgeOffset > viewportDimensions.
|
559
|
+
} else if (rightEdgeOffset > viewportDimensions.right) { // right overflow
|
357
560
|
delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
|
358
561
|
}
|
359
562
|
}
|
@@ -379,21 +582,19 @@
|
|
379
582
|
}
|
380
583
|
|
381
584
|
Tooltip.prototype.tip = function () {
|
382
|
-
|
585
|
+
if (!this.$tip) {
|
586
|
+
this.$tip = $(this.options.template)
|
587
|
+
if (this.$tip.length != 1) {
|
588
|
+
throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')
|
589
|
+
}
|
590
|
+
}
|
591
|
+
return this.$tip
|
383
592
|
}
|
384
593
|
|
385
594
|
Tooltip.prototype.arrow = function () {
|
386
595
|
return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
|
387
596
|
}
|
388
597
|
|
389
|
-
Tooltip.prototype.validate = function () {
|
390
|
-
if (!this.$element[0].parentNode) {
|
391
|
-
this.hide()
|
392
|
-
this.$element = null
|
393
|
-
this.options = null
|
394
|
-
}
|
395
|
-
}
|
396
|
-
|
397
598
|
Tooltip.prototype.enable = function () {
|
398
599
|
this.enabled = true
|
399
600
|
}
|
@@ -416,14 +617,33 @@
|
|
416
617
|
}
|
417
618
|
}
|
418
619
|
|
419
|
-
|
620
|
+
if (e) {
|
621
|
+
self.inState.click = !self.inState.click
|
622
|
+
if (self.isInStateTrue()) self.enter(self)
|
623
|
+
else self.leave(self)
|
624
|
+
} else {
|
625
|
+
self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
|
626
|
+
}
|
420
627
|
}
|
421
628
|
|
422
629
|
Tooltip.prototype.destroy = function () {
|
630
|
+
var that = this
|
423
631
|
clearTimeout(this.timeout)
|
424
|
-
this.hide(
|
632
|
+
this.hide(function () {
|
633
|
+
that.$element.off('.' + that.type).removeData('bs.' + that.type)
|
634
|
+
if (that.$tip) {
|
635
|
+
that.$tip.detach()
|
636
|
+
}
|
637
|
+
that.$tip = null
|
638
|
+
that.$arrow = null
|
639
|
+
that.$viewport = null
|
640
|
+
that.$element = null
|
641
|
+
})
|
425
642
|
}
|
426
643
|
|
644
|
+
Tooltip.prototype.sanitizeHtml = function (unsafeHtml) {
|
645
|
+
return sanitizeHtml(unsafeHtml, this.options.whiteList, this.options.sanitizeFn)
|
646
|
+
}
|
427
647
|
|
428
648
|
// TOOLTIP PLUGIN DEFINITION
|
429
649
|
// =========================
|
@@ -434,7 +654,7 @@
|
|
434
654
|
var data = $this.data('bs.tooltip')
|
435
655
|
var options = typeof option == 'object' && option
|
436
656
|
|
437
|
-
if (!data && option
|
657
|
+
if (!data && /destroy|hide/.test(option)) return
|
438
658
|
if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
|
439
659
|
if (typeof option == 'string') data[option]()
|
440
660
|
})
|