alchemy_cms 7.0.7 → 7.1.0.pre.b1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (331) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/backport.yml +36 -0
  3. data/.github/workflows/test.yml +3 -2
  4. data/.gitignore +1 -0
  5. data/.standard.yml +1 -1
  6. data/CHANGELOG.md +150 -0
  7. data/Gemfile +8 -10
  8. data/README.md +10 -8
  9. data/alchemy_cms.gemspec +3 -2
  10. data/app/assets/config/alchemy_manifest.js +0 -1
  11. data/app/assets/javascripts/alchemy/admin.js +1 -19
  12. data/app/assets/javascripts/alchemy/alchemy.confirm_dialog.js.coffee +2 -3
  13. data/app/assets/javascripts/alchemy/alchemy.dialog.js.coffee +19 -34
  14. data/app/assets/javascripts/alchemy/alchemy.elements_window.js.coffee +38 -13
  15. data/app/assets/javascripts/alchemy/alchemy.file_progress.js.coffee +1 -1
  16. data/app/assets/javascripts/alchemy/alchemy.fixed_elements.js +32 -25
  17. data/app/assets/javascripts/alchemy/alchemy.growler.js.coffee +1 -1
  18. data/app/assets/javascripts/alchemy/alchemy.image_overlay.coffee +3 -5
  19. data/app/assets/javascripts/alchemy/alchemy.initializer.js.coffee +0 -57
  20. data/app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee +22 -63
  21. data/app/assets/javascripts/alchemy/alchemy.list_filter.js.coffee +2 -2
  22. data/app/assets/javascripts/alchemy/alchemy.preview.js.coffee +5 -4
  23. data/app/assets/javascripts/alchemy/alchemy.preview_window.js.coffee +5 -5
  24. data/app/assets/javascripts/alchemy/templates/index.js +0 -2
  25. data/app/assets/javascripts/alchemy/templates/node_folder.hbs +1 -1
  26. data/app/assets/javascripts/alchemy/templates/page.hbs +1 -1
  27. data/app/assets/javascripts/alchemy/templates/page_folder.hbs +2 -2
  28. data/app/assets/stylesheets/alchemy/_custom-properties.scss +82 -0
  29. data/app/assets/stylesheets/alchemy/_mixins.scss +38 -30
  30. data/app/assets/stylesheets/alchemy/_variables.scss +12 -5
  31. data/app/assets/stylesheets/alchemy/admin.scss +3 -4
  32. data/app/assets/stylesheets/alchemy/archive.scss +107 -50
  33. data/app/assets/stylesheets/alchemy/attachments.scss +5 -4
  34. data/app/assets/stylesheets/alchemy/buttons.scss +38 -164
  35. data/app/assets/stylesheets/alchemy/dashboard.scss +31 -6
  36. data/app/assets/stylesheets/alchemy/dialogs.scss +12 -28
  37. data/app/assets/stylesheets/alchemy/elements.scss +273 -282
  38. data/app/assets/stylesheets/alchemy/flash.scss +20 -12
  39. data/app/assets/stylesheets/alchemy/forms.scss +21 -34
  40. data/app/assets/stylesheets/alchemy/frame.scss +11 -32
  41. data/app/assets/stylesheets/alchemy/hints.scss +4 -62
  42. data/app/assets/stylesheets/alchemy/image_library.scss +36 -33
  43. data/app/assets/stylesheets/alchemy/menubar.scss +7 -6
  44. data/app/assets/stylesheets/alchemy/navigation.scss +27 -15
  45. data/app/assets/stylesheets/alchemy/nodes.scss +11 -7
  46. data/app/assets/stylesheets/alchemy/notices.scss +16 -4
  47. data/app/assets/stylesheets/alchemy/page-select.scss +10 -2
  48. data/app/assets/stylesheets/alchemy/pagination.scss +22 -13
  49. data/app/assets/stylesheets/alchemy/resource_info.scss +7 -5
  50. data/app/assets/stylesheets/alchemy/selects.scss +49 -42
  51. data/app/assets/stylesheets/alchemy/shoelace.scss +345 -0
  52. data/app/assets/stylesheets/alchemy/sitemap.scss +24 -14
  53. data/app/assets/stylesheets/alchemy/spinner.scss +9 -19
  54. data/app/assets/stylesheets/alchemy/tables.scss +16 -24
  55. data/app/assets/stylesheets/alchemy/tags.scss +4 -0
  56. data/app/assets/stylesheets/alchemy/toolbar.scss +29 -25
  57. data/app/assets/stylesheets/alchemy/upload.scss +140 -89
  58. data/app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss +80 -108
  59. data/app/components/alchemy/admin/node_select.rb +39 -0
  60. data/app/components/alchemy/admin/page_select.rb +42 -0
  61. data/app/controllers/alchemy/admin/base_controller.rb +5 -6
  62. data/app/controllers/alchemy/admin/elements_controller.rb +63 -35
  63. data/app/controllers/alchemy/admin/resources_controller.rb +5 -5
  64. data/app/controllers/alchemy/base_controller.rb +4 -2
  65. data/app/controllers/alchemy/messages_controller.rb +4 -4
  66. data/app/controllers/concerns/alchemy/admin/uploader_responses.rb +1 -1
  67. data/app/controllers/concerns/alchemy/site_redirects.rb +1 -1
  68. data/app/decorators/alchemy/element_editor.rb +0 -2
  69. data/app/helpers/alchemy/admin/attachments_helper.rb +6 -5
  70. data/app/helpers/alchemy/admin/base_helper.rb +17 -12
  71. data/app/helpers/alchemy/admin/ingredients_helper.rb +4 -1
  72. data/app/helpers/alchemy/admin/pages_helper.rb +5 -11
  73. data/app/helpers/alchemy/base_helper.rb +47 -13
  74. data/app/javascript/alchemy_admin/components/alchemy_html_element.js +129 -0
  75. data/app/javascript/alchemy_admin/components/button.js +59 -0
  76. data/app/javascript/alchemy_admin/components/char_counter.js +40 -0
  77. data/app/javascript/alchemy_admin/components/datepicker.js +39 -0
  78. data/app/javascript/alchemy_admin/components/dialog_link.js +45 -0
  79. data/app/javascript/alchemy_admin/components/element_editor/publish_element_button.js +36 -0
  80. data/app/javascript/alchemy_admin/components/element_editor.js +553 -0
  81. data/app/javascript/alchemy_admin/components/ingredient_group.js +54 -0
  82. data/app/javascript/alchemy_admin/components/link_buttons/link_button.js +48 -0
  83. data/app/javascript/alchemy_admin/components/link_buttons/unlink_button.js +38 -0
  84. data/app/javascript/alchemy_admin/components/link_buttons.js +79 -0
  85. data/app/javascript/alchemy_admin/components/node_select.js +45 -0
  86. data/app/javascript/alchemy_admin/components/overlay.js +18 -0
  87. data/app/javascript/alchemy_admin/components/page_select.js +63 -0
  88. data/app/javascript/alchemy_admin/components/remote_select.js +134 -0
  89. data/app/javascript/alchemy_admin/components/select.js +12 -0
  90. data/app/javascript/alchemy_admin/components/spinner.js +31 -0
  91. data/app/javascript/alchemy_admin/components/tinymce.js +146 -0
  92. data/app/javascript/alchemy_admin/components/uploader/file_upload.js +266 -0
  93. data/app/javascript/alchemy_admin/components/uploader/progress.js +258 -0
  94. data/app/javascript/alchemy_admin/components/uploader.js +132 -0
  95. data/app/javascript/alchemy_admin/dirty.js +49 -0
  96. data/app/javascript/alchemy_admin/file_editors.js +1 -1
  97. data/app/javascript/alchemy_admin/gui.js +14 -0
  98. data/app/javascript/alchemy_admin/i18n.js +12 -8
  99. data/app/javascript/alchemy_admin/image_cropper.js +6 -3
  100. data/app/javascript/alchemy_admin/image_loader.js +7 -15
  101. data/app/javascript/alchemy_admin/ingredient_anchor_link.js +2 -5
  102. data/app/javascript/alchemy_admin/initializer.js +65 -0
  103. data/app/javascript/alchemy_admin/locales/en.js +31 -0
  104. data/app/javascript/alchemy_admin/picture_editors.js +2 -2
  105. data/app/javascript/alchemy_admin/picture_selector.js +38 -0
  106. data/app/javascript/alchemy_admin/please_wait_overlay.js +8 -0
  107. data/app/javascript/alchemy_admin/sortable_elements.js +78 -0
  108. data/app/javascript/alchemy_admin/spinner.js +36 -0
  109. data/app/javascript/alchemy_admin/tags_autocomplete.js +46 -0
  110. data/app/javascript/alchemy_admin/utils/ajax.js +6 -5
  111. data/app/javascript/alchemy_admin/utils/dom_helpers.js +20 -0
  112. data/app/javascript/alchemy_admin/utils/format.js +11 -0
  113. data/app/javascript/alchemy_admin/utils/string_conversions.js +10 -0
  114. data/app/javascript/alchemy_admin.js +70 -13
  115. data/app/javascript/menubar.js +10 -0
  116. data/app/models/alchemy/attachment.rb +9 -11
  117. data/app/models/alchemy/element/element_ingredients.rb +2 -2
  118. data/app/models/alchemy/element.rb +11 -0
  119. data/app/models/alchemy/ingredient.rb +3 -3
  120. data/app/models/alchemy/ingredient_validator.rb +2 -2
  121. data/app/models/alchemy/ingredients/richtext.rb +1 -10
  122. data/app/models/alchemy/node.rb +4 -0
  123. data/app/models/alchemy/page/page_natures.rb +10 -2
  124. data/app/models/alchemy/page.rb +10 -50
  125. data/app/models/alchemy/picture/url.rb +1 -9
  126. data/app/models/concerns/alchemy/picture_thumbnails.rb +1 -1
  127. data/app/serializers/alchemy/page_tree_serializer.rb +2 -1
  128. data/app/services/alchemy/copy_page.rb +98 -0
  129. data/app/views/alchemy/_menubar.html.erb +17 -13
  130. data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +14 -10
  131. data/app/views/alchemy/admin/attachments/_attachment.html.erb +44 -36
  132. data/app/views/alchemy/admin/attachments/_replace_button.html.erb +15 -21
  133. data/app/views/alchemy/admin/attachments/archive_overlay.js.erb +0 -1
  134. data/app/views/alchemy/admin/attachments/assign.js.erb +1 -1
  135. data/app/views/alchemy/admin/attachments/index.html.erb +6 -4
  136. data/app/views/alchemy/admin/attachments/show.html.erb +8 -8
  137. data/app/views/alchemy/admin/clipboard/clear.js.erb +1 -1
  138. data/app/views/alchemy/admin/clipboard/index.html.erb +3 -7
  139. data/app/views/alchemy/admin/clipboard/insert.js.erb +1 -1
  140. data/app/views/alchemy/admin/crop.html.erb +1 -1
  141. data/app/views/alchemy/admin/dashboard/_locked_pages.html.erb +1 -1
  142. data/app/views/alchemy/admin/dashboard/index.html.erb +13 -11
  143. data/app/views/alchemy/admin/dashboard/info.html.erb +7 -7
  144. data/app/views/alchemy/admin/elements/_add_nested_element_form.html.erb +22 -24
  145. data/app/views/alchemy/admin/elements/_element.html.erb +52 -44
  146. data/app/views/alchemy/admin/elements/_footer.html.erb +1 -1
  147. data/app/views/alchemy/admin/elements/_form.html.erb +1 -1
  148. data/app/views/alchemy/admin/elements/_header.html.erb +11 -12
  149. data/app/views/alchemy/admin/elements/_toolbar.html.erb +33 -45
  150. data/app/views/alchemy/admin/elements/create.js.erb +7 -15
  151. data/app/views/alchemy/admin/elements/destroy.js.erb +0 -2
  152. data/app/views/alchemy/admin/elements/index.html.erb +27 -24
  153. data/app/views/alchemy/admin/elements/new.html.erb +9 -11
  154. data/app/views/alchemy/admin/ingredients/_file_fields.html.erb +2 -2
  155. data/app/views/alchemy/admin/ingredients/_picture_fields.html.erb +3 -3
  156. data/app/views/alchemy/admin/ingredients/_video_fields.html.erb +1 -2
  157. data/app/views/alchemy/admin/languages/_form.html.erb +2 -3
  158. data/app/views/alchemy/admin/languages/_language.html.erb +15 -8
  159. data/app/views/alchemy/admin/languages/_table.html.erb +1 -0
  160. data/app/views/alchemy/admin/layoutpages/_layoutpage.html.erb +28 -16
  161. data/app/views/alchemy/admin/layoutpages/index.html.erb +2 -2
  162. data/app/views/alchemy/admin/legacy_page_urls/_legacy_page_url.html.erb +12 -8
  163. data/app/views/alchemy/admin/legacy_page_urls/_new.html.erb +1 -1
  164. data/app/views/alchemy/admin/nodes/_form.html.erb +20 -21
  165. data/app/views/alchemy/admin/nodes/_node.html.erb +39 -34
  166. data/app/views/alchemy/admin/nodes/index.html.erb +1 -1
  167. data/app/views/alchemy/admin/pages/_anchor_link.html.erb +4 -4
  168. data/app/views/alchemy/admin/pages/_create_language_form.html.erb +2 -2
  169. data/app/views/alchemy/admin/pages/_current_page.html.erb +1 -1
  170. data/app/views/alchemy/admin/pages/_external_link.html.erb +4 -4
  171. data/app/views/alchemy/admin/pages/_file_link.html.erb +5 -5
  172. data/app/views/alchemy/admin/pages/_form.html.erb +10 -21
  173. data/app/views/alchemy/admin/pages/_internal_link.html.erb +4 -4
  174. data/app/views/alchemy/admin/pages/_locked_page.html.erb +2 -2
  175. data/app/views/alchemy/admin/pages/_new_page_form.html.erb +4 -17
  176. data/app/views/alchemy/admin/pages/_page.html.erb +76 -72
  177. data/app/views/alchemy/admin/pages/_page_infos.html.erb +23 -7
  178. data/app/views/alchemy/admin/pages/_page_layout_filter.html.erb +2 -1
  179. data/app/views/alchemy/admin/pages/_page_status.html.erb +11 -21
  180. data/app/views/alchemy/admin/pages/_publication_fields.html.erb +2 -5
  181. data/app/views/alchemy/admin/pages/_table.html.erb +1 -1
  182. data/app/views/alchemy/admin/pages/_table_row.html.erb +43 -39
  183. data/app/views/alchemy/admin/pages/_toolbar.html.erb +43 -38
  184. data/app/views/alchemy/admin/pages/configure.html.erb +12 -14
  185. data/app/views/alchemy/admin/pages/edit.html.erb +80 -103
  186. data/app/views/alchemy/admin/pages/info.html.erb +20 -11
  187. data/app/views/alchemy/admin/pages/link.html.erb +22 -16
  188. data/app/views/alchemy/admin/pages/new.html.erb +9 -11
  189. data/app/views/alchemy/admin/pages/unlock.js.erb +10 -3
  190. data/app/views/alchemy/admin/partials/_language_tree_select.html.erb +15 -13
  191. data/app/views/alchemy/admin/partials/_main_navigation_entry.html.erb +3 -5
  192. data/app/views/alchemy/admin/partials/_routes.html.erb +10 -2
  193. data/app/views/alchemy/admin/partials/_site_select.html.erb +6 -5
  194. data/app/views/alchemy/admin/partials/_toolbar_button.html.erb +28 -23
  195. data/app/views/alchemy/admin/pictures/_archive.html.erb +5 -5
  196. data/app/views/alchemy/admin/pictures/_archive_overlay.html.erb +1 -1
  197. data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +21 -23
  198. data/app/views/alchemy/admin/pictures/_infos.html.erb +2 -6
  199. data/app/views/alchemy/admin/pictures/_picture.html.erb +15 -17
  200. data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +17 -16
  201. data/app/views/alchemy/admin/pictures/_tag_list.html.erb +1 -1
  202. data/app/views/alchemy/admin/pictures/archive_overlay.js.erb +1 -1
  203. data/app/views/alchemy/admin/pictures/assign.js.erb +1 -1
  204. data/app/views/alchemy/admin/pictures/index.html.erb +34 -30
  205. data/app/views/alchemy/admin/pictures/show.html.erb +3 -3
  206. data/app/views/alchemy/admin/resources/_filter.html.erb +1 -1
  207. data/app/views/alchemy/admin/resources/_form.html.erb +2 -2
  208. data/app/views/alchemy/admin/resources/_resource.html.erb +16 -9
  209. data/app/views/alchemy/admin/resources/_table.html.erb +4 -1
  210. data/app/views/alchemy/admin/resources/index.html.erb +22 -19
  211. data/app/views/alchemy/admin/sites/index.html.erb +2 -1
  212. data/app/views/alchemy/admin/styleguide/index.html.erb +54 -28
  213. data/app/views/alchemy/admin/tags/_tag.html.erb +16 -14
  214. data/app/views/alchemy/admin/tags/index.html.erb +15 -12
  215. data/app/views/alchemy/admin/tinymce/_setup.html.erb +29 -0
  216. data/app/views/alchemy/admin/uploader/_button.html.erb +23 -29
  217. data/app/views/alchemy/admin/uploader/_setup.html.erb +3 -8
  218. data/app/views/alchemy/base/500.html.erb +1 -1
  219. data/app/views/alchemy/base/error_notice.js.erb +0 -1
  220. data/app/views/alchemy/ingredients/_boolean_editor.html.erb +1 -1
  221. data/app/views/alchemy/ingredients/_datetime_editor.html.erb +1 -1
  222. data/app/views/alchemy/ingredients/_file_editor.html.erb +5 -5
  223. data/app/views/alchemy/ingredients/_link_editor.html.erb +1 -1
  224. data/app/views/alchemy/ingredients/_node_editor.html.erb +6 -19
  225. data/app/views/alchemy/ingredients/_page_editor.html.erb +7 -19
  226. data/app/views/alchemy/ingredients/_picture_editor.html.erb +2 -2
  227. data/app/views/alchemy/ingredients/_richtext_editor.html.erb +6 -15
  228. data/app/views/alchemy/ingredients/_select_editor.html.erb +2 -1
  229. data/app/views/alchemy/ingredients/_text_editor.html.erb +1 -1
  230. data/app/views/alchemy/ingredients/shared/_anchor.html.erb +1 -1
  231. data/app/views/alchemy/ingredients/shared/_link_tools.html.erb +10 -20
  232. data/app/views/alchemy/ingredients/shared/_picture_tools.html.erb +42 -49
  233. data/app/views/kaminari/alchemy/_first_page.html.erb +4 -2
  234. data/app/views/kaminari/alchemy/_gap.html.erb +1 -1
  235. data/app/views/kaminari/alchemy/_last_page.html.erb +4 -2
  236. data/app/views/kaminari/alchemy/_next_page.html.erb +4 -2
  237. data/app/views/kaminari/alchemy/_prev_page.html.erb +4 -2
  238. data/app/views/layouts/alchemy/admin.html.erb +10 -29
  239. data/config/alchemy/modules.yml +30 -30
  240. data/config/importmap.rb +10 -1
  241. data/config/initializers/rails_live_reload.rb +13 -0
  242. data/config/locales/alchemy.en.yml +23 -9
  243. data/config/routes.rb +2 -1
  244. data/lib/alchemy/auth_accessors.rb +6 -1
  245. data/lib/alchemy/dev_support/live_reload_watcher.rb +5 -0
  246. data/lib/alchemy/engine.rb +8 -2
  247. data/lib/alchemy/forms/builder.rb +18 -12
  248. data/lib/alchemy/resource.rb +2 -2
  249. data/lib/alchemy/resources_helper.rb +6 -6
  250. data/lib/alchemy/test_support/capybara_helpers.rb +8 -5
  251. data/lib/alchemy/test_support/rspec_matchers.rb +14 -0
  252. data/lib/alchemy/test_support/shared_uploader_examples.rb +1 -1
  253. data/lib/alchemy/tinymce.rb +8 -3
  254. data/lib/alchemy/version.rb +1 -1
  255. data/package.json +14 -5
  256. data/vendor/assets/fonts/remixicon.eot +0 -0
  257. data/vendor/assets/fonts/remixicon.svg +7816 -0
  258. data/vendor/assets/fonts/remixicon.ttf +0 -0
  259. data/vendor/assets/fonts/remixicon.woff +0 -0
  260. data/vendor/assets/fonts/remixicon.woff2 +0 -0
  261. data/vendor/assets/stylesheets/remixicon.scss +10480 -0
  262. metadata +85 -90
  263. data/app/assets/javascripts/alchemy/alchemy.autocomplete.js.coffee +0 -30
  264. data/app/assets/javascripts/alchemy/alchemy.base.js.coffee +0 -53
  265. data/app/assets/javascripts/alchemy/alchemy.buttons.js.coffee +0 -45
  266. data/app/assets/javascripts/alchemy/alchemy.char_counter.js.coffee +0 -19
  267. data/app/assets/javascripts/alchemy/alchemy.dirty.js.coffee +0 -59
  268. data/app/assets/javascripts/alchemy/alchemy.dragndrop.js.coffee +0 -79
  269. data/app/assets/javascripts/alchemy/alchemy.element_editors.js.coffee +0 -267
  270. data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +0 -27
  271. data/app/assets/javascripts/alchemy/alchemy.spinner.js +0 -32
  272. data/app/assets/javascripts/alchemy/alchemy.tooltips.coffee +0 -10
  273. data/app/assets/javascripts/alchemy/alchemy.uploader.js.coffee +0 -131
  274. data/app/assets/javascripts/alchemy/menubar.js.coffee +0 -8
  275. data/app/assets/javascripts/alchemy/node_select.js +0 -39
  276. data/app/assets/javascripts/alchemy/page_select.js +0 -46
  277. data/app/assets/javascripts/alchemy/templates/node.hbs +0 -16
  278. data/app/assets/javascripts/alchemy/templates/spinner.hbs +0 -7
  279. data/app/assets/stylesheets/alchemy/jquery-ui.scss +0 -435
  280. data/app/javascript/alchemy_admin/datepicker.js +0 -33
  281. data/app/javascript/alchemy_admin/tinymce.js +0 -146
  282. data/app/javascript/alchemy_admin/translations.js +0 -32
  283. data/app/views/alchemy/admin/elements/fold.js.erb +0 -33
  284. data/app/views/alchemy/admin/elements/order.js.erb +0 -11
  285. data/app/views/alchemy/admin/elements/publish.js.erb +0 -21
  286. data/app/views/alchemy/admin/elements/update.js.erb +0 -27
  287. data/vendor/assets/fonts/fa-regular-400.eot +0 -0
  288. data/vendor/assets/fonts/fa-regular-400.svg +0 -803
  289. data/vendor/assets/fonts/fa-regular-400.ttf +0 -0
  290. data/vendor/assets/fonts/fa-regular-400.woff +0 -0
  291. data/vendor/assets/fonts/fa-regular-400.woff2 +0 -0
  292. data/vendor/assets/fonts/fa-solid-900.eot +0 -0
  293. data/vendor/assets/fonts/fa-solid-900.svg +0 -4938
  294. data/vendor/assets/fonts/fa-solid-900.ttf +0 -0
  295. data/vendor/assets/fonts/fa-solid-900.woff +0 -0
  296. data/vendor/assets/fonts/fa-solid-900.woff2 +0 -0
  297. data/vendor/assets/javascripts/fileupload/jquery.fileupload-process.js +0 -178
  298. data/vendor/assets/javascripts/fileupload/jquery.fileupload-validate.js +0 -125
  299. data/vendor/assets/javascripts/fileupload/jquery.fileupload.js +0 -1502
  300. data/vendor/assets/javascripts/fileupload/jquery.iframe-transport.js +0 -224
  301. data/vendor/assets/javascripts/jquery-ui/data.js +0 -45
  302. data/vendor/assets/javascripts/jquery-ui/ie.js +0 -20
  303. data/vendor/assets/javascripts/jquery-ui/keycode.js +0 -51
  304. data/vendor/assets/javascripts/jquery-ui/plugin.js +0 -49
  305. data/vendor/assets/javascripts/jquery-ui/safe-active-element.js +0 -46
  306. data/vendor/assets/javascripts/jquery-ui/safe-blur.js +0 -27
  307. data/vendor/assets/javascripts/jquery-ui/scroll-parent.js +0 -50
  308. data/vendor/assets/javascripts/jquery-ui/unique-id.js +0 -54
  309. data/vendor/assets/javascripts/jquery-ui/version.js +0 -20
  310. data/vendor/assets/javascripts/jquery-ui/widget.js +0 -754
  311. data/vendor/assets/javascripts/jquery-ui/widgets/draggable.js +0 -1268
  312. data/vendor/assets/javascripts/jquery-ui/widgets/mouse.js +0 -241
  313. data/vendor/assets/javascripts/jquery-ui/widgets/sortable.js +0 -1623
  314. data/vendor/assets/javascripts/jquery-ui/widgets/tabs.js +0 -931
  315. data/vendor/assets/javascripts/jquery_plugins/jquery.scrollTo.min.js +0 -7
  316. data/vendor/assets/javascripts/jquery_plugins/jquery.ui.tabspaging.js +0 -296
  317. data/vendor/assets/stylesheets/fontawesome/_animated.scss +0 -20
  318. data/vendor/assets/stylesheets/fontawesome/_bordered-pulled.scss +0 -20
  319. data/vendor/assets/stylesheets/fontawesome/_core.scss +0 -21
  320. data/vendor/assets/stylesheets/fontawesome/_fixed-width.scss +0 -6
  321. data/vendor/assets/stylesheets/fontawesome/_icons.scss +0 -1441
  322. data/vendor/assets/stylesheets/fontawesome/_larger.scss +0 -23
  323. data/vendor/assets/stylesheets/fontawesome/_list.scss +0 -18
  324. data/vendor/assets/stylesheets/fontawesome/_mixins.scss +0 -56
  325. data/vendor/assets/stylesheets/fontawesome/_rotated-flipped.scss +0 -24
  326. data/vendor/assets/stylesheets/fontawesome/_screen-reader.scss +0 -5
  327. data/vendor/assets/stylesheets/fontawesome/_stacked.scss +0 -31
  328. data/vendor/assets/stylesheets/fontawesome/_variables.scss +0 -1458
  329. data/vendor/assets/stylesheets/fontawesome/fontawesome.scss +0 -16
  330. data/vendor/assets/stylesheets/fontawesome/regular.scss +0 -23
  331. data/vendor/assets/stylesheets/fontawesome/solid.scss +0 -24
