alchemy_cms 5.3.1 → 6.0.0.b1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (295) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +6 -14
  3. data/.gitignore +1 -1
  4. data/.hound.yml +1 -1
  5. data/.rubocop.yml +46 -4
  6. data/CHANGELOG.md +80 -52
  7. data/Gemfile +4 -2
  8. data/README.md +5 -2
  9. data/Rakefile +0 -18
  10. data/alchemy_cms.gemspec +78 -65
  11. data/app/assets/javascripts/alchemy/admin.js +2 -2
  12. data/app/assets/javascripts/alchemy/alchemy.base.js.coffee +0 -27
  13. data/app/assets/javascripts/alchemy/alchemy.confirm_dialog.js.coffee +2 -1
  14. data/app/assets/javascripts/alchemy/alchemy.dialog.js.coffee +2 -7
  15. data/app/assets/javascripts/alchemy/alchemy.dragndrop.js.coffee +0 -25
  16. data/app/assets/javascripts/alchemy/alchemy.element_editors.js.coffee +1 -1
  17. data/app/assets/javascripts/alchemy/alchemy.elements_window.js.coffee +2 -0
  18. data/app/assets/javascripts/alchemy/alchemy.fixed_elements.js +1 -1
  19. data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +3 -1
  20. data/app/assets/javascripts/alchemy/alchemy.image_overlay.coffee +1 -1
  21. data/app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee +40 -27
  22. data/app/assets/javascripts/alchemy/alchemy.page_sorter.js +24 -0
  23. data/app/assets/javascripts/alchemy/alchemy.sitemap.js.coffee +119 -0
  24. data/app/assets/javascripts/alchemy/page_select.js +8 -13
  25. data/app/assets/javascripts/alchemy/templates/index.js +0 -1
  26. data/app/assets/javascripts/alchemy/templates/node_folder.hbs +1 -1
  27. data/app/assets/javascripts/alchemy/templates/page.hbs +7 -17
  28. data/app/assets/stylesheets/alchemy/admin.scss +1 -1
  29. data/app/assets/stylesheets/alchemy/archive.scss +4 -4
  30. data/app/assets/stylesheets/alchemy/buttons.scss +0 -4
  31. data/app/assets/stylesheets/alchemy/elements.scss +73 -61
  32. data/app/assets/stylesheets/alchemy/images.scss +8 -0
  33. data/app/assets/stylesheets/alchemy/node-select.scss +4 -3
  34. data/app/assets/stylesheets/alchemy/page-select.scss +5 -29
  35. data/app/assets/stylesheets/alchemy/sitemap.scss +7 -9
  36. data/app/assets/stylesheets/tinymce/skins/alchemy/content.min.css.scss +3 -3
  37. data/app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss +7 -7
  38. data/app/controllers/alchemy/admin/attachments_controller.rb +6 -2
  39. data/app/controllers/alchemy/admin/base_controller.rb +8 -16
  40. data/app/controllers/alchemy/admin/elements_controller.rb +58 -34
  41. data/app/controllers/alchemy/admin/essence_audios_controller.rb +30 -0
  42. data/app/controllers/alchemy/admin/essence_files_controller.rb +0 -14
  43. data/app/controllers/alchemy/admin/essence_pictures_controller.rb +8 -79
  44. data/app/controllers/alchemy/admin/essence_videos_controller.rb +33 -0
  45. data/app/controllers/alchemy/admin/ingredients_controller.rb +30 -0
  46. data/app/controllers/alchemy/admin/layoutpages_controller.rb +0 -1
  47. data/app/controllers/alchemy/admin/pages_controller.rb +19 -23
  48. data/app/controllers/alchemy/admin/pictures_controller.rb +35 -9
  49. data/app/controllers/alchemy/api/elements_controller.rb +10 -5
  50. data/app/controllers/alchemy/api/pages_controller.rb +3 -15
  51. data/app/controllers/concerns/alchemy/admin/archive_overlay.rb +13 -3
  52. data/app/controllers/concerns/alchemy/admin/crop_action.rb +26 -0
  53. data/app/decorators/alchemy/element_editor.rb +23 -1
  54. data/app/decorators/alchemy/ingredient_editor.rb +154 -0
  55. data/app/helpers/alchemy/admin/elements_helper.rb +1 -0
  56. data/app/helpers/alchemy/admin/essences_helper.rb +1 -1
  57. data/app/helpers/alchemy/admin/ingredients_helper.rb +42 -0
  58. data/app/helpers/alchemy/elements_block_helper.rb +22 -7
  59. data/app/helpers/alchemy/elements_helper.rb +12 -5
  60. data/app/helpers/alchemy/pages_helper.rb +3 -11
  61. data/app/jobs/alchemy/base_job.rb +11 -0
  62. data/app/jobs/alchemy/publish_page_job.rb +11 -0
  63. data/app/models/alchemy/attachment.rb +1 -1
  64. data/app/models/alchemy/content/factory.rb +23 -27
  65. data/app/models/alchemy/content.rb +1 -6
  66. data/app/models/alchemy/element/definitions.rb +29 -27
  67. data/app/models/alchemy/element/element_contents.rb +131 -122
  68. data/app/models/alchemy/element/element_essences.rb +100 -98
  69. data/app/models/alchemy/element/element_ingredients.rb +176 -0
  70. data/app/models/alchemy/element/presenters.rb +89 -87
  71. data/app/models/alchemy/element.rb +40 -73
  72. data/app/models/alchemy/elements_repository.rb +126 -0
  73. data/app/models/alchemy/essence_audio.rb +12 -0
  74. data/app/models/alchemy/essence_headline.rb +40 -0
  75. data/app/models/alchemy/essence_picture.rb +4 -116
  76. data/app/models/alchemy/essence_richtext.rb +12 -0
  77. data/app/models/alchemy/essence_video.rb +12 -0
  78. data/app/models/alchemy/image_cropper_settings.rb +87 -0
  79. data/app/models/alchemy/ingredient.rb +219 -0
  80. data/app/models/alchemy/ingredient_validator.rb +97 -0
  81. data/app/models/alchemy/ingredients/audio.rb +29 -0
  82. data/app/models/alchemy/ingredients/boolean.rb +21 -0
  83. data/app/models/alchemy/ingredients/datetime.rb +20 -0
  84. data/app/models/alchemy/ingredients/file.rb +30 -0
  85. data/app/models/alchemy/ingredients/headline.rb +42 -0
  86. data/app/models/alchemy/ingredients/html.rb +19 -0
  87. data/app/models/alchemy/ingredients/link.rb +16 -0
  88. data/app/models/alchemy/ingredients/node.rb +23 -0
  89. data/app/models/alchemy/ingredients/page.rb +23 -0
  90. data/app/models/alchemy/ingredients/picture.rb +41 -0
  91. data/app/models/alchemy/ingredients/richtext.rb +57 -0
  92. data/app/models/alchemy/ingredients/select.rb +10 -0
  93. data/app/models/alchemy/ingredients/text.rb +17 -0
  94. data/app/models/alchemy/ingredients/video.rb +33 -0
  95. data/app/models/alchemy/language.rb +0 -11
  96. data/app/models/alchemy/node.rb +1 -1
  97. data/app/models/alchemy/page/fixed_attributes.rb +53 -51
  98. data/app/models/alchemy/page/page_elements.rb +186 -205
  99. data/app/models/alchemy/page/page_naming.rb +66 -64
  100. data/app/models/alchemy/page/page_natures.rb +139 -142
  101. data/app/models/alchemy/page/page_scopes.rb +113 -102
  102. data/app/models/alchemy/page/publisher.rb +50 -0
  103. data/app/models/alchemy/page/url_path.rb +1 -1
  104. data/app/models/alchemy/page.rb +69 -36
  105. data/app/models/alchemy/page_version.rb +58 -0
  106. data/app/models/alchemy/picture/calculations.rb +2 -8
  107. data/app/models/alchemy/picture/preprocessor.rb +2 -0
  108. data/app/models/alchemy/picture/transformations.rb +21 -93
  109. data/app/models/alchemy/picture.rb +4 -2
  110. data/app/models/concerns/alchemy/picture_thumbnails.rb +181 -0
  111. data/app/models/concerns/alchemy/touch_elements.rb +2 -2
  112. data/app/presenters/alchemy/picture_view.rb +88 -0
  113. data/app/serializers/alchemy/element_serializer.rb +5 -0
  114. data/app/serializers/alchemy/page_serializer.rb +1 -7
  115. data/app/serializers/alchemy/page_tree_serializer.rb +6 -5
  116. data/app/services/alchemy/delete_elements.rb +44 -0
  117. data/app/services/alchemy/duplicate_element.rb +56 -0
  118. data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +1 -2
  119. data/app/views/alchemy/admin/attachments/_file_to_assign.html.erb +3 -3
  120. data/app/views/alchemy/admin/attachments/assign.js.erb +11 -0
  121. data/app/views/alchemy/admin/crop.html.erb +36 -0
  122. data/app/views/alchemy/admin/elements/_element.html.erb +14 -10
  123. data/app/views/alchemy/admin/elements/{_element_footer.html.erb → _footer.html.erb} +0 -0
  124. data/app/views/alchemy/admin/elements/{_new_element_form.html.erb → _form.html.erb} +1 -1
  125. data/app/views/alchemy/admin/elements/{_element_header.html.erb → _header.html.erb} +1 -1
  126. data/app/views/alchemy/admin/elements/{_element_toolbar.html.erb → _toolbar.html.erb} +5 -6
  127. data/app/views/alchemy/admin/elements/{trash.js.erb → destroy.js.erb} +1 -3
  128. data/app/views/alchemy/admin/elements/new.html.erb +3 -3
  129. data/app/views/alchemy/admin/elements/order.js.erb +0 -17
  130. data/app/views/alchemy/admin/elements/update.js.erb +3 -2
  131. data/app/views/alchemy/admin/essence_audios/edit.html.erb +7 -0
  132. data/app/views/alchemy/admin/essence_pictures/update.js.erb +0 -1
  133. data/app/views/alchemy/admin/essence_videos/edit.html.erb +11 -0
  134. data/app/views/alchemy/admin/ingredients/_audio_fields.html.erb +4 -0
  135. data/app/views/alchemy/admin/ingredients/_file_fields.html.erb +18 -0
  136. data/app/views/alchemy/admin/ingredients/_picture_fields.html.erb +25 -0
  137. data/app/views/alchemy/admin/ingredients/_video_fields.html.erb +8 -0
  138. data/app/views/alchemy/admin/ingredients/edit.html.erb +4 -0
  139. data/app/views/alchemy/admin/layoutpages/edit.html.erb +0 -5
  140. data/app/views/alchemy/admin/nodes/_node.html.erb +2 -2
  141. data/app/views/alchemy/admin/pages/_anchor_link.html.erb +1 -1
  142. data/app/views/alchemy/admin/pages/_external_link.html.erb +1 -1
  143. data/app/views/alchemy/admin/pages/_file_link.html.erb +1 -1
  144. data/app/views/alchemy/admin/pages/_form.html.erb +0 -25
  145. data/app/views/alchemy/admin/pages/_internal_link.html.erb +1 -1
  146. data/app/views/alchemy/admin/pages/_new_page_form.html.erb +5 -16
  147. data/app/views/alchemy/admin/pages/_page.html.erb +133 -111
  148. data/app/views/alchemy/admin/pages/_sitemap.html.erb +16 -10
  149. data/app/views/alchemy/admin/pages/_tinymce_custom_config.html.erb +5 -2
  150. data/app/views/alchemy/admin/pages/_toolbar.html.erb +12 -0
  151. data/app/views/alchemy/admin/pages/edit.html.erb +37 -25
  152. data/app/views/alchemy/admin/pages/fold.js.erb +2 -0
  153. data/app/views/alchemy/admin/pages/index.html.erb +1 -1
  154. data/app/views/alchemy/admin/pages/sort.html.erb +19 -0
  155. data/app/views/alchemy/admin/pages/update.js.erb +0 -7
  156. data/app/views/alchemy/admin/partials/_remote_search_form.html.erb +2 -4
  157. data/app/views/alchemy/admin/partials/_routes.html.erb +8 -19
  158. data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +4 -8
  159. data/app/views/alchemy/admin/pictures/_infos.html.erb +0 -1
  160. data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +4 -4
  161. data/app/views/alchemy/admin/pictures/assign.js.erb +10 -0
  162. data/app/views/alchemy/admin/resources/_form.html.erb +1 -0
  163. data/app/views/alchemy/essences/_essence_audio_editor.html.erb +4 -0
  164. data/app/views/alchemy/essences/_essence_audio_view.html.erb +15 -0
  165. data/app/views/alchemy/essences/_essence_file_editor.html.erb +15 -6
  166. data/app/views/alchemy/essences/_essence_headline_editor.html.erb +36 -0
  167. data/app/views/alchemy/essences/_essence_headline_view.html.erb +10 -0
  168. data/app/views/alchemy/essences/_essence_link_editor.html.erb +8 -4
  169. data/app/views/alchemy/essences/_essence_page_editor.html.erb +1 -1
  170. data/app/views/alchemy/essences/_essence_picture_editor.html.erb +27 -12
  171. data/app/views/alchemy/essences/_essence_text_editor.html.erb +12 -4
  172. data/app/views/alchemy/essences/_essence_video_editor.html.erb +4 -0
  173. data/app/views/alchemy/essences/_essence_video_view.html.erb +18 -0
  174. data/app/views/alchemy/essences/shared/_essence_picture_tools.html.erb +21 -16
  175. data/app/views/alchemy/essences/shared/_linkable_essence_tools.html.erb +2 -2
  176. data/app/views/alchemy/ingredients/_audio_editor.html.erb +5 -0
  177. data/app/views/alchemy/ingredients/_audio_view.html.erb +14 -0
  178. data/app/views/alchemy/ingredients/_boolean_editor.html.erb +11 -0
  179. data/app/views/alchemy/ingredients/_boolean_view.html.erb +1 -0
  180. data/app/views/alchemy/ingredients/_datetime_editor.html.erb +17 -0
  181. data/app/views/alchemy/ingredients/_datetime_view.html.erb +9 -0
  182. data/app/views/alchemy/ingredients/_file_editor.html.erb +50 -0
  183. data/app/views/alchemy/ingredients/_file_view.html.erb +17 -0
  184. data/app/views/alchemy/ingredients/_headline_editor.html.erb +30 -0
  185. data/app/views/alchemy/ingredients/_headline_view.html.erb +9 -0
  186. data/app/views/alchemy/ingredients/_html_editor.html.erb +8 -0
  187. data/app/views/alchemy/ingredients/_html_view.html.erb +1 -0
  188. data/app/views/alchemy/ingredients/_link_editor.html.erb +24 -0
  189. data/app/views/alchemy/ingredients/_link_view.html.erb +9 -0
  190. data/app/views/alchemy/ingredients/_node_editor.html.erb +25 -0
  191. data/app/views/alchemy/ingredients/_node_view.html.erb +1 -0
  192. data/app/views/alchemy/ingredients/_page_editor.html.erb +24 -0
  193. data/app/views/alchemy/ingredients/_page_view.html.erb +4 -0
  194. data/app/views/alchemy/ingredients/_picture_editor.html.erb +59 -0
  195. data/app/views/alchemy/ingredients/_picture_view.html.erb +5 -0
  196. data/app/views/alchemy/ingredients/_richtext_editor.html.erb +12 -0
  197. data/app/views/alchemy/ingredients/_richtext_view.html.erb +3 -0
  198. data/app/views/alchemy/ingredients/_select_editor.html.erb +29 -0
  199. data/app/views/alchemy/ingredients/_select_view.html.erb +1 -0
  200. data/app/views/alchemy/ingredients/_text_editor.html.erb +19 -0
  201. data/app/views/alchemy/ingredients/_text_view.html.erb +16 -0
  202. data/app/views/alchemy/ingredients/_video_editor.html.erb +5 -0
  203. data/app/views/alchemy/ingredients/_video_view.html.erb +17 -0
  204. data/app/views/alchemy/ingredients/shared/_link_tools.html.erb +20 -0
  205. data/app/views/alchemy/ingredients/shared/_picture_tools.html.erb +57 -0
  206. data/config/brakeman.ignore +66 -159
  207. data/config/initializers/dragonfly.rb +2 -0
  208. data/config/locales/alchemy.en.yml +26 -15
  209. data/config/routes.rb +19 -26
  210. data/db/migrate/20201207131309_create_page_versions.rb +19 -0
  211. data/db/migrate/20201207135820_add_page_version_id_to_alchemy_elements.rb +76 -0
  212. data/db/migrate/20210205143548_rename_public_on_and_public_until_on_alchemy_pages.rb +10 -0
  213. data/db/migrate/20210326105046_add_sanitized_body_to_alchemy_essence_richtexts.rb +7 -0
  214. data/db/migrate/20210406093436_add_alchemy_essence_headlines.rb +12 -0
  215. data/db/migrate/20210506135919_create_essence_audios.rb +19 -0
  216. data/db/migrate/20210506140258_create_essence_videos.rb +23 -0
  217. data/db/migrate/20210508091432_create_alchemy_ingredients.rb +22 -0
  218. data/lib/alchemy/admin/preview_url.rb +2 -0
  219. data/lib/alchemy/deprecation.rb +1 -1
  220. data/lib/alchemy/dragonfly/processors/auto_orient.rb +18 -0
  221. data/lib/alchemy/elements_finder.rb +14 -60
  222. data/lib/alchemy/engine.rb +1 -8
  223. data/lib/alchemy/essence.rb +1 -2
  224. data/lib/alchemy/hints.rb +8 -4
  225. data/lib/alchemy/page_layout.rb +0 -13
  226. data/lib/alchemy/permissions.rb +31 -29
  227. data/lib/alchemy/resource.rb +13 -3
  228. data/lib/alchemy/tasks/tidy.rb +29 -0
  229. data/lib/alchemy/test_support/essence_shared_examples.rb +0 -1
  230. data/lib/alchemy/test_support/factories/element_factory.rb +8 -8
  231. data/lib/alchemy/test_support/factories/essence_audio_factory.rb +7 -0
  232. data/lib/alchemy/test_support/factories/essence_video_factory.rb +7 -0
  233. data/lib/alchemy/test_support/factories/ingredient_factory.rb +25 -0
  234. data/lib/alchemy/test_support/factories/page_factory.rb +20 -1
  235. data/lib/alchemy/test_support/factories/page_version_factory.rb +23 -0
  236. data/lib/alchemy/test_support/having_crop_action_examples.rb +170 -0
  237. data/lib/alchemy/test_support/having_picture_thumbnails_examples.rb +646 -0
  238. data/lib/alchemy/test_support/shared_ingredient_editor_examples.rb +21 -0
  239. data/lib/alchemy/test_support/shared_ingredient_examples.rb +57 -0
  240. data/lib/alchemy/test_support.rb +2 -11
  241. data/lib/alchemy/tinymce.rb +17 -0
  242. data/lib/alchemy/upgrader/five_point_zero.rb +0 -32
  243. data/lib/alchemy/upgrader/six_point_zero.rb +21 -0
  244. data/lib/alchemy/upgrader/tasks/add_page_versions.rb +33 -0
  245. data/lib/alchemy/upgrader/tasks/ingredients_migrator.rb +51 -0
  246. data/lib/alchemy/version.rb +1 -1
  247. data/lib/alchemy_cms.rb +0 -1
  248. data/lib/generators/alchemy/elements/elements_generator.rb +1 -0
  249. data/lib/generators/alchemy/elements/templates/view.html.erb +9 -0
  250. data/lib/generators/alchemy/elements/templates/view.html.haml +9 -0
  251. data/lib/generators/alchemy/elements/templates/view.html.slim +9 -0
  252. data/lib/generators/alchemy/ingredient/ingredient_generator.rb +38 -0
  253. data/lib/generators/alchemy/ingredient/templates/editor.html.erb +14 -0
  254. data/lib/generators/alchemy/ingredient/templates/model.rb.tt +13 -0
  255. data/lib/generators/alchemy/ingredient/templates/view.html.erb +1 -0
  256. data/lib/generators/alchemy/install/install_generator.rb +1 -2
  257. data/lib/generators/alchemy/install/templates/dragonfly.rb.tt +1 -1
  258. data/lib/generators/alchemy/menus/templates/node.html.erb +1 -1
  259. data/lib/generators/alchemy/menus/templates/node.html.haml +1 -1
  260. data/lib/generators/alchemy/menus/templates/node.html.slim +1 -1
  261. data/lib/generators/alchemy/menus/templates/wrapper.html.erb +1 -1
  262. data/lib/generators/alchemy/menus/templates/wrapper.html.haml +1 -1
  263. data/lib/generators/alchemy/menus/templates/wrapper.html.slim +1 -1
  264. data/lib/tasks/alchemy/tidy.rake +12 -0
  265. data/lib/tasks/alchemy/upgrade.rake +21 -15
  266. data/package/admin.js +8 -4
  267. data/package/src/file_editors.js +28 -0
  268. data/package/src/image_cropper.js +103 -0
  269. data/package/src/image_loader.js +58 -0
  270. data/package/src/node_tree.js +5 -5
  271. data/package/src/picture_editors.js +169 -0
  272. data/package/src/utils/__tests__/ajax.spec.js +20 -12
  273. data/package/src/utils/ajax.js +8 -3
  274. data/package.json +3 -2
  275. data/vendor/assets/javascripts/jquery_plugins/jquery.Jcrop.min.js +3 -18
  276. data/vendor/assets/javascripts/jquery_plugins/jquery.ui.nestedSortable.js +434 -0
  277. data/vendor/assets/stylesheets/jquery.Jcrop.min.scss +2 -28
  278. metadata +291 -53
  279. data/.rspec +0 -1
  280. data/app/assets/javascripts/alchemy/alchemy.image_cropper.js.coffee +0 -44
  281. data/app/assets/javascripts/alchemy/alchemy.trash_window.js.coffee +0 -30
  282. data/app/assets/javascripts/alchemy/templates/page_folder.hbs +0 -3
  283. data/app/assets/stylesheets/alchemy/trash.scss +0 -8
  284. data/app/controllers/alchemy/admin/trash_controller.rb +0 -44
  285. data/app/views/alchemy/admin/essence_files/assign.js.erb +0 -3
  286. data/app/views/alchemy/admin/essence_pictures/assign.js.erb +0 -4
  287. data/app/views/alchemy/admin/essence_pictures/crop.html.erb +0 -48
  288. data/app/views/alchemy/admin/trash/clear.js.erb +0 -4
  289. data/app/views/alchemy/admin/trash/index.html.erb +0 -31
  290. data/lib/alchemy/error_tracking/airbrake_handler.rb +0 -13
  291. data/lib/alchemy/error_tracking.rb +0 -14
  292. data/lib/alchemy/test_support/factories.rb +0 -20
  293. data/package/src/page_publication_fields.js +0 -27
  294. data/package/src/page_sorter.js +0 -68
  295. data/package/src/sitemap.js +0 -152
