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.

Files changed (343) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +9 -11
  3. data/README.md +37 -31
  4. data/Rakefile +2 -2
  5. data/app/assets/javascripts/rails_admin.js +21 -0
  6. data/app/assets/stylesheets/rails_admin/custom/mixins.scss +1 -1
  7. data/app/assets/stylesheets/rails_admin/custom/variables.scss +1 -1
  8. data/app/assets/stylesheets/rails_admin.scss.erb +76 -0
  9. data/app/controllers/rails_admin/application_controller.rb +4 -3
  10. data/app/controllers/rails_admin/main_controller.rb +43 -24
  11. data/app/helpers/rails_admin/application_helper.rb +69 -52
  12. data/app/helpers/rails_admin/form_builder.rb +7 -4
  13. data/app/helpers/rails_admin/main_helper.rb +27 -43
  14. data/app/views/kaminari/ra-twitter-bootstrap/_gap.html.erb +5 -0
  15. data/app/views/kaminari/ra-twitter-bootstrap/_next_page.html.erb +9 -0
  16. data/app/views/kaminari/ra-twitter-bootstrap/_page.html.erb +9 -0
  17. data/app/views/kaminari/ra-twitter-bootstrap/_paginator.html.erb +13 -0
  18. data/app/views/kaminari/ra-twitter-bootstrap/_prev_page.html.erb +9 -0
  19. data/app/views/kaminari/ra-twitter-bootstrap/without_count/_next_page.html.erb +9 -0
  20. data/app/views/kaminari/ra-twitter-bootstrap/without_count/_paginator.html.erb +6 -0
  21. data/app/views/kaminari/ra-twitter-bootstrap/without_count/_prev_page.html.erb +9 -0
  22. data/app/views/layouts/rails_admin/_head.html.erb +17 -0
  23. data/app/views/layouts/rails_admin/_navigation.html.erb +21 -0
  24. data/app/views/layouts/rails_admin/_secondary_navigation.html.erb +24 -0
  25. data/app/views/layouts/rails_admin/_sidebar_navigation.html.erb +9 -0
  26. data/app/views/layouts/rails_admin/application.html.erb +27 -0
  27. data/app/views/layouts/rails_admin/modal.js.erb +7 -0
  28. data/app/views/layouts/rails_admin/pjax.html.erb +20 -0
  29. data/app/views/rails_admin/main/_dashboard_history.html.erb +45 -0
  30. data/app/views/rails_admin/main/_delete_notice.html.erb +35 -0
  31. data/app/views/rails_admin/main/_form_action_text.html.erb +7 -0
  32. data/app/views/rails_admin/main/_form_boolean.html.erb +16 -0
  33. data/app/views/rails_admin/main/{_form_ck_editor.html.haml → _form_ck_editor.html.erb} +3 -3
  34. data/app/views/rails_admin/main/_form_code_mirror.html.erb +9 -0
  35. data/app/views/rails_admin/main/_form_colorpicker.html.erb +1 -0
  36. data/app/views/rails_admin/main/_form_datetime.html.erb +9 -0
  37. data/app/views/rails_admin/main/_form_enumeration.html.erb +21 -0
  38. data/app/views/rails_admin/main/_form_field.html.erb +1 -0
  39. data/app/views/rails_admin/main/_form_file_upload.html.erb +17 -0
  40. data/app/views/rails_admin/main/{_form_filtering_multiselect.html.haml → _form_filtering_multiselect.html.erb} +11 -11
  41. data/app/views/rails_admin/main/{_form_filtering_select.html.haml → _form_filtering_select.html.erb} +13 -12
  42. data/app/views/rails_admin/main/_form_froala.html.erb +8 -0
  43. data/app/views/rails_admin/main/_form_multiple_file_upload.html.erb +20 -0
  44. data/app/views/rails_admin/main/_form_nested_many.html.erb +21 -0
  45. data/app/views/rails_admin/main/_form_nested_one.html.erb +21 -0
  46. data/app/views/rails_admin/main/_form_polymorphic_association.html.erb +27 -0
  47. data/app/views/rails_admin/main/_form_simple_mde.html.erb +8 -0
  48. data/app/views/rails_admin/main/_form_text.html.erb +1 -0
  49. data/app/views/rails_admin/main/_form_wysihtml5.html.erb +8 -0
  50. data/app/views/rails_admin/main/_submit_buttons.html.erb +25 -0
  51. data/app/views/rails_admin/main/bulk_delete.html.erb +19 -0
  52. data/app/views/rails_admin/main/dashboard.html.erb +64 -0
  53. data/app/views/rails_admin/main/delete.html.erb +21 -0
  54. data/app/views/rails_admin/main/edit.html.erb +3 -0
  55. data/app/views/rails_admin/main/export.html.erb +146 -0
  56. data/app/views/rails_admin/main/history.html.erb +78 -0
  57. data/app/views/rails_admin/main/index.html.erb +193 -0
  58. data/app/views/rails_admin/main/new.html.erb +3 -0
  59. data/app/views/rails_admin/main/show.html.erb +28 -0
  60. data/config/initializers/active_record_extensions.rb +3 -1
  61. data/config/initializers/mongoid_extensions.rb +1 -1
  62. data/config/locales/rails_admin.en.yml +6 -1
  63. data/lib/generators/rails_admin/install_generator.rb +51 -3
  64. data/lib/generators/rails_admin/templates/environment.js +6 -0
  65. data/lib/generators/rails_admin/templates/initializer.erb +2 -1
  66. data/lib/generators/rails_admin/templates/rails_admin.js.erb +2 -0
  67. data/lib/generators/rails_admin/templates/rails_admin.scss +1 -0
  68. data/lib/generators/rails_admin/templates/webpack.config.js +32 -0
  69. data/lib/rails_admin/abstract_model.rb +24 -10
  70. data/lib/rails_admin/adapters/active_record/association.rb +20 -1
  71. data/lib/rails_admin/adapters/active_record/object_extension.rb +29 -0
  72. data/lib/rails_admin/adapters/active_record/property.rb +1 -1
  73. data/lib/rails_admin/adapters/active_record.rb +27 -23
  74. data/lib/rails_admin/adapters/mongoid/association.rb +38 -9
  75. data/lib/rails_admin/adapters/mongoid/bson.rb +4 -5
  76. data/lib/rails_admin/adapters/mongoid/extension.rb +3 -1
  77. data/lib/rails_admin/adapters/mongoid/object_extension.rb +32 -0
  78. data/lib/rails_admin/adapters/mongoid/property.rb +2 -2
  79. data/lib/rails_admin/adapters/mongoid.rb +27 -19
  80. data/lib/rails_admin/config/actions/base.rb +7 -2
  81. data/lib/rails_admin/config/actions/bulk_delete.rb +2 -2
  82. data/lib/rails_admin/config/actions/dashboard.rb +4 -3
  83. data/lib/rails_admin/config/actions/delete.rb +5 -9
  84. data/lib/rails_admin/config/actions/edit.rb +7 -7
  85. data/lib/rails_admin/config/actions/export.rb +2 -2
  86. data/lib/rails_admin/config/actions/history_index.rb +2 -2
  87. data/lib/rails_admin/config/actions/history_show.rb +2 -2
  88. data/lib/rails_admin/config/actions/index.rb +5 -7
  89. data/lib/rails_admin/config/actions/new.rb +9 -9
  90. data/lib/rails_admin/config/actions/show.rb +1 -1
  91. data/lib/rails_admin/config/actions/show_in_app.rb +6 -2
  92. data/lib/rails_admin/config/actions.rb +4 -4
  93. data/lib/rails_admin/config/configurable.rb +2 -2
  94. data/lib/rails_admin/config/fields/association.rb +15 -12
  95. data/lib/rails_admin/config/fields/base.rb +44 -24
  96. data/lib/rails_admin/config/fields/factories/active_storage.rb +1 -0
  97. data/lib/rails_admin/config/fields/factories/association.rb +6 -8
  98. data/lib/rails_admin/config/fields/factories/carrierwave.rb +2 -1
  99. data/lib/rails_admin/config/fields/factories/devise.rb +2 -1
  100. data/lib/rails_admin/config/fields/factories/dragonfly.rb +2 -1
  101. data/lib/rails_admin/config/fields/factories/paperclip.rb +2 -1
  102. data/lib/rails_admin/config/fields/factories/shrine.rb +1 -1
  103. data/lib/rails_admin/config/fields/group.rb +1 -2
  104. data/lib/rails_admin/config/fields/types/active_record_enum.rb +2 -0
  105. data/lib/rails_admin/config/fields/types/active_storage.rb +9 -7
  106. data/lib/rails_admin/config/fields/types/all.rb +1 -0
  107. data/lib/rails_admin/config/fields/types/belongs_to_association.rb +4 -12
  108. data/lib/rails_admin/config/fields/types/boolean.rb +32 -8
  109. data/lib/rails_admin/config/fields/types/carrierwave.rb +1 -0
  110. data/lib/rails_admin/config/fields/types/citext.rb +13 -0
  111. data/lib/rails_admin/config/fields/types/color.rb +6 -2
  112. data/lib/rails_admin/config/fields/types/date.rb +5 -8
  113. data/lib/rails_admin/config/fields/types/datetime.rb +18 -21
  114. data/lib/rails_admin/config/fields/types/decimal.rb +9 -2
  115. data/lib/rails_admin/config/fields/types/dragonfly.rb +3 -1
  116. data/lib/rails_admin/config/fields/types/enum.rb +1 -1
  117. data/lib/rails_admin/config/fields/types/file_upload.rb +4 -3
  118. data/lib/rails_admin/config/fields/types/float.rb +9 -2
  119. data/lib/rails_admin/config/fields/types/has_many_association.rb +1 -5
  120. data/lib/rails_admin/config/fields/types/has_one_association.rb +1 -13
  121. data/lib/rails_admin/config/fields/types/integer.rb +2 -6
  122. data/lib/rails_admin/config/fields/types/multiple_active_storage.rb +8 -6
  123. data/lib/rails_admin/config/fields/types/multiple_carrierwave.rb +1 -0
  124. data/lib/rails_admin/config/fields/types/multiple_file_upload.rb +4 -3
  125. data/lib/rails_admin/config/fields/types/numeric.rb +18 -0
  126. data/lib/rails_admin/config/fields/types/polymorphic_association.rb +3 -2
  127. data/lib/rails_admin/config/fields/types/string.rb +1 -1
  128. data/lib/rails_admin/config/fields/types/time.rb +1 -4
  129. data/lib/rails_admin/config/fields/types/timestamp.rb +0 -4
  130. data/lib/rails_admin/config/fields/types.rb +1 -1
  131. data/lib/rails_admin/config/fields.rb +3 -1
  132. data/lib/rails_admin/config/has_fields.rb +5 -6
  133. data/lib/rails_admin/config/hideable.rb +1 -1
  134. data/lib/rails_admin/config/inspectable.rb +1 -3
  135. data/lib/rails_admin/config/model.rb +10 -10
  136. data/lib/rails_admin/config/sections/base.rb +2 -3
  137. data/lib/rails_admin/config/sections/list.rb +4 -15
  138. data/lib/rails_admin/config/sections.rb +1 -1
  139. data/lib/rails_admin/config.rb +73 -38
  140. data/lib/rails_admin/engine.rb +36 -23
  141. data/lib/rails_admin/extension.rb +6 -14
  142. data/lib/rails_admin/extensions/cancancan/authorization_adapter.rb +4 -2
  143. data/lib/rails_admin/extensions/paper_trail/auditing_adapter.rb +13 -8
  144. data/lib/rails_admin/extensions/pundit/authorization_adapter.rb +6 -7
  145. data/lib/rails_admin/support/csv_converter.rb +12 -13
  146. data/lib/rails_admin/support/datetime.rb +40 -74
  147. data/lib/rails_admin/support/esmodule_preprocessor.rb +32 -0
  148. data/lib/rails_admin/support/hash_helper.rb +6 -5
  149. data/lib/rails_admin/version.rb +7 -3
  150. data/lib/rails_admin.rb +1 -4
  151. data/lib/tasks/rails_admin.rake +3 -3
  152. data/package.json +28 -0
  153. data/src/rails_admin/base.js +21 -0
  154. data/src/rails_admin/filter-box.js +405 -0
  155. data/src/rails_admin/filtering-multiselect.js +394 -0
  156. data/src/rails_admin/filtering-select.js +302 -0
  157. data/src/rails_admin/i18n.js +19 -0
  158. data/src/rails_admin/nested-form-hooks.js +100 -0
  159. data/src/rails_admin/remote-form.js +190 -0
  160. data/src/rails_admin/sidescroll.js +20 -0
  161. data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/base/README.txt +0 -0
  162. data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/base/mixins.scss +0 -0
  163. data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/base/theming.scss +93 -34
  164. data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/base/variables.scss +0 -0
  165. data/src/rails_admin/styles/base.scss +64 -0
  166. data/src/rails_admin/styles/filtering-multiselect.scss +53 -0
  167. data/src/rails_admin/styles/filtering-select.scss +70 -0
  168. data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/cerulean/mixins.scss +0 -0
  169. data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/cerulean/theming.scss +23 -21
  170. data/src/rails_admin/styles/themes/cerulean/variables.scss +830 -0
  171. data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/default/mixins.scss +1 -1
  172. data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/default/theming.scss +0 -0
  173. data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/default/variables.scss +1 -1
  174. data/src/rails_admin/styles/widgets.scss +35 -0
  175. data/src/rails_admin/ui.js +172 -0
  176. data/src/rails_admin/vendor/jquery.pjax.js +899 -0
  177. data/src/rails_admin/vendor/jquery_nested_form.js +122 -0
  178. data/src/rails_admin/widgets.js +512 -0
  179. data/vendor/assets/fonts/rails_admin/fa-solid-900.eot +0 -0
  180. data/vendor/assets/fonts/rails_admin/fa-solid-900.svg +5034 -0
  181. data/vendor/assets/fonts/rails_admin/fa-solid-900.ttf +0 -0
  182. data/vendor/assets/fonts/rails_admin/fa-solid-900.woff +0 -0
  183. data/vendor/assets/fonts/rails_admin/fa-solid-900.woff2 +0 -0
  184. data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-affix.js +50 -28
  185. data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-alert.js +10 -7
  186. data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-button.js +35 -20
  187. data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-carousel.js +48 -25
  188. data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-collapse.js +70 -28
  189. data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-dropdown.js +56 -42
  190. data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-modal.js +118 -40
  191. data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-popover.js +26 -16
  192. data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-scrollspy.js +29 -27
  193. data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-tab.js +46 -19
  194. data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-tooltip.js +280 -60
  195. data/vendor/assets/javascripts/rails_admin/bootstrap/bootstrap-transition.js +5 -5
  196. data/vendor/assets/javascripts/rails_admin/bootstrap-datetimepicker.js +317 -150
  197. data/vendor/assets/javascripts/rails_admin/jquery-ui/data.js +41 -0
  198. data/vendor/assets/javascripts/rails_admin/jquery-ui/effect.js +1637 -0
  199. data/vendor/assets/javascripts/rails_admin/jquery-ui/ie.js +17 -0
  200. data/vendor/assets/javascripts/rails_admin/jquery-ui/keycode.js +47 -0
  201. data/vendor/assets/javascripts/rails_admin/jquery-ui/position.js +500 -0
  202. data/vendor/assets/javascripts/rails_admin/jquery-ui/safe-active-element.js +42 -0
  203. data/vendor/assets/javascripts/rails_admin/jquery-ui/scroll-parent.js +47 -0
  204. data/vendor/assets/javascripts/rails_admin/jquery-ui/unique-id.js +51 -0
  205. data/vendor/assets/javascripts/rails_admin/jquery-ui/version.js +17 -0
  206. data/vendor/assets/javascripts/rails_admin/jquery-ui/widget.js +735 -0
  207. data/vendor/assets/javascripts/rails_admin/jquery-ui/widgets/autocomplete.js +689 -0
  208. data/vendor/assets/javascripts/rails_admin/jquery-ui/widgets/menu.js +680 -0
  209. data/vendor/assets/javascripts/rails_admin/jquery-ui/widgets/mouse.js +230 -0
  210. data/vendor/assets/javascripts/rails_admin/jquery-ui/widgets/sortable.js +1561 -0
  211. data/vendor/assets/javascripts/rails_admin/jquery.pjax.js +317 -160
  212. data/vendor/assets/javascripts/rails_admin/jquery3.js +10872 -0
  213. data/vendor/assets/javascripts/rails_admin/moment-with-locales.js +11210 -9290
  214. data/vendor/assets/stylesheets/rails_admin/font-awesome.scss +4476 -2216
  215. metadata +118 -262
  216. data/app/assets/images/rails_admin/aristo/images/bg_fallback.png +0 -0
  217. data/app/assets/images/rails_admin/aristo/images/icon_sprite.png +0 -0
  218. data/app/assets/images/rails_admin/aristo/images/progress_bar.gif +0 -0
  219. data/app/assets/images/rails_admin/aristo/images/slider_handles.png +0 -0
  220. data/app/assets/images/rails_admin/aristo/images/ui-icons_222222_256x240.png +0 -0
  221. data/app/assets/images/rails_admin/aristo/images/ui-icons_454545_256x240.png +0 -0
  222. data/app/assets/images/rails_admin/bullet_black.png +0 -0
  223. data/app/assets/images/rails_admin/bullet_white.png +0 -0
  224. data/app/assets/images/rails_admin/calendar.png +0 -0
  225. data/app/assets/images/rails_admin/clock.png +0 -0
  226. data/app/assets/images/rails_admin/logo.png +0 -0
  227. data/app/assets/images/rails_admin/magnifier.png +0 -0
  228. data/app/assets/images/rails_admin/multiselect/icon_sprite.png +0 -0
  229. data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-n-dark.png +0 -0
  230. data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-n-light.png +0 -0
  231. data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-s-dark.png +0 -0
  232. data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-s-light.png +0 -0
  233. data/app/assets/javascripts/rails_admin/jquery-ui.js.erb +0 -8
  234. data/app/assets/javascripts/rails_admin/ra.filter-box.js +0 -248
  235. data/app/assets/javascripts/rails_admin/ra.filtering-multiselect.js +0 -331
  236. data/app/assets/javascripts/rails_admin/ra.filtering-select.js +0 -294
  237. data/app/assets/javascripts/rails_admin/ra.i18n.js +0 -28
  238. data/app/assets/javascripts/rails_admin/ra.nested-form-hooks.js +0 -59
  239. data/app/assets/javascripts/rails_admin/ra.remote-form.js +0 -155
  240. data/app/assets/javascripts/rails_admin/ra.sidescroll.js +0 -31
  241. data/app/assets/javascripts/rails_admin/ra.widgets.js +0 -379
  242. data/app/assets/javascripts/rails_admin/rails_admin.js +0 -20
  243. data/app/assets/javascripts/rails_admin/ui.js +0 -135
  244. data/app/assets/stylesheets/rails_admin/aristo/images/bg_fallback.png +0 -0
  245. data/app/assets/stylesheets/rails_admin/aristo/images/icon_sprite.png +0 -0
  246. data/app/assets/stylesheets/rails_admin/aristo/images/progress_bar.gif +0 -0
  247. data/app/assets/stylesheets/rails_admin/aristo/images/slider_handles.png +0 -0
  248. data/app/assets/stylesheets/rails_admin/aristo/images/ui-icons_222222_256x240.png +0 -0
  249. data/app/assets/stylesheets/rails_admin/aristo/images/ui-icons_454545_256x240.png +0 -0
  250. data/app/assets/stylesheets/rails_admin/aristo/jquery-ui-1.8.7.custom.scss +0 -733
  251. data/app/assets/stylesheets/rails_admin/base/font-awesome-4-compability.scss +0 -153
  252. data/app/assets/stylesheets/rails_admin/ra.filtering-multiselect.scss +0 -88
  253. data/app/assets/stylesheets/rails_admin/ra.sidescroll.scss +0 -29
  254. data/app/assets/stylesheets/rails_admin/ra.widgets.scss +0 -17
  255. data/app/assets/stylesheets/rails_admin/rails_admin.scss.erb +0 -110
  256. data/app/assets/stylesheets/rails_admin/themes/cerulean/variables.scss +0 -857
  257. data/app/views/kaminari/ra-twitter-bootstrap/_gap.html.haml +0 -2
  258. data/app/views/kaminari/ra-twitter-bootstrap/_next_page.html.haml +0 -4
  259. data/app/views/kaminari/ra-twitter-bootstrap/_page.html.haml +0 -4
  260. data/app/views/kaminari/ra-twitter-bootstrap/_paginator.html.haml +0 -9
  261. data/app/views/kaminari/ra-twitter-bootstrap/_prev_page.html.haml +0 -4
  262. data/app/views/kaminari/ra-twitter-bootstrap/without_count/_next_page.html.haml +0 -4
  263. data/app/views/kaminari/ra-twitter-bootstrap/without_count/_paginator.html.haml +0 -4
  264. data/app/views/kaminari/ra-twitter-bootstrap/without_count/_prev_page.html.haml +0 -4
  265. data/app/views/layouts/rails_admin/_head.html.haml +0 -7
  266. data/app/views/layouts/rails_admin/_navigation.html.haml +0 -12
  267. data/app/views/layouts/rails_admin/_secondary_navigation.html.haml +0 -10
  268. data/app/views/layouts/rails_admin/_sidebar_navigation.html.haml +0 -3
  269. data/app/views/layouts/rails_admin/application.html.haml +0 -16
  270. data/app/views/layouts/rails_admin/pjax.html.haml +0 -12
  271. data/app/views/rails_admin/main/_dashboard_history.html.haml +0 -21
  272. data/app/views/rails_admin/main/_delete_notice.html.haml +0 -24
  273. data/app/views/rails_admin/main/_form_action_text.html.haml +0 -7
  274. data/app/views/rails_admin/main/_form_boolean.html.haml +0 -3
  275. data/app/views/rails_admin/main/_form_code_mirror.html.haml +0 -9
  276. data/app/views/rails_admin/main/_form_colorpicker.html.haml +0 -1
  277. data/app/views/rails_admin/main/_form_datetime.html.haml +0 -5
  278. data/app/views/rails_admin/main/_form_enumeration.html.haml +0 -19
  279. data/app/views/rails_admin/main/_form_field.html.haml +0 -1
  280. data/app/views/rails_admin/main/_form_file_upload.html.haml +0 -17
  281. data/app/views/rails_admin/main/_form_froala.html.haml +0 -8
  282. data/app/views/rails_admin/main/_form_multiple_file_upload.html.haml +0 -16
  283. data/app/views/rails_admin/main/_form_nested_many.html.haml +0 -15
  284. data/app/views/rails_admin/main/_form_nested_one.html.haml +0 -17
  285. data/app/views/rails_admin/main/_form_polymorphic_association.html.haml +0 -26
  286. data/app/views/rails_admin/main/_form_simple_mde.haml +0 -8
  287. data/app/views/rails_admin/main/_form_text.html.haml +0 -1
  288. data/app/views/rails_admin/main/_form_wysihtml5.html.haml +0 -8
  289. data/app/views/rails_admin/main/_submit_buttons.html.haml +0 -16
  290. data/app/views/rails_admin/main/bulk_delete.html.haml +0 -11
  291. data/app/views/rails_admin/main/dashboard.html.haml +0 -34
  292. data/app/views/rails_admin/main/delete.html.haml +0 -18
  293. data/app/views/rails_admin/main/edit.html.haml +0 -2
  294. data/app/views/rails_admin/main/export.html.haml +0 -92
  295. data/app/views/rails_admin/main/history.html.haml +0 -51
  296. data/app/views/rails_admin/main/index.html.haml +0 -126
  297. data/app/views/rails_admin/main/new.html.haml +0 -2
  298. data/app/views/rails_admin/main/show.html.haml +0 -15
  299. data/config/initializers/devise_patch.rb +0 -9
  300. data/config/initializers/haml.rb +0 -5
  301. data/lib/rails_admin/adapters/active_record/abstract_object.rb +0 -32
  302. data/lib/rails_admin/adapters/mongoid/abstract_object.rb +0 -42
  303. data/lib/rails_admin/bootstrap-sass/compass_functions.rb +0 -28
  304. data/lib/rails_admin/bootstrap-sass/sass_functions.rb +0 -16
  305. data/lib/rails_admin/bootstrap-sass.rb +0 -49
  306. data/lib/rails_admin/config/lazy_model.rb +0 -68
  307. data/lib/rails_admin/extensions/history/auditing_adapter.rb +0 -37
  308. data/lib/rails_admin/extensions/history/history.rb +0 -44
  309. data/lib/rails_admin/extensions/history.rb +0 -3
  310. data/lib/rails_admin/support/i18n.rb +0 -43
  311. data/vendor/assets/fonts/rails_admin/FontAwesome.otf +0 -0
  312. data/vendor/assets/fonts/rails_admin/fontawesome-webfont.eot +0 -0
  313. data/vendor/assets/fonts/rails_admin/fontawesome-webfont.svg +0 -2671
  314. data/vendor/assets/fonts/rails_admin/fontawesome-webfont.ttf +0 -0
  315. data/vendor/assets/fonts/rails_admin/fontawesome-webfont.woff +0 -0
  316. data/vendor/assets/fonts/rails_admin/fontawesome-webfont.woff2 +0 -0
  317. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_background.png +0 -0
  318. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_hex.png +0 -0
  319. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_hsb_b.png +0 -0
  320. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_hsb_h.png +0 -0
  321. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_hsb_s.png +0 -0
  322. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_indic.gif +0 -0
  323. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_overlay.png +0 -0
  324. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_rgb_b.png +0 -0
  325. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_rgb_g.png +0 -0
  326. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_rgb_r.png +0 -0
  327. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_select.gif +0 -0
  328. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_submit.png +0 -0
  329. data/vendor/assets/images/rails_admin/colorpicker/custom_background.png +0 -0
  330. data/vendor/assets/images/rails_admin/colorpicker/custom_hex.png +0 -0
  331. data/vendor/assets/images/rails_admin/colorpicker/custom_hsb_b.png +0 -0
  332. data/vendor/assets/images/rails_admin/colorpicker/custom_hsb_h.png +0 -0
  333. data/vendor/assets/images/rails_admin/colorpicker/custom_hsb_s.png +0 -0
  334. data/vendor/assets/images/rails_admin/colorpicker/custom_indic.gif +0 -0
  335. data/vendor/assets/images/rails_admin/colorpicker/custom_rgb_b.png +0 -0
  336. data/vendor/assets/images/rails_admin/colorpicker/custom_rgb_g.png +0 -0
  337. data/vendor/assets/images/rails_admin/colorpicker/custom_rgb_r.png +0 -0
  338. data/vendor/assets/images/rails_admin/colorpicker/custom_submit.png +0 -0
  339. data/vendor/assets/images/rails_admin/colorpicker/select.png +0 -0
  340. data/vendor/assets/images/rails_admin/colorpicker/select2.png +0 -0
  341. data/vendor/assets/images/rails_admin/colorpicker/slider.png +0 -0
  342. data/vendor/assets/javascripts/rails_admin/jquery.colorpicker.js +0 -484
  343. data/vendor/assets/stylesheets/rails_admin/jquery.colorpicker.scss +0 -182