@@ -1,1268 +0,0 @@
1
- //= require jquery-ui/widgets/mouse
2
- //= require jquery-ui/data
3
- //= require jquery-ui/plugin
4
- //= require jquery-ui/safe-active-element
5
- //= require jquery-ui/safe-blur
6
- //= require jquery-ui/scroll-parent
7
- //= require jquery-ui/version
8
- //= require jquery-ui/widget
9
-
10
- /*!
11
- * jQuery UI Draggable 1.13.0
12
- * http://jqueryui.com
13
- *
14
- * Copyright jQuery Foundation and other contributors
15
- * Released under the MIT license.
16
- * http://jquery.org/license
17
- */
18
-
19
- //>>label: Draggable
20
- //>>group: Interactions
21
- //>>description: Enables dragging functionality for any element.
22
- //>>docs: http://api.jqueryui.com/draggable/
23
- //>>demos: http://jqueryui.com/draggable/
24
- //>>css.structure: ../../themes/base/draggable.css
25
-
26
- ( function( factory ) {
27
- "use strict";
28
-
29
- if ( typeof define === "function" && define.amd ) {
30
-
31
- // AMD. Register as an anonymous module.
32
- define( [
33
- "jquery",
34
- "./mouse",
35
- "../data",
36
- "../plugin",
37
- "../safe-active-element",
38
- "../safe-blur",
39
- "../scroll-parent",
40
- "../version",
41
- "../widget"
42
- ], factory );
43
- } else {
44
-
45
- // Browser globals
46
- factory( jQuery );
47
- }
48
- } )( function( $ ) {
49
- "use strict";
50
-
51
- $.widget( "ui.draggable", $.ui.mouse, {
52
- version: "1.13.0",
53
- widgetEventPrefix: "drag",
54
- options: {
55
- addClasses: true,
56
- appendTo: "parent",
57
- axis: false,
58
- connectToSortable: false,
59
- containment: false,
60
- cursor: "auto",
61
- cursorAt: false,
62
- grid: false,
63
- handle: false,
64
- helper: "original",
65
- iframeFix: false,
66
- opacity: false,
67
- refreshPositions: false,
68
- revert: false,
69
- revertDuration: 500,
70
- scope: "default",
71
- scroll: true,
72
- scrollSensitivity: 20,
73
- scrollSpeed: 20,
74
- snap: false,
75
- snapMode: "both",
76
- snapTolerance: 20,
77
- stack: false,
78
- zIndex: false,
79
-
80
- // Callbacks
81
- drag: null,
82
- start: null,
83
- stop: null
84
- },
85
- _create: function() {
86
-
87
- if ( this.options.helper === "original" ) {
88
- this._setPositionRelative();
89
- }
90
- if ( this.options.addClasses ) {
91
- this._addClass( "ui-draggable" );
92
- }
93
- this._setHandleClassName();
94
-
95
- this._mouseInit();
96
- },
97
-
98
- _setOption: function( key, value ) {
99
- this._super( key, value );
100
- if ( key === "handle" ) {
101
- this._removeHandleClassName();
102
- this._setHandleClassName();
103
- }
104
- },
105
-
106
- _destroy: function() {
107
- if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) {
108
- this.destroyOnClear = true;
109
- return;
110
- }
111
- this._removeHandleClassName();
112
- this._mouseDestroy();
113
- },
114
-
115
- _mouseCapture: function( event ) {
116
- var o = this.options;
117
-
118
- // Among others, prevent a drag on a resizable-handle
119
- if ( this.helper || o.disabled ||
120
- $( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) {
121
- return false;
122
- }
123
-
124
- //Quit if we're not on a valid handle
125
- this.handle = this._getHandle( event );
126
- if ( !this.handle ) {
127
- return false;
128
- }
129
-
130
- this._blurActiveElement( event );
131
-
132
- this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix );
133
-
134
- return true;
135
-
136
- },
137
-
138
- _blockFrames: function( selector ) {
139
- this.iframeBlocks = this.document.find( selector ).map( function() {
140
- var iframe = $( this );
141
-
142
- return $( "<div>" )
143
- .css( "position", "absolute" )
144
- .appendTo( iframe.parent() )
145
- .outerWidth( iframe.outerWidth() )
146
- .outerHeight( iframe.outerHeight() )
147
- .offset( iframe.offset() )[ 0 ];
148
- } );
149
- },
150
-
151
- _unblockFrames: function() {
152
- if ( this.iframeBlocks ) {
153
- this.iframeBlocks.remove();
154
- delete this.iframeBlocks;
155
- }
156
- },
157
-
158
- _blurActiveElement: function( event ) {
159
- var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ),
160
- target = $( event.target );
161
-
162
- // Don't blur if the event occurred on an element that is within
163
- // the currently focused element
164
- // See #10527, #12472
165
- if ( target.closest( activeElement ).length ) {
166
- return;
167
- }
168
-
169
- // Blur any element that currently has focus, see #4261
170
- $.ui.safeBlur( activeElement );
171
- },
172
-
173
- _mouseStart: function( event ) {
174
-
175
- var o = this.options;
176
-
177
- //Create and append the visible helper
178
- this.helper = this._createHelper( event );
179
-
180
- this._addClass( this.helper, "ui-draggable-dragging" );
181
-
182
- //Cache the helper size
183
- this._cacheHelperProportions();
184
-
185
- //If ddmanager is used for droppables, set the global draggable
186
- if ( $.ui.ddmanager ) {
187
- $.ui.ddmanager.current = this;
188
- }
189
-
190
- /*
191
- * - Position generation -
192
- * This block generates everything position related - it's the core of draggables.
193
- */
194
-
195
- //Cache the margins of the original element
196
- this._cacheMargins();
197
-
198
- //Store the helper's css position
199
- this.cssPosition = this.helper.css( "position" );
200
- this.scrollParent = this.helper.scrollParent( true );
201
- this.offsetParent = this.helper.offsetParent();
202
- this.hasFixedAncestor = this.helper.parents().filter( function() {
203
- return $( this ).css( "position" ) === "fixed";
204
- } ).length > 0;
205
-
206
- //The element's absolute position on the page minus margins
207
- this.positionAbs = this.element.offset();
208
- this._refreshOffsets( event );
209
-
210
- //Generate the original position
211
- this.originalPosition = this.position = this._generatePosition( event, false );
212
- this.originalPageX = event.pageX;
213
- this.originalPageY = event.pageY;
214
-
215
- //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
216
- if ( o.cursorAt ) {
217
- this._adjustOffsetFromHelper( o.cursorAt );
218
- }
219
-
220
- //Set a containment if given in the options
221
- this._setContainment();
222
-
223
- //Trigger event + callbacks
224
- if ( this._trigger( "start", event ) === false ) {
225
- this._clear();
226
- return false;
227
- }
228
-
229
- //Recache the helper size
230
- this._cacheHelperProportions();
231
-
232
- //Prepare the droppable offsets
233
- if ( $.ui.ddmanager && !o.dropBehaviour ) {
234
- $.ui.ddmanager.prepareOffsets( this, event );
235
- }
236
-
237
- // Execute the drag once - this causes the helper not to be visible before getting its
238
- // correct position
239
- this._mouseDrag( event, true );
240
-
241
- // If the ddmanager is used for droppables, inform the manager that dragging has started
242
- // (see #5003)
243
- if ( $.ui.ddmanager ) {
244
- $.ui.ddmanager.dragStart( this, event );
245
- }
246
-
247
- return true;
248
- },
249
-
250
- _refreshOffsets: function( event ) {
251
- this.offset = {
252
- top: this.positionAbs.top - this.margins.top,
253
- left: this.positionAbs.left - this.margins.left,
254
- scroll: false,
255
- parent: this._getParentOffset(),
256
- relative: this._getRelativeOffset()
257
- };
258
-
259
- this.offset.click = {
260
- left: event.pageX - this.offset.left,
261
- top: event.pageY - this.offset.top
262
- };
263
- },
264
-
265
- _mouseDrag: function( event, noPropagation ) {
266
-
267
- // reset any necessary cached properties (see #5009)
268
- if ( this.hasFixedAncestor ) {
269
- this.offset.parent = this._getParentOffset();
270
- }
271
-
272
- //Compute the helpers position
273
- this.position = this._generatePosition( event, true );
274
- this.positionAbs = this._convertPositionTo( "absolute" );
275
-
276
- //Call plugins and callbacks and use the resulting position if something is returned
277
- if ( !noPropagation ) {
278
- var ui = this._uiHash();
279
- if ( this._trigger( "drag", event, ui ) === false ) {
280
- this._mouseUp( new $.Event( "mouseup", event ) );
281
- return false;
282
- }
283
- this.position = ui.position;
284
- }
285
-
286
- this.helper[ 0 ].style.left = this.position.left + "px";
287
- this.helper[ 0 ].style.top = this.position.top + "px";
288
-
289
- if ( $.ui.ddmanager ) {
290
- $.ui.ddmanager.drag( this, event );
291
- }
292
-
293
- return false;
294
- },
295
-
296
- _mouseStop: function( event ) {
297
-
298
- //If we are using droppables, inform the manager about the drop
299
- var that = this,
300
- dropped = false;
301
- if ( $.ui.ddmanager && !this.options.dropBehaviour ) {
302
- dropped = $.ui.ddmanager.drop( this, event );
303
- }
304
-
305
- //if a drop comes from outside (a sortable)
306
- if ( this.dropped ) {
307
- dropped = this.dropped;
308
- this.dropped = false;
309
- }
310
-
311
- if ( ( this.options.revert === "invalid" && !dropped ) ||
312
- ( this.options.revert === "valid" && dropped ) ||
313
- this.options.revert === true || ( typeof this.options.revert === "function" &&
314
- this.options.revert.call( this.element, dropped ) )
315
- ) {
316
- $( this.helper ).animate(
317
- this.originalPosition,
318
- parseInt( this.options.revertDuration, 10 ),
319
- function() {
320
- if ( that._trigger( "stop", event ) !== false ) {
321
- that._clear();
322
- }
323
- }
324
- );
325
- } else {
326
- if ( this._trigger( "stop", event ) !== false ) {
327
- this._clear();
328
- }
329
- }
330
-
331
- return false;
332
- },
333
-
334
- _mouseUp: function( event ) {
335
- this._unblockFrames();
336
-
337
- // If the ddmanager is used for droppables, inform the manager that dragging has stopped
338
- // (see #5003)
339
- if ( $.ui.ddmanager ) {
340
- $.ui.ddmanager.dragStop( this, event );
341
- }
342
-
343
- // Only need to focus if the event occurred on the draggable itself, see #10527
344
- if ( this.handleElement.is( event.target ) ) {
345
-
346
- // The interaction is over; whether or not the click resulted in a drag,
347
- // focus the element
348
- this.element.trigger( "focus" );
349
- }
350
-
351
- return $.ui.mouse.prototype._mouseUp.call( this, event );
352
- },
353
-
354
- cancel: function() {
355
-
356
- if ( this.helper.is( ".ui-draggable-dragging" ) ) {
357
- this._mouseUp( new $.Event( "mouseup", { target: this.element[ 0 ] } ) );
358
- } else {
359
- this._clear();
360
- }
361
-
362
- return this;
363
-
364
- },
365
-
366
- _getHandle: function( event ) {
367
- return this.options.handle ?
368
- !!$( event.target ).closest( this.element.find( this.options.handle ) ).length :
369
- true;
370
- },
371
-
372
- _setHandleClassName: function() {
373
- this.handleElement = this.options.handle ?
374
- this.element.find( this.options.handle ) : this.element;
375
- this._addClass( this.handleElement, "ui-draggable-handle" );
376
- },
377
-
378
- _removeHandleClassName: function() {
379
- this._removeClass( this.handleElement, "ui-draggable-handle" );
380
- },
381
-
382
- _createHelper: function( event ) {
383
-
384
- var o = this.options,
385
- helperIsFunction = typeof o.helper === "function",
386
- helper = helperIsFunction ?
387
- $( o.helper.apply( this.element[ 0 ], [ event ] ) ) :
388
- ( o.helper === "clone" ?
389
- this.element.clone().removeAttr( "id" ) :
390
- this.element );
391
-
392
- if ( !helper.parents( "body" ).length ) {
393
- helper.appendTo( ( o.appendTo === "parent" ?
394
- this.element[ 0 ].parentNode :
395
- o.appendTo ) );
396
- }
397
-
398
- // Http://bugs.jqueryui.com/ticket/9446
399
- // a helper function can return the original element
400
- // which wouldn't have been set to relative in _create
401
- if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) {
402
- this._setPositionRelative();
403
- }
404
-
405
- if ( helper[ 0 ] !== this.element[ 0 ] &&
406
- !( /(fixed|absolute)/ ).test( helper.css( "position" ) ) ) {
407
- helper.css( "position", "absolute" );
408
- }
409
-
410
- return helper;
411
-
412
- },
413
-
414
- _setPositionRelative: function() {
415
- if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) {
416
- this.element[ 0 ].style.position = "relative";
417
- }
418
- },
419
-
420
- _adjustOffsetFromHelper: function( obj ) {
421
- if ( typeof obj === "string" ) {
422
- obj = obj.split( " " );
423
- }
424
- if ( Array.isArray( obj ) ) {
425
- obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };
426
- }
427
- if ( "left" in obj ) {
428
- this.offset.click.left = obj.left + this.margins.left;
429
- }
430
- if ( "right" in obj ) {
431
- this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
432
- }
433
- if ( "top" in obj ) {
434
- this.offset.click.top = obj.top + this.margins.top;
435
- }
436
- if ( "bottom" in obj ) {
437
- this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
438
- }
439
- },
440
-
441
- _isRootNode: function( element ) {
442
- return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ];
443
- },
444
-
445
- _getParentOffset: function() {
446
-
447
- //Get the offsetParent and cache its position
448
- var po = this.offsetParent.offset(),
449
- document = this.document[ 0 ];
450
-
451
- // This is a special case where we need to modify a offset calculated on start, since the
452
- // following happened:
453
- // 1. The position of the helper is absolute, so it's position is calculated based on the
454
- // next positioned parent
455
- // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
456
- // the document, which means that the scroll is included in the initial calculation of the
457
- // offset of the parent, and never recalculated upon drag
458
- if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== document &&
459
- $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) {
460
- po.left += this.scrollParent.scrollLeft();
461
- po.top += this.scrollParent.scrollTop();
462
- }
463
-
464
- if ( this._isRootNode( this.offsetParent[ 0 ] ) ) {
465
- po = { top: 0, left: 0 };
466
- }
467
-
468
- return {
469
- top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ),
470
- left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 )
471
- };
472
-
473
- },
474
-
475
- _getRelativeOffset: function() {
476
- if ( this.cssPosition !== "relative" ) {
477
- return { top: 0, left: 0 };
478
- }
479
-
480
- var p = this.element.position(),
481
- scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
482
-
483
- return {
484
- top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) +
485
- ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ),
486
- left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) +
487
- ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 )
488
- };
489
-
490
- },
491
-
492
- _cacheMargins: function() {
493
- this.margins = {
494
- left: ( parseInt( this.element.css( "marginLeft" ), 10 ) || 0 ),
495
- top: ( parseInt( this.element.css( "marginTop" ), 10 ) || 0 ),
496
- right: ( parseInt( this.element.css( "marginRight" ), 10 ) || 0 ),
497
- bottom: ( parseInt( this.element.css( "marginBottom" ), 10 ) || 0 )
498
- };
499
- },
500
-
501
- _cacheHelperProportions: function() {
502
- this.helperProportions = {
503
- width: this.helper.outerWidth(),
504
- height: this.helper.outerHeight()
505
- };
506
- },
507
-
508
- _setContainment: function() {
509
-
510
- var isUserScrollable, c, ce,
511
- o = this.options,
512
- document = this.document[ 0 ];
513
-
514
- this.relativeContainer = null;
515
-
516
- if ( !o.containment ) {
517
- this.containment = null;
518
- return;
519
- }
520
-
521
- if ( o.containment === "window" ) {
522
- this.containment = [
523
- $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
524
- $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top,
525
- $( window ).scrollLeft() + $( window ).width() -
526
- this.helperProportions.width - this.margins.left,
527
- $( window ).scrollTop() +
528
- ( $( window ).height() || document.body.parentNode.scrollHeight ) -
529
- this.helperProportions.height - this.margins.top
530
- ];
531
- return;
532
- }
533
-
534
- if ( o.containment === "document" ) {
535
- this.containment = [
536
- 0,
537
- 0,
538
- $( document ).width() - this.helperProportions.width - this.margins.left,
539
- ( $( document ).height() || document.body.parentNode.scrollHeight ) -
540
- this.helperProportions.height - this.margins.top
541
- ];
542
- return;
543
- }
544
-
545
- if ( o.containment.constructor === Array ) {
546
- this.containment = o.containment;
547
- return;
548
- }
549
-
550
- if ( o.containment === "parent" ) {
551
- o.containment = this.helper[ 0 ].parentNode;
552
- }
553
-
554
- c = $( o.containment );
555
- ce = c[ 0 ];
556
-
557
- if ( !ce ) {
558
- return;
559
- }
560
-
561
- isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) );
562
-
563
- this.containment = [
564
- ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) +
565
- ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),
566
- ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) +
567
- ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ),
568
- ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
569
- ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) -
570
- ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) -
571
- this.helperProportions.width -
572
- this.margins.left -
573
- this.margins.right,
574
- ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
575
- ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) -
576
- ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) -
577
- this.helperProportions.height -
578
- this.margins.top -
579
- this.margins.bottom
580
- ];
581
- this.relativeContainer = c;
582
- },
583
-
584
- _convertPositionTo: function( d, pos ) {
585
-
586
- if ( !pos ) {
587
- pos = this.position;
588
- }
589
-
590
- var mod = d === "absolute" ? 1 : -1,
591
- scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
592
-
593
- return {
594
- top: (
595
-
596
- // The absolute mouse position
597
- pos.top +
598
-
599
- // Only for relative positioned nodes: Relative offset from element to offset parent
600
- this.offset.relative.top * mod +
601
-
602
- // The offsetParent's offset without borders (offset + border)
603
- this.offset.parent.top * mod -
604
- ( ( this.cssPosition === "fixed" ?
605
- -this.offset.scroll.top :
606
- ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod )
607
- ),
608
- left: (
609
-
610
- // The absolute mouse position
611
- pos.left +
612
-
613
- // Only for relative positioned nodes: Relative offset from element to offset parent
614
- this.offset.relative.left * mod +
615
-
616
- // The offsetParent's offset without borders (offset + border)
617
- this.offset.parent.left * mod -
618
- ( ( this.cssPosition === "fixed" ?
619
- -this.offset.scroll.left :
620
- ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod )
621
- )
622
- };
623
-
624
- },
625
-
626
- _generatePosition: function( event, constrainPosition ) {
627
-
628
- var containment, co, top, left,
629
- o = this.options,
630
- scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ),
631
- pageX = event.pageX,
632
- pageY = event.pageY;
633
-
634
- // Cache the scroll
635
- if ( !scrollIsRootNode || !this.offset.scroll ) {
636
- this.offset.scroll = {
637
- top: this.scrollParent.scrollTop(),
638
- left: this.scrollParent.scrollLeft()
639
- };
640
- }
641
-
642
- /*
643
- * - Position constraining -
644
- * Constrain the position to a mix of grid, containment.
645
- */
646
-
647
- // If we are not dragging yet, we won't check for options
648
- if ( constrainPosition ) {
649
- if ( this.containment ) {
650
- if ( this.relativeContainer ) {
651
- co = this.relativeContainer.offset();
652
- containment = [
653
- this.containment[ 0 ] + co.left,
654
- this.containment[ 1 ] + co.top,
655
- this.containment[ 2 ] + co.left,
656
- this.containment[ 3 ] + co.top
657
- ];
658
- } else {
659
- containment = this.containment;
660
- }
661
-
662
- if ( event.pageX - this.offset.click.left < containment[ 0 ] ) {
663
- pageX = containment[ 0 ] + this.offset.click.left;
664
- }
665
- if ( event.pageY - this.offset.click.top < containment[ 1 ] ) {
666
- pageY = containment[ 1 ] + this.offset.click.top;
667
- }
668
- if ( event.pageX - this.offset.click.left > containment[ 2 ] ) {
669
- pageX = containment[ 2 ] + this.offset.click.left;
670
- }
671
- if ( event.pageY - this.offset.click.top > containment[ 3 ] ) {
672
- pageY = containment[ 3 ] + this.offset.click.top;
673
- }
674
- }
675
-
676
- if ( o.grid ) {
677
-
678
- //Check for grid elements set to 0 to prevent divide by 0 error causing invalid
679
- // argument errors in IE (see ticket #6950)
680
- top = o.grid[ 1 ] ? this.originalPageY + Math.round( ( pageY -
681
- this.originalPageY ) / o.grid[ 1 ] ) * o.grid[ 1 ] : this.originalPageY;
682
- pageY = containment ? ( ( top - this.offset.click.top >= containment[ 1 ] ||
683
- top - this.offset.click.top > containment[ 3 ] ) ?
684
- top :
685
- ( ( top - this.offset.click.top >= containment[ 1 ] ) ?
686
- top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : top;
687
-
688
- left = o.grid[ 0 ] ? this.originalPageX +
689
- Math.round( ( pageX - this.originalPageX ) / o.grid[ 0 ] ) * o.grid[ 0 ] :
690
- this.originalPageX;
691
- pageX = containment ? ( ( left - this.offset.click.left >= containment[ 0 ] ||
692
- left - this.offset.click.left > containment[ 2 ] ) ?
693
- left :
694
- ( ( left - this.offset.click.left >= containment[ 0 ] ) ?
695
- left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : left;
696
- }
697
-
698
- if ( o.axis === "y" ) {
699
- pageX = this.originalPageX;
700
- }
701
-
702
- if ( o.axis === "x" ) {
703
- pageY = this.originalPageY;
704
- }
705
- }
706
-
707
- return {
708
- top: (
709
-
710
- // The absolute mouse position
711
- pageY -
712
-
713
- // Click offset (relative to the element)
714
- this.offset.click.top -
715
-
716
- // Only for relative positioned nodes: Relative offset from element to offset parent
717
- this.offset.relative.top -
718
-
719
- // The offsetParent's offset without borders (offset + border)
720
- this.offset.parent.top +
721
- ( this.cssPosition === "fixed" ?
722
- -this.offset.scroll.top :
723
- ( scrollIsRootNode ? 0 : this.offset.scroll.top ) )
724
- ),
725
- left: (
726
-
727
- // The absolute mouse position
728
- pageX -
729
-
730
- // Click offset (relative to the element)
731
- this.offset.click.left -
732
-
733
- // Only for relative positioned nodes: Relative offset from element to offset parent
734
- this.offset.relative.left -
735
-
736
- // The offsetParent's offset without borders (offset + border)
737
- this.offset.parent.left +
738
- ( this.cssPosition === "fixed" ?
739
- -this.offset.scroll.left :
740
- ( scrollIsRootNode ? 0 : this.offset.scroll.left ) )
741
- )
742
- };
743
-
744
- },
745
-
746
- _clear: function() {
747
- this._removeClass( this.helper, "ui-draggable-dragging" );
748
- if ( this.helper[ 0 ] !== this.element[ 0 ] && !this.cancelHelperRemoval ) {
749
- this.helper.remove();
750
- }
751
- this.helper = null;
752
- this.cancelHelperRemoval = false;
753
- if ( this.destroyOnClear ) {
754
- this.destroy();
755
- }
756
- },
757
-
758
- // From now on bulk stuff - mainly helpers
759
-
760
- _trigger: function( type, event, ui ) {
761
- ui = ui || this._uiHash();
762
- $.ui.plugin.call( this, type, [ event, ui, this ], true );
763
-
764
- // Absolute position and offset (see #6884 ) have to be recalculated after plugins
765
- if ( /^(drag|start|stop)/.test( type ) ) {
766
- this.positionAbs = this._convertPositionTo( "absolute" );
767
- ui.offset = this.positionAbs;
768
- }
769
- return $.Widget.prototype._trigger.call( this, type, event, ui );
770
- },
771
-
772
- plugins: {},
773
-
774
- _uiHash: function() {
775
- return {
776
- helper: this.helper,
777
- position: this.position,
778
- originalPosition: this.originalPosition,
779
- offset: this.positionAbs
780
- };
781
- }
782
-
783
- } );
784
-
785
- $.ui.plugin.add( "draggable", "connectToSortable", {
786
- start: function( event, ui, draggable ) {
787
- var uiSortable = $.extend( {}, ui, {
788
- item: draggable.element
789
- } );
790
-
791
- draggable.sortables = [];
792
- $( draggable.options.connectToSortable ).each( function() {
793
- var sortable = $( this ).sortable( "instance" );
794
-
795
- if ( sortable && !sortable.options.disabled ) {
796
- draggable.sortables.push( sortable );
797
-
798
- // RefreshPositions is called at drag start to refresh the containerCache
799
- // which is used in drag. This ensures it's initialized and synchronized
800
- // with any changes that might have happened on the page since initialization.
801
- sortable.refreshPositions();
802
- sortable._trigger( "activate", event, uiSortable );
803
- }
804
- } );
805
- },
806
- stop: function( event, ui, draggable ) {
807
- var uiSortable = $.extend( {}, ui, {
808
- item: draggable.element
809
- } );
810
-
811
- draggable.cancelHelperRemoval = false;
812
-
813
- $.each( draggable.sortables, function() {
814
- var sortable = this;
815
-
816
- if ( sortable.isOver ) {
817
- sortable.isOver = 0;
818
-
819
- // Allow this sortable to handle removing the helper
820
- draggable.cancelHelperRemoval = true;
821
- sortable.cancelHelperRemoval = false;
822
-
823
- // Use _storedCSS To restore properties in the sortable,
824
- // as this also handles revert (#9675) since the draggable
825
- // may have modified them in unexpected ways (#8809)
826
- sortable._storedCSS = {
827
- position: sortable.placeholder.css( "position" ),
828
- top: sortable.placeholder.css( "top" ),
829
- left: sortable.placeholder.css( "left" )
830
- };
831
-
832
- sortable._mouseStop( event );
833
-
834
- // Once drag has ended, the sortable should return to using
835
- // its original helper, not the shared helper from draggable
836
- sortable.options.helper = sortable.options._helper;
837
- } else {
838
-
839
- // Prevent this Sortable from removing the helper.
840
- // However, don't set the draggable to remove the helper
841
- // either as another connected Sortable may yet handle the removal.
842
- sortable.cancelHelperRemoval = true;
843
-
844
- sortable._trigger( "deactivate", event, uiSortable );
845
- }
846
- } );
847
- },
848
- drag: function( event, ui, draggable ) {
849
- $.each( draggable.sortables, function() {
850
- var innermostIntersecting = false,
851
- sortable = this;
852
-
853
- // Copy over variables that sortable's _intersectsWith uses
854
- sortable.positionAbs = draggable.positionAbs;
855
- sortable.helperProportions = draggable.helperProportions;
856
- sortable.offset.click = draggable.offset.click;
857
-
858
- if ( sortable._intersectsWith( sortable.containerCache ) ) {
859
- innermostIntersecting = true;
860
-
861
- $.each( draggable.sortables, function() {
862
-
863
- // Copy over variables that sortable's _intersectsWith uses
864
- this.positionAbs = draggable.positionAbs;
865
- this.helperProportions = draggable.helperProportions;
866
- this.offset.click = draggable.offset.click;
867
-
868
- if ( this !== sortable &&
869
- this._intersectsWith( this.containerCache ) &&
870
- $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) {
871
- innermostIntersecting = false;
872
- }
873
-
874
- return innermostIntersecting;
875
- } );
876
- }
877
-
878
- if ( innermostIntersecting ) {
879
-
880
- // If it intersects, we use a little isOver variable and set it once,
881
- // so that the move-in stuff gets fired only once.
882
- if ( !sortable.isOver ) {
883
- sortable.isOver = 1;
884
-
885
- // Store draggable's parent in case we need to reappend to it later.
886
- draggable._parent = ui.helper.parent();
887
-
888
- sortable.currentItem = ui.helper
889
- .appendTo( sortable.element )
890
- .data( "ui-sortable-item", true );
891
-
892
- // Store helper option to later restore it
893
- sortable.options._helper = sortable.options.helper;
894
-
895
- sortable.options.helper = function() {
896
- return ui.helper[ 0 ];
897
- };
898
-
899
- // Fire the start events of the sortable with our passed browser event,
900
- // and our own helper (so it doesn't create a new one)
901
- event.target = sortable.currentItem[ 0 ];
902
- sortable._mouseCapture( event, true );
903
- sortable._mouseStart( event, true, true );
904
-
905
- // Because the browser event is way off the new appended portlet,
906
- // modify necessary variables to reflect the changes
907
- sortable.offset.click.top = draggable.offset.click.top;
908
- sortable.offset.click.left = draggable.offset.click.left;
909
- sortable.offset.parent.left -= draggable.offset.parent.left -
910
- sortable.offset.parent.left;
911
- sortable.offset.parent.top -= draggable.offset.parent.top -
912
- sortable.offset.parent.top;
913
-
914
- draggable._trigger( "toSortable", event );
915
-
916
- // Inform draggable that the helper is in a valid drop zone,
917
- // used solely in the revert option to handle "valid/invalid".
918
- draggable.dropped = sortable.element;
919
-
920
- // Need to refreshPositions of all sortables in the case that
921
- // adding to one sortable changes the location of the other sortables (#9675)
922
- $.each( draggable.sortables, function() {
923
- this.refreshPositions();
924
- } );
925
-
926
- // Hack so receive/update callbacks work (mostly)
927
- draggable.currentItem = draggable.element;
928
- sortable.fromOutside = draggable;
929
- }
930
-
931
- if ( sortable.currentItem ) {
932
- sortable._mouseDrag( event );
933
-
934
- // Copy the sortable's position because the draggable's can potentially reflect
935
- // a relative position, while sortable is always absolute, which the dragged
936
- // element has now become. (#8809)
937
- ui.position = sortable.position;
938
- }
939
- } else {
940
-
941
- // If it doesn't intersect with the sortable, and it intersected before,
942
- // we fake the drag stop of the sortable, but make sure it doesn't remove
943
- // the helper by using cancelHelperRemoval.
944
- if ( sortable.isOver ) {
945
-
946
- sortable.isOver = 0;
947
- sortable.cancelHelperRemoval = true;
948
-
949
- // Calling sortable's mouseStop would trigger a revert,
950
- // so revert must be temporarily false until after mouseStop is called.
951
- sortable.options._revert = sortable.options.revert;
952
- sortable.options.revert = false;
953
-
954
- sortable._trigger( "out", event, sortable._uiHash( sortable ) );
955
- sortable._mouseStop( event, true );
956
-
957
- // Restore sortable behaviors that were modfied
958
- // when the draggable entered the sortable area (#9481)
959
- sortable.options.revert = sortable.options._revert;
960
- sortable.options.helper = sortable.options._helper;
961
-
962
- if ( sortable.placeholder ) {
963
- sortable.placeholder.remove();
964
- }
965
-
966
- // Restore and recalculate the draggable's offset considering the sortable
967
- // may have modified them in unexpected ways. (#8809, #10669)
968
- ui.helper.appendTo( draggable._parent );
969
- draggable._refreshOffsets( event );
970
- ui.position = draggable._generatePosition( event, true );
971
-
972
- draggable._trigger( "fromSortable", event );
973
-
974
- // Inform draggable that the helper is no longer in a valid drop zone
975
- draggable.dropped = false;
976
-
977
- // Need to refreshPositions of all sortables just in case removing
978
- // from one sortable changes the location of other sortables (#9675)
979
- $.each( draggable.sortables, function() {
980
- this.refreshPositions();
981
- } );
982
- }
983
- }
984
- } );
985
- }
986
- } );
987
-
988
- $.ui.plugin.add( "draggable", "cursor", {
989
- start: function( event, ui, instance ) {
990
- var t = $( "body" ),
991
- o = instance.options;
992
-
993
- if ( t.css( "cursor" ) ) {
994
- o._cursor = t.css( "cursor" );
995
- }
996
- t.css( "cursor", o.cursor );
997
- },
998
- stop: function( event, ui, instance ) {
999
- var o = instance.options;
1000
- if ( o._cursor ) {
1001
- $( "body" ).css( "cursor", o._cursor );
1002
- }
1003
- }
1004
- } );
1005
-
1006
- $.ui.plugin.add( "draggable", "opacity", {
1007
- start: function( event, ui, instance ) {
1008
- var t = $( ui.helper ),
1009
- o = instance.options;
1010
- if ( t.css( "opacity" ) ) {
1011
- o._opacity = t.css( "opacity" );
1012
- }
1013
- t.css( "opacity", o.opacity );
1014
- },
1015
- stop: function( event, ui, instance ) {
1016
- var o = instance.options;
1017
- if ( o._opacity ) {
1018
- $( ui.helper ).css( "opacity", o._opacity );
1019
- }
1020
- }
1021
- } );
1022
-
1023
- $.ui.plugin.add( "draggable", "scroll", {
1024
- start: function( event, ui, i ) {
1025
- if ( !i.scrollParentNotHidden ) {
1026
- i.scrollParentNotHidden = i.helper.scrollParent( false );
1027
- }
1028
-
1029
- if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] &&
1030
- i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) {
1031
- i.overflowOffset = i.scrollParentNotHidden.offset();
1032
- }
1033
- },
1034
- drag: function( event, ui, i ) {
1035
-
1036
- var o = i.options,
1037
- scrolled = false,
1038
- scrollParent = i.scrollParentNotHidden[ 0 ],
1039
- document = i.document[ 0 ];
1040
-
1041
- if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) {
1042
- if ( !o.axis || o.axis !== "x" ) {
1043
- if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY <
1044
- o.scrollSensitivity ) {
1045
- scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed;
1046
- } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) {
1047
- scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed;
1048
- }
1049
- }
1050
-
1051
- if ( !o.axis || o.axis !== "y" ) {
1052
- if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX <
1053
- o.scrollSensitivity ) {
1054
- scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed;
1055
- } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) {
1056
- scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed;
1057
- }
1058
- }
1059
-
1060
- } else {
1061
-
1062
- if ( !o.axis || o.axis !== "x" ) {
1063
- if ( event.pageY - $( document ).scrollTop() < o.scrollSensitivity ) {
1064
- scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed );
1065
- } else if ( $( window ).height() - ( event.pageY - $( document ).scrollTop() ) <
1066
- o.scrollSensitivity ) {
1067
- scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed );
1068
- }
1069
- }
1070
-
1071
- if ( !o.axis || o.axis !== "y" ) {
1072
- if ( event.pageX - $( document ).scrollLeft() < o.scrollSensitivity ) {
1073
- scrolled = $( document ).scrollLeft(
1074
- $( document ).scrollLeft() - o.scrollSpeed
1075
- );
1076
- } else if ( $( window ).width() - ( event.pageX - $( document ).scrollLeft() ) <
1077
- o.scrollSensitivity ) {
1078
- scrolled = $( document ).scrollLeft(
1079
- $( document ).scrollLeft() + o.scrollSpeed
1080
- );
1081
- }
1082
- }
1083
-
1084
- }
1085
-
1086
- if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) {
1087
- $.ui.ddmanager.prepareOffsets( i, event );
1088
- }
1089
-
1090
- }
1091
- } );
1092
-
1093
- $.ui.plugin.add( "draggable", "snap", {
1094
- start: function( event, ui, i ) {
1095
-
1096
- var o = i.options;
1097
-
1098
- i.snapElements = [];
1099
-
1100
- $( o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap )
1101
- .each( function() {
1102
- var $t = $( this ),
1103
- $o = $t.offset();
1104
- if ( this !== i.element[ 0 ] ) {
1105
- i.snapElements.push( {
1106
- item: this,
1107
- width: $t.outerWidth(), height: $t.outerHeight(),
1108
- top: $o.top, left: $o.left
1109
- } );
1110
- }
1111
- } );
1112
-
1113
- },
1114
- drag: function( event, ui, inst ) {
1115
-
1116
- var ts, bs, ls, rs, l, r, t, b, i, first,
1117
- o = inst.options,
1118
- d = o.snapTolerance,
1119
- x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
1120
- y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
1121
-
1122
- for ( i = inst.snapElements.length - 1; i >= 0; i-- ) {
1123
-
1124
- l = inst.snapElements[ i ].left - inst.margins.left;
1125
- r = l + inst.snapElements[ i ].width;
1126
- t = inst.snapElements[ i ].top - inst.margins.top;
1127
- b = t + inst.snapElements[ i ].height;
1128
-
1129
- if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d ||
1130
- !$.contains( inst.snapElements[ i ].item.ownerDocument,
1131
- inst.snapElements[ i ].item ) ) {
1132
- if ( inst.snapElements[ i ].snapping ) {
1133
- if ( inst.options.snap.release ) {
1134
- inst.options.snap.release.call(
1135
- inst.element,
1136
- event,
1137
- $.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } )
1138
- );
1139
- }
1140
- }
1141
- inst.snapElements[ i ].snapping = false;
1142
- continue;
1143
- }
1144
-
1145
- if ( o.snapMode !== "inner" ) {
1146
- ts = Math.abs( t - y2 ) <= d;
1147
- bs = Math.abs( b - y1 ) <= d;
1148
- ls = Math.abs( l - x2 ) <= d;
1149
- rs = Math.abs( r - x1 ) <= d;
1150
- if ( ts ) {
1151
- ui.position.top = inst._convertPositionTo( "relative", {
1152
- top: t - inst.helperProportions.height,
1153
- left: 0
1154
- } ).top;
1155
- }
1156
- if ( bs ) {
1157
- ui.position.top = inst._convertPositionTo( "relative", {
1158
- top: b,
1159
- left: 0
1160
- } ).top;
1161
- }
1162
- if ( ls ) {
1163
- ui.position.left = inst._convertPositionTo( "relative", {
1164
- top: 0,
1165
- left: l - inst.helperProportions.width
1166
- } ).left;
1167
- }
1168
- if ( rs ) {
1169
- ui.position.left = inst._convertPositionTo( "relative", {
1170
- top: 0,
1171
- left: r
1172
- } ).left;
1173
- }
1174
- }
1175
-
1176
- first = ( ts || bs || ls || rs );
1177
-
1178
- if ( o.snapMode !== "outer" ) {
1179
- ts = Math.abs( t - y1 ) <= d;
1180
- bs = Math.abs( b - y2 ) <= d;
1181
- ls = Math.abs( l - x1 ) <= d;
1182
- rs = Math.abs( r - x2 ) <= d;
1183
- if ( ts ) {
1184
- ui.position.top = inst._convertPositionTo( "relative", {
1185
- top: t,
1186
- left: 0
1187
- } ).top;
1188
- }
1189
- if ( bs ) {
1190
- ui.position.top = inst._convertPositionTo( "relative", {
1191
- top: b - inst.helperProportions.height,
1192
- left: 0
1193
- } ).top;
1194
- }
1195
- if ( ls ) {
1196
- ui.position.left = inst._convertPositionTo( "relative", {
1197
- top: 0,
1198
- left: l
1199
- } ).left;
1200
- }
1201
- if ( rs ) {
1202
- ui.position.left = inst._convertPositionTo( "relative", {
1203
- top: 0,
1204
- left: r - inst.helperProportions.width
1205
- } ).left;
1206
- }
1207
- }
1208
-
1209
- if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) {
1210
- if ( inst.options.snap.snap ) {
1211
- inst.options.snap.snap.call(
1212
- inst.element,
1213
- event,
1214
- $.extend( inst._uiHash(), {
1215
- snapItem: inst.snapElements[ i ].item
1216
- } ) );
1217
- }
1218
- }
1219
- inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first );
1220
-
1221
- }
1222
-
1223
- }
1224
- } );
1225
-
1226
- $.ui.plugin.add( "draggable", "stack", {
1227
- start: function( event, ui, instance ) {
1228
- var min,
1229
- o = instance.options,
1230
- group = $.makeArray( $( o.stack ) ).sort( function( a, b ) {
1231
- return ( parseInt( $( a ).css( "zIndex" ), 10 ) || 0 ) -
1232
- ( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 );
1233
- } );
1234
-
1235
- if ( !group.length ) {
1236
- return;
1237
- }
1238
-
1239
- min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0;
1240
- $( group ).each( function( i ) {
1241
- $( this ).css( "zIndex", min + i );
1242
- } );
1243
- this.css( "zIndex", ( min + group.length ) );
1244
- }
1245
- } );
1246
-
1247
- $.ui.plugin.add( "draggable", "zIndex", {
1248
- start: function( event, ui, instance ) {
1249
- var t = $( ui.helper ),
1250
- o = instance.options;
1251
-
1252
- if ( t.css( "zIndex" ) ) {
1253
- o._zIndex = t.css( "zIndex" );
1254
- }
1255
- t.css( "zIndex", o.zIndex );
1256
- },
1257
- stop: function( event, ui, instance ) {
1258
- var o = instance.options;
1259
-
1260
- if ( o._zIndex ) {
1261
- $( ui.helper ).css( "zIndex", o._zIndex );
1262
- }
1263
- }
1264
- } );
1265
-
1266
- return $.ui.draggable;
1267
-
1268
- } );