@@ -0,0 +1,434 @@
1
+ /*
2
+ * jQuery UI Nested Sortable
3
+ * v 1.3.5 / 21 jun 2012
4
+ * http://mjsarfatti.com/code/nestedSortable
5
+ *
6
+ * Depends on:
7
+ * jquery.ui.sortable.js 1.8+
8
+ *
9
+ * Copyright (c) 2010-2012 Manuele J Sarfatti
10
+ * Licensed under the MIT License
11
+ * http://www.opensource.org/licenses/mit-license.php
12
+ */
13
+
14
+ (function($) {
15
+
16
+ $.widget("mjs.nestedSortable", $.extend({}, $.ui.sortable.prototype, {
17
+
18
+ options: {
19
+ tabSize: 20,
20
+ disableNesting: 'mjs-nestedSortable-no-nesting',
21
+ errorClass: 'mjs-nestedSortable-error',
22
+ doNotClear: false,
23
+ listType: 'ol',
24
+ maxLevels: 0,
25
+ protectRoot: false,
26
+ rootID: null,
27
+ rtl: false,
28
+ isAllowed: function(item, parent) { return true; }
29
+ },
30
+
31
+ _create: function() {
32
+ this.element.data('sortable', this.element.data('nestedSortable'));
33
+
34
+ if (!this.element.is(this.options.listType))
35
+ throw new Error('nestedSortable: Please check the listType option is set to your actual list type');
36
+
37
+ return $.ui.sortable.prototype._create.apply(this, arguments);
38
+ },
39
+
40
+ destroy: function() {
41
+ this.element
42
+ .removeData("nestedSortable")
43
+ .unbind(".nestedSortable");
44
+ return $.ui.sortable.prototype.destroy.apply(this, arguments);
45
+ },
46
+
47
+ _mouseDrag: function(event) {
48
+
49
+ //Compute the helpers position
50
+ this.position = this._generatePosition(event);
51
+ this.positionAbs = this._convertPositionTo("absolute");
52
+
53
+ if (!this.lastPositionAbs) {
54
+ this.lastPositionAbs = this.positionAbs;
55
+ }
56
+
57
+ var o = this.options;
58
+
59
+ //Do scrolling
60
+ if(this.options.scroll) {
61
+ var scrolled = false;
62
+ if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {
63
+
64
+ if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
65
+ this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
66
+ else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity)
67
+ this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
68
+
69
+ if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
70
+ this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
71
+ else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity)
72
+ this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
73
+
74
+ } else {
75
+
76
+ if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
77
+ scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
78
+ else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
79
+ scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
80
+
81
+ if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
82
+ scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
83
+ else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
84
+ scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
85
+
86
+ }
87
+
88
+ if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
89
+ $.ui.ddmanager.prepareOffsets(this, event);
90
+ }
91
+
92
+ //Regenerate the absolute position used for position checks
93
+ this.positionAbs = this._convertPositionTo("absolute");
94
+
95
+ // Find the top offset before rearrangement,
96
+ var previousTopOffset = this.placeholder.offset().top;
97
+
98
+ //Set the helper position
99
+ if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
100
+ if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
101
+
102
+ //Rearrange
103
+ for (var i = this.items.length - 1; i >= 0; i--) {
104
+
105
+ //Cache variables and intersection, continue if no intersection
106
+ var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
107
+ if (!intersection) continue;
108
+
109
+ if(itemElement != this.currentItem[0] //cannot intersect with itself
110
+ && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
111
+ && !$.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
112
+ && (this.options.type == 'semi-dynamic' ? !$.contains(this.element[0], itemElement) : true)
113
+ //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container
114
+ ) {
115
+
116
+ $(itemElement).mouseenter();
117
+
118
+ this.direction = intersection == 1 ? "down" : "up";
119
+
120
+ if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
121
+ $(itemElement).mouseleave();
122
+ this._rearrange(event, item);
123
+ } else {
124
+ break;
125
+ }
126
+
127
+ // Clear emtpy ul's/ol's
128
+ this._clearEmpty(itemElement);
129
+
130
+ this._trigger("change", event, this._uiHash());
131
+ break;
132
+ }
133
+ }
134
+
135
+ var parentItem = (this.placeholder[0].parentNode.parentNode &&
136
+ $(this.placeholder[0].parentNode.parentNode).closest('.ui-sortable').length)
137
+ ? $(this.placeholder[0].parentNode.parentNode)
138
+ : null,
139
+ level = this._getLevel(this.placeholder),
140
+ childLevels = this._getChildLevels(this.helper);
141
+
142
+ // To find the previous sibling in the list, keep backtracking until we hit a valid list item.
143
+ var previousItem = this.placeholder[0].previousSibling ? $(this.placeholder[0].previousSibling) : null;
144
+ if (previousItem != null) {
145
+ while (previousItem[0].nodeName.toLowerCase() != 'li' || previousItem[0] == this.currentItem[0] || previousItem[0] == this.helper[0]) {
146
+ if (previousItem[0].previousSibling) {
147
+ previousItem = $(previousItem[0].previousSibling);
148
+ } else {
149
+ previousItem = null;
150
+ break;
151
+ }
152
+ }
153
+ }
154
+
155
+ // To find the next sibling in the list, keep stepping forward until we hit a valid list item.
156
+ var nextItem = this.placeholder[0].nextSibling ? $(this.placeholder[0].nextSibling) : null;
157
+ if (nextItem != null) {
158
+ while (nextItem[0].nodeName.toLowerCase() != 'li' || nextItem[0] == this.currentItem[0] || nextItem[0] == this.helper[0]) {
159
+ if (nextItem[0].nextSibling) {
160
+ nextItem = $(nextItem[0].nextSibling);
161
+ } else {
162
+ nextItem = null;
163
+ break;
164
+ }
165
+ }
166
+ }
167
+
168
+ var newList = document.createElement(o.listType);
169
+
170
+ this.beyondMaxLevels = 0;
171
+
172
+ // If the item is moved to the left, send it to its parent's level unless there are siblings below it.
173
+ if (parentItem != null && nextItem == null &&
174
+ (o.rtl && (this.positionAbs.left + this.helper.outerWidth() > parentItem.offset().left + parentItem.outerWidth()) ||
175
+ !o.rtl && (this.positionAbs.left < parentItem.offset().left))) {
176
+ parentItem.after(this.placeholder[0]);
177
+ this._clearEmpty(parentItem[0]);
178
+ this._trigger("change", event, this._uiHash());
179
+ }
180
+ // If the item is below a sibling and is moved to the right, make it a child of that sibling.
181
+ else if (previousItem != null &&
182
+ (o.rtl && (this.positionAbs.left + this.helper.outerWidth() < previousItem.offset().left + previousItem.outerWidth() - o.tabSize) ||
183
+ !o.rtl && (this.positionAbs.left > previousItem.offset().left + o.tabSize))) {
184
+ this._isAllowed(previousItem, level, level+childLevels+1);
185
+ if (!previousItem.children(o.listType).length) {
186
+ previousItem[0].appendChild(newList);
187
+ }
188
+ // If this item is being moved from the top, add it to the top of the list.
189
+ if (previousTopOffset && (previousTopOffset <= previousItem.offset().top)) {
190
+ previousItem.children(o.listType).prepend(this.placeholder);
191
+ }
192
+ // Otherwise, add it to the bottom of the list.
193
+ else {
194
+ previousItem.children(o.listType)[0].appendChild(this.placeholder[0]);
195
+ }
196
+ this._trigger("change", event, this._uiHash());
197
+ }
198
+ else {
199
+ this._isAllowed(parentItem, level, level+childLevels);
200
+ }
201
+
202
+ //Post events to containers
203
+ this._contactContainers(event);
204
+
205
+ //Interconnect with droppables
206
+ if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
207
+
208
+ //Call callbacks
209
+ this._trigger('sort', event, this._uiHash());
210
+
211
+ this.lastPositionAbs = this.positionAbs;
212
+ return false;
213
+
214
+ },
215
+
216
+ _mouseStop: function(event, noPropagation) {
217
+
218
+ // If the item is in a position not allowed, send it back
219
+ if (this.beyondMaxLevels) {
220
+
221
+ this.placeholder.removeClass(this.options.errorClass);
222
+
223
+ if (this.domPosition.prev) {
224
+ $(this.domPosition.prev).after(this.placeholder);
225
+ } else {
226
+ $(this.domPosition.parent).prepend(this.placeholder);
227
+ }
228
+
229
+ this._trigger("revert", event, this._uiHash());
230
+
231
+ }
232
+
233
+ // Clean last empty ul/ol
234
+ for (var i = this.items.length - 1; i >= 0; i--) {
235
+ var item = this.items[i].item[0];
236
+ this._clearEmpty(item);
237
+ }
238
+
239
+ $.ui.sortable.prototype._mouseStop.apply(this, arguments);
240
+
241
+ },
242
+
243
+ serialize: function(options) {
244
+
245
+ var o = $.extend({}, this.options, options),
246
+ items = this._getItemsAsjQuery(o && o.connected),
247
+ str = [];
248
+
249
+ $(items).each(function() {
250
+ var res = ($(o.item || this).attr(o.attribute || 'id') || '')
251
+ .match(o.expression || (/(.+)[-=_](.+)/)),
252
+ pid = ($(o.item || this).parent(o.listType)
253
+ .parent(o.items)
254
+ .attr(o.attribute || 'id') || '')
255
+ .match(o.expression || (/(.+)[-=_](.+)/));
256
+
257
+ if (res) {
258
+ str.push(((o.key || res[1]) + '[' + (o.key && o.expression ? res[1] : res[2]) + ']')
259
+ + '='
260
+ + (pid ? (o.key && o.expression ? pid[1] : pid[2]) : o.rootID));
261
+ }
262
+ });
263
+
264
+ if(!str.length && o.key) {
265
+ str.push(o.key + '=');
266
+ }
267
+
268
+ return str.join('&');
269
+
270
+ },
271
+
272
+ toHierarchy: function(options) {
273
+
274
+ var o = $.extend({}, this.options, options),
275
+ sDepth = o.startDepthCount || 0,
276
+ ret = [];
277
+
278
+ $(this.element).children(o.items).each(function () {
279
+ var level = _recursiveItems(this);
280
+ ret.push(level);
281
+ });
282
+
283
+ return ret;
284
+
285
+ function _recursiveItems(item) {
286
+ var id = ($(item).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
287
+
288
+ var restricted = $(item).data("restricted");
289
+ var slug = $(item).data("slug");
290
+ var visible = $(item).data("visible");
291
+
292
+ if (id) {
293
+ var currentItem = {"id" : id[2], "slug" : slug, "restricted" : restricted, "visible" : visible};
294
+ if ($(item).children(o.listType).children(o.items).length > 0) {
295
+ currentItem.children = [];
296
+ $(item).children(o.listType).children(o.items).each(function() {
297
+ var level = _recursiveItems(this);
298
+ currentItem.children.push(level);
299
+ });
300
+ }
301
+ return currentItem;
302
+ }
303
+ }
304
+ },
305
+
306
+ toArray: function(options) {
307
+
308
+ var o = $.extend({}, this.options, options),
309
+ sDepth = o.startDepthCount || 0,
310
+ ret = [],
311
+ left = 2;
312
+
313
+ ret.push({
314
+ "item_id": o.rootID,
315
+ "parent_id": 'none',
316
+ "depth": sDepth,
317
+ "left": '1',
318
+ "right": ($(o.items, this.element).length + 1) * 2
319
+ });
320
+
321
+ $(this.element).children(o.items).each(function () {
322
+ left = _recursiveArray(this, sDepth + 1, left);
323
+ });
324
+
325
+ ret = ret.sort(function(a,b){ return (a.left - b.left); });
326
+
327
+ return ret;
328
+
329
+ function _recursiveArray(item, depth, left) {
330
+
331
+ var right = left + 1,
332
+ id,
333
+ pid;
334
+
335
+ if ($(item).children(o.listType).children(o.items).length > 0) {
336
+ depth ++;
337
+ $(item).children(o.listType).children(o.items).each(function () {
338
+ right = _recursiveArray($(this), depth, right);
339
+ });
340
+ depth --;
341
+ }
342
+
343
+ id = ($(item).attr(o.attribute || 'id')).match(o.expression || (/(.+)[-=_](.+)/));
344
+
345
+ if (depth === sDepth + 1) {
346
+ pid = o.rootID;
347
+ } else {
348
+ var parentItem = ($(item).parent(o.listType)
349
+ .parent(o.items)
350
+ .attr(o.attribute || 'id'))
351
+ .match(o.expression || (/(.+)[-=_](.+)/));
352
+ pid = parentItem[2];
353
+ }
354
+
355
+ if (id) {
356
+ ret.push({"item_id": id[2], "parent_id": pid, "depth": depth, "left": left, "right": right});
357
+ }
358
+
359
+ left = right + 1;
360
+ return left;
361
+ }
362
+
363
+ },
364
+
365
+ _clearEmpty: function(item) {
366
+
367
+ var emptyList = $(item).children(this.options.listType);
368
+ if (emptyList.length && !emptyList.children().length && !this.options.doNotClear) {
369
+ emptyList.remove();
370
+ }
371
+
372
+ },
373
+
374
+ _getLevel: function(item) {
375
+
376
+ var level = 1;
377
+
378
+ if (this.options.listType) {
379
+ var list = item.closest(this.options.listType);
380
+ while (list && list.length > 0 &&
381
+ !list.is('.ui-sortable')) {
382
+ level++;
383
+ list = list.parent().closest(this.options.listType);
384
+ }
385
+ }
386
+
387
+ return level;
388
+ },
389
+
390
+ _getChildLevels: function(parent, depth) {
391
+ var self = this,
392
+ o = this.options,
393
+ result = 0;
394
+ depth = depth || 0;
395
+
396
+ $(parent).children(o.listType).children(o.items).each(function (index, child) {
397
+ result = Math.max(self._getChildLevels(child, depth + 1), result);
398
+ });
399
+
400
+ return depth ? result + 1 : result;
401
+ },
402
+
403
+ _isAllowed: function(parentItem, level, levels) {
404
+ var o = this.options,
405
+ isRoot = $(this.domPosition.parent).hasClass('ui-sortable') ? true : false,
406
+ maxLevels = this.placeholder.closest('.ui-sortable').nestedSortable('option', 'maxLevels'); // this takes into account the maxLevels set to the recipient list
407
+
408
+ // Is the root protected?
409
+ // Are we trying to nest under a no-nest?
410
+ // Are we nesting too deep?
411
+ if (!o.isAllowed(this.currentItem, parentItem) ||
412
+ parentItem && parentItem.hasClass(o.disableNesting) ||
413
+ o.protectRoot && (parentItem == null && !isRoot || isRoot && level > 1)) {
414
+ this.placeholder.addClass(o.errorClass);
415
+ if (maxLevels < levels && maxLevels != 0) {
416
+ this.beyondMaxLevels = levels - maxLevels;
417
+ } else {
418
+ this.beyondMaxLevels = 1;
419
+ }
420
+ } else {
421
+ if (maxLevels < levels && maxLevels != 0) {
422
+ this.placeholder.addClass(o.errorClass);
423
+ this.beyondMaxLevels = levels - maxLevels;
424
+ } else {
425
+ this.placeholder.removeClass(o.errorClass);
426
+ this.beyondMaxLevels = 0;
427
+ }
428
+ }
429
+ }
430
+
431
+ }));
432
+
433
+ $.mjs.nestedSortable.prototype.options = $.extend({}, $.ui.sortable.prototype.options, $.mjs.nestedSortable.prototype.options);
434
+ })(jQuery);
@@ -1,28 +1,2 @@
1
- /* jquery.Jcrop.min.css v0.9.10 (build:20120429) */
2
- .jcrop-holder{direction:ltr;text-align:left;}
3
- .jcrop-vline,.jcrop-hline{background:#FFF image-url('Jcrop.gif') top left repeat;font-size:0;position:absolute;}
4
- .jcrop-vline{height:100%;width:1px!important;}
5
- .jcrop-hline{height:1px!important;width:100%;}
6
- .jcrop-vline.right{right:0;}
7
- .jcrop-hline.bottom{bottom:0;}
8
- .jcrop-handle{background-color:#333;border:1px #eee solid;font-size:1px;}
9
- .jcrop-tracker{-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;height:100%;width:100%;}
10
- .jcrop-handle.ord-n{left:50%;margin-left:-4px;margin-top:-4px;top:0;}
11
- .jcrop-handle.ord-s{bottom:0;left:50%;margin-bottom:-4px;margin-left:-4px;}
12
- .jcrop-handle.ord-e{margin-right:-4px;margin-top:-4px;right:0;top:50%;}
13
- .jcrop-handle.ord-w{left:0;margin-left:-4px;margin-top:-4px;top:50%;}
14
- .jcrop-handle.ord-nw{left:0;margin-left:-4px;margin-top:-4px;top:0;}
15
- .jcrop-handle.ord-ne{margin-right:-4px;margin-top:-4px;right:0;top:0;}
16
- .jcrop-handle.ord-se{bottom:0;margin-bottom:-4px;margin-right:-4px;right:0;}
17
- .jcrop-handle.ord-sw{bottom:0;left:0;margin-bottom:-4px;margin-left:-4px;}
18
- .jcrop-dragbar.ord-n,.jcrop-dragbar.ord-s{height:7px;width:100%;}
19
- .jcrop-dragbar.ord-e,.jcrop-dragbar.ord-w{height:100%;width:7px;}
20
- .jcrop-dragbar.ord-n{margin-top:-4px;}
21
- .jcrop-dragbar.ord-s{bottom:0;margin-bottom:-4px;}
22
- .jcrop-dragbar.ord-e{margin-right:-4px;right:0;}
23
- .jcrop-dragbar.ord-w{margin-left:-4px;}
24
- .jcrop-light .jcrop-vline,.jcrop-light .jcrop-hline{background:#FFF;filter:Alpha(opacity=70)!important;opacity:.70!important;}
25
- .jcrop-light .jcrop-handle{-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#000;border-color:#FFF;border-radius:3px;}
26
- .jcrop-dark .jcrop-vline,.jcrop-dark .jcrop-hline{background:#000;filter:Alpha(opacity=70)!important;opacity:.7!important;}
27
- .jcrop-dark .jcrop-handle{-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#FFF;border-color:#000;border-radius:3px;}
28
- .jcrop-holder img,img.jcrop-preview{max-width:none;}
1
+ /* jquery.Jcrop.min.css v0.9.15 (build:20180819) */
2
+ .jcrop-holder{direction:ltr;text-align:left;-ms-touch-action:none}.jcrop-hline,.jcrop-vline{background:#fff image-url("Jcrop.gif");font-size:0;position:absolute}.jcrop-vline{height:100%;width:1px!important}.jcrop-vline.right{right:0}.jcrop-hline{height:1px!important;width:100%}.jcrop-hline.bottom{bottom:0}.jcrop-tracker{height:100%;width:100%;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none}.jcrop-handle{background-color:#333;border:1px #eee solid;width:7px;height:7px;font-size:1px}.jcrop-handle.ord-n{left:50%;margin-left:-4px;margin-top:-4px;top:0}.jcrop-handle.ord-s{bottom:0;left:50%;margin-bottom:-4px;margin-left:-4px}.jcrop-handle.ord-e{margin-right:-4px;margin-top:-4px;right:0;top:50%}.jcrop-handle.ord-w{left:0;margin-left:-4px;margin-top:-4px;top:50%}.jcrop-handle.ord-nw{left:0;margin-left:-4px;margin-top:-4px;top:0}.jcrop-handle.ord-ne{margin-right:-4px;margin-top:-4px;right:0;top:0}.jcrop-handle.ord-se{bottom:0;margin-bottom:-4px;margin-right:-4px;right:0}.jcrop-handle.ord-sw{bottom:0;left:0;margin-bottom:-4px;margin-left:-4px}.jcrop-dragbar.ord-n,.jcrop-dragbar.ord-s{height:7px;width:100%}.jcrop-dragbar.ord-e,.jcrop-dragbar.ord-w{height:100%;width:7px}.jcrop-dragbar.ord-n{margin-top:-4px}.jcrop-dragbar.ord-s{bottom:0;margin-bottom:-4px}.jcrop-dragbar.ord-e{margin-right:-4px;right:0}.jcrop-dragbar.ord-w{margin-left:-4px}.jcrop-light .jcrop-hline,.jcrop-light .jcrop-vline{background:#fff;filter:alpha(opacity=70)!important;opacity:.7!important}.jcrop-light .jcrop-handle{-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#000;border-color:#fff;border-radius:3px}.jcrop-dark .jcrop-hline,.jcrop-dark .jcrop-vline{background:#000;filter:alpha(opacity=70)!important;opacity:.7!important}.jcrop-dark .jcrop-handle{-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#fff;border-color:#000;border-radius:3px}.solid-line .jcrop-hline,.solid-line .jcrop-vline{background:#fff}.jcrop-holder img,img.jcrop-preview{max-width:none}