@@ -1,8 +1,8 @@
1
1
  /* ========================================================================
2
- * Bootstrap: tab.js v3.2.0
3
- * http://getbootstrap.com/javascript/#tabs
2
+ * Bootstrap: tab.js v3.4.1
3
+ * https://getbootstrap.com/docs/3.4/javascript/#tabs
4
4
  * ========================================================================
5
- * Copyright 2011-2014 Twitter, Inc.
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.2.0'
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')[0]
35
- var e = $.Event('show.bs.tab', {
36
- relatedTarget: previous
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
- $this.trigger(e)
46
+ $previous.trigger(hideEvent)
47
+ $this.trigger(showEvent)
40
48
 
41
- if (e.isDefaultPrevented()) return
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.addClass('active')
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.closest('li.dropdown').addClass('active')
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(150) :
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
- $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
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.2.0
3
- * http://getbootstrap.com/javascript/#tooltip
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-2014 Twitter, Inc.
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.2.0'
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
- options = $.extend({}, this.getDefaults(), this.$element.data(), options)
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(document.documentElement, this.$element[0])
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 $parent = this.$element.parent()
185
- var parentDim = this.getPosition($parent)
361
+ var viewportDim = this.getPosition(this.$viewport)
186
362
 
187
- placement = placement == 'bottom' && pos.top + pos.height + actualHeight - parentDim.scroll > parentDim.height ? 'top' :
188
- placement == 'top' && pos.top - parentDim.scroll - actualHeight < 0 ? 'bottom' :
189
- placement == 'right' && pos.right + actualWidth > parentDim.width ? 'left' :
190
- placement == 'left' && pos.left - actualWidth < parentDim.left ? 'right' :
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(150) :
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 = offset.top + marginTop
229
- offset.left = offset.left + marginLeft
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 arrowDelta = delta.left ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
258
- var arrowPosition = delta.left ? 'left' : 'top'
259
- var arrowOffsetPosition = delta.left ? 'offsetWidth' : 'offsetHeight'
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], arrowPosition)
441
+ this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
263
442
  }
264
443
 
265
- Tooltip.prototype.replaceArrow = function (delta, dimension, position) {
266
- this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + '%') : '')
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
- $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
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.tip()
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.trigger('hidden.bs.' + that.type)
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 && this.$tip.hasClass('fade') ?
488
+ $.support.transition && $tip.hasClass('fade') ?
296
489
  $tip
297
490
  .one('bsTransitionEnd', complete)
298
- .emulateTransitionEnd(150) :
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 ($e.attr('data-original-title')) != 'string') {
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
- return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : null, {
322
- scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop(),
323
- width: isBody ? $(window).width() : $element.outerWidth(),
324
- height: isBody ? $(window).height() : $element.outerHeight()
325
- }, isBody ? { top: 0, left: 0 } : $element.offset())
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.width) { // right overflow
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
- return (this.$tip = this.$tip || $(this.options.template))
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
- self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
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().$element.off('.' + this.type).removeData('bs.' + this.type)
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 == 'destroy') return
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
  })