alchemy_cms 7.0.8 → 7.1.0.pre.b2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (394) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +162 -0
  3. data/Gemfile +9 -11
  4. data/README.md +11 -9
  5. data/alchemy_cms.gemspec +4 -3
  6. data/app/assets/config/alchemy_manifest.js +3 -5
  7. data/app/assets/images/alchemy/missing-image.svg +1 -1
  8. data/app/assets/javascripts/alchemy/admin.js +1 -23
  9. data/app/assets/javascripts/alchemy/alchemy.confirm_dialog.js.coffee +2 -3
  10. data/app/assets/javascripts/alchemy/alchemy.dialog.js.coffee +19 -34
  11. data/app/assets/javascripts/alchemy/alchemy.elements_window.js.coffee +38 -13
  12. data/app/assets/javascripts/alchemy/alchemy.file_progress.js.coffee +1 -1
  13. data/app/assets/javascripts/alchemy/alchemy.fixed_elements.js +32 -25
  14. data/app/assets/javascripts/alchemy/alchemy.growler.js.coffee +1 -1
  15. data/app/assets/javascripts/alchemy/alchemy.image_overlay.coffee +3 -5
  16. data/app/assets/javascripts/alchemy/alchemy.initializer.js.coffee +0 -57
  17. data/app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee +24 -65
  18. data/app/assets/javascripts/alchemy/alchemy.list_filter.js.coffee +2 -2
  19. data/app/assets/javascripts/alchemy/alchemy.preview.js.coffee +5 -4
  20. data/app/assets/javascripts/alchemy/alchemy.preview_window.js.coffee +5 -5
  21. data/app/assets/javascripts/alchemy/templates/index.js +0 -2
  22. data/app/assets/javascripts/alchemy/templates/node_folder.hbs +1 -1
  23. data/app/assets/javascripts/alchemy/templates/page.hbs +1 -1
  24. data/app/assets/javascripts/alchemy/templates/page_folder.hbs +2 -2
  25. data/app/assets/javascripts/tinymce/icons/remixicons/icons.js +93 -0
  26. data/app/assets/javascripts/tinymce/plugins/alchemy_link/plugin.min.js +37 -18
  27. data/app/assets/stylesheets/alchemy/_custom-properties.scss +82 -0
  28. data/app/assets/stylesheets/alchemy/_mixins.scss +38 -30
  29. data/app/assets/stylesheets/alchemy/_variables.scss +23 -8
  30. data/app/assets/stylesheets/alchemy/admin.scss +3 -4
  31. data/app/assets/stylesheets/alchemy/archive.scss +110 -50
  32. data/app/assets/stylesheets/alchemy/attachments.scss +5 -4
  33. data/app/assets/stylesheets/alchemy/buttons.scss +41 -166
  34. data/app/assets/stylesheets/alchemy/dashboard.scss +31 -6
  35. data/app/assets/stylesheets/alchemy/dialogs.scss +12 -28
  36. data/app/assets/stylesheets/alchemy/elements.scss +272 -282
  37. data/app/assets/stylesheets/alchemy/flash.scss +20 -12
  38. data/app/assets/stylesheets/alchemy/forms.scss +21 -34
  39. data/app/assets/stylesheets/alchemy/frame.scss +11 -32
  40. data/app/assets/stylesheets/alchemy/hints.scss +4 -62
  41. data/app/assets/stylesheets/alchemy/image_library.scss +36 -33
  42. data/app/assets/stylesheets/alchemy/menubar.scss +7 -6
  43. data/app/assets/stylesheets/alchemy/navigation.scss +27 -15
  44. data/app/assets/stylesheets/alchemy/nodes.scss +11 -7
  45. data/app/assets/stylesheets/alchemy/notices.scss +16 -4
  46. data/app/assets/stylesheets/alchemy/page-select.scss +10 -2
  47. data/app/assets/stylesheets/alchemy/pagination.scss +22 -13
  48. data/app/assets/stylesheets/alchemy/resource_info.scss +7 -5
  49. data/app/assets/stylesheets/alchemy/selects.scss +49 -42
  50. data/app/assets/stylesheets/alchemy/shoelace.scss +345 -0
  51. data/app/assets/stylesheets/alchemy/sitemap.scss +24 -14
  52. data/app/assets/stylesheets/alchemy/spinner.scss +9 -19
  53. data/app/assets/stylesheets/alchemy/tables.scss +16 -24
  54. data/app/assets/stylesheets/alchemy/tags.scss +4 -0
  55. data/app/assets/stylesheets/alchemy/toolbar.scss +29 -25
  56. data/app/assets/stylesheets/alchemy/upload.scss +140 -89
  57. data/app/assets/stylesheets/tinymce/skins/content/alchemy/content.min.scss +69 -0
  58. data/app/assets/stylesheets/tinymce/skins/skintool.json +38 -0
  59. data/app/assets/stylesheets/tinymce/skins/ui/alchemy/content.css +711 -0
  60. data/app/assets/stylesheets/tinymce/skins/ui/alchemy/content.inline.css +705 -0
  61. data/app/assets/stylesheets/tinymce/skins/ui/alchemy/content.inline.min.css +7 -0
  62. data/app/assets/stylesheets/tinymce/skins/ui/alchemy/content.min.css +7 -0
  63. data/app/assets/stylesheets/tinymce/skins/ui/alchemy/content.mobile.css +29 -0
  64. data/app/assets/stylesheets/tinymce/skins/ui/alchemy/content.mobile.min.css +7 -0
  65. data/app/assets/stylesheets/tinymce/skins/ui/alchemy/fonts/tinymce-mobile.woff +0 -0
  66. data/app/assets/stylesheets/tinymce/skins/ui/alchemy/skin.min.scss +3798 -0
  67. data/app/assets/stylesheets/tinymce/skins/ui/alchemy/skin.mobile.css +677 -0
  68. data/app/assets/stylesheets/tinymce/skins/ui/alchemy/skin.mobile.min.css +7 -0
  69. data/app/components/alchemy/admin/node_select.rb +39 -0
  70. data/app/components/alchemy/admin/page_select.rb +42 -0
  71. data/app/controllers/alchemy/admin/base_controller.rb +5 -6
  72. data/app/controllers/alchemy/admin/elements_controller.rb +63 -35
  73. data/app/controllers/alchemy/admin/pages_controller.rb +9 -4
  74. data/app/controllers/alchemy/base_controller.rb +4 -2
  75. data/app/controllers/concerns/alchemy/admin/uploader_responses.rb +1 -1
  76. data/app/controllers/concerns/alchemy/site_redirects.rb +1 -1
  77. data/app/decorators/alchemy/element_editor.rb +0 -2
  78. data/app/helpers/alchemy/admin/attachments_helper.rb +6 -5
  79. data/app/helpers/alchemy/admin/base_helper.rb +17 -12
  80. data/app/helpers/alchemy/admin/ingredients_helper.rb +4 -1
  81. data/app/helpers/alchemy/admin/pages_helper.rb +5 -11
  82. data/app/helpers/alchemy/base_helper.rb +47 -13
  83. data/app/javascript/alchemy_admin/clipboard.js +16 -0
  84. data/app/javascript/alchemy_admin/components/alchemy_html_element.js +129 -0
  85. data/app/javascript/alchemy_admin/components/button.js +59 -0
  86. data/app/javascript/alchemy_admin/components/char_counter.js +40 -0
  87. data/app/javascript/alchemy_admin/components/datepicker.js +39 -0
  88. data/app/javascript/alchemy_admin/components/dialog_link.js +45 -0
  89. data/app/javascript/alchemy_admin/components/element_editor/publish_element_button.js +36 -0
  90. data/app/javascript/alchemy_admin/components/element_editor.js +553 -0
  91. data/app/javascript/alchemy_admin/components/ingredient_group.js +54 -0
  92. data/app/javascript/alchemy_admin/components/link_buttons/link_button.js +48 -0
  93. data/app/javascript/alchemy_admin/components/link_buttons/unlink_button.js +38 -0
  94. data/app/javascript/alchemy_admin/components/link_buttons.js +79 -0
  95. data/app/javascript/alchemy_admin/components/node_select.js +45 -0
  96. data/app/javascript/alchemy_admin/components/overlay.js +18 -0
  97. data/app/javascript/alchemy_admin/components/page_select.js +63 -0
  98. data/app/javascript/alchemy_admin/components/remote_select.js +134 -0
  99. data/app/javascript/alchemy_admin/components/select.js +12 -0
  100. data/app/javascript/alchemy_admin/components/spinner.js +31 -0
  101. data/app/javascript/alchemy_admin/components/tinymce.js +134 -0
  102. data/app/javascript/alchemy_admin/components/uploader/file_upload.js +266 -0
  103. data/app/javascript/alchemy_admin/components/uploader/progress.js +258 -0
  104. data/app/javascript/alchemy_admin/components/uploader.js +132 -0
  105. data/app/javascript/alchemy_admin/dirty.js +49 -0
  106. data/app/javascript/alchemy_admin/file_editors.js +1 -1
  107. data/app/javascript/alchemy_admin/gui.js +14 -0
  108. data/app/javascript/alchemy_admin/i18n.js +12 -8
  109. data/app/javascript/alchemy_admin/image_cropper.js +6 -3
  110. data/app/javascript/alchemy_admin/image_loader.js +7 -15
  111. data/app/javascript/alchemy_admin/ingredient_anchor_link.js +2 -5
  112. data/app/javascript/alchemy_admin/initializer.js +65 -0
  113. data/app/javascript/alchemy_admin/locales/en.js +31 -0
  114. data/app/javascript/alchemy_admin/picture_editors.js +6 -4
  115. data/app/javascript/alchemy_admin/picture_selector.js +38 -0
  116. data/app/javascript/alchemy_admin/please_wait_overlay.js +8 -0
  117. data/app/javascript/alchemy_admin/sortable_elements.js +78 -0
  118. data/app/javascript/alchemy_admin/spinner.js +36 -0
  119. data/app/javascript/alchemy_admin/tags_autocomplete.js +46 -0
  120. data/app/javascript/alchemy_admin/utils/ajax.js +6 -5
  121. data/app/javascript/alchemy_admin/utils/debounce.js +10 -0
  122. data/app/javascript/alchemy_admin/utils/dom_helpers.js +20 -0
  123. data/app/javascript/alchemy_admin/utils/format.js +11 -0
  124. data/app/javascript/alchemy_admin/utils/max.js +3 -0
  125. data/app/javascript/alchemy_admin/utils/string_conversions.js +10 -0
  126. data/app/javascript/alchemy_admin.js +64 -13
  127. data/app/javascript/menubar.js +10 -0
  128. data/app/models/alchemy/attachment.rb +9 -11
  129. data/app/models/alchemy/element.rb +11 -0
  130. data/app/models/alchemy/ingredients/richtext.rb +1 -10
  131. data/app/models/alchemy/node.rb +4 -0
  132. data/app/models/alchemy/page/page_naming.rb +7 -0
  133. data/app/models/alchemy/page/page_natures.rb +10 -2
  134. data/app/models/alchemy/page.rb +11 -51
  135. data/app/models/alchemy/picture/url.rb +1 -9
  136. data/app/models/alchemy/picture_variant.rb +11 -2
  137. data/app/models/concerns/alchemy/picture_thumbnails.rb +1 -1
  138. data/app/serializers/alchemy/page_tree_serializer.rb +2 -1
  139. data/app/services/alchemy/copy_page.rb +98 -0
  140. data/app/views/alchemy/_menubar.html.erb +17 -13
  141. data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +14 -10
  142. data/app/views/alchemy/admin/attachments/_attachment.html.erb +44 -36
  143. data/app/views/alchemy/admin/attachments/_replace_button.html.erb +15 -21
  144. data/app/views/alchemy/admin/attachments/archive_overlay.js.erb +0 -1
  145. data/app/views/alchemy/admin/attachments/assign.js.erb +1 -1
  146. data/app/views/alchemy/admin/attachments/index.html.erb +6 -4
  147. data/app/views/alchemy/admin/attachments/show.html.erb +10 -23
  148. data/app/views/alchemy/admin/clipboard/clear.js.erb +1 -1
  149. data/app/views/alchemy/admin/clipboard/index.html.erb +3 -7
  150. data/app/views/alchemy/admin/clipboard/insert.js.erb +1 -1
  151. data/app/views/alchemy/admin/crop.html.erb +1 -1
  152. data/app/views/alchemy/admin/dashboard/_locked_pages.html.erb +1 -1
  153. data/app/views/alchemy/admin/dashboard/index.html.erb +13 -11
  154. data/app/views/alchemy/admin/dashboard/info.html.erb +7 -7
  155. data/app/views/alchemy/admin/elements/_add_nested_element_form.html.erb +21 -23
  156. data/app/views/alchemy/admin/elements/_element.html.erb +52 -44
  157. data/app/views/alchemy/admin/elements/_footer.html.erb +1 -1
  158. data/app/views/alchemy/admin/elements/_form.html.erb +1 -1
  159. data/app/views/alchemy/admin/elements/_header.html.erb +11 -12
  160. data/app/views/alchemy/admin/elements/_toolbar.html.erb +33 -45
  161. data/app/views/alchemy/admin/elements/create.js.erb +7 -15
  162. data/app/views/alchemy/admin/elements/destroy.js.erb +0 -2
  163. data/app/views/alchemy/admin/elements/index.html.erb +27 -24
  164. data/app/views/alchemy/admin/elements/new.html.erb +9 -11
  165. data/app/views/alchemy/admin/ingredients/_file_fields.html.erb +2 -2
  166. data/app/views/alchemy/admin/ingredients/_picture_fields.html.erb +3 -3
  167. data/app/views/alchemy/admin/ingredients/_video_fields.html.erb +1 -2
  168. data/app/views/alchemy/admin/languages/_form.html.erb +2 -3
  169. data/app/views/alchemy/admin/languages/_language.html.erb +15 -8
  170. data/app/views/alchemy/admin/languages/_table.html.erb +1 -0
  171. data/app/views/alchemy/admin/layoutpages/_layoutpage.html.erb +28 -16
  172. data/app/views/alchemy/admin/layoutpages/index.html.erb +2 -2
  173. data/app/views/alchemy/admin/legacy_page_urls/_legacy_page_url.html.erb +12 -8
  174. data/app/views/alchemy/admin/legacy_page_urls/_new.html.erb +1 -1
  175. data/app/views/alchemy/admin/nodes/_form.html.erb +20 -21
  176. data/app/views/alchemy/admin/nodes/_node.html.erb +39 -34
  177. data/app/views/alchemy/admin/nodes/index.html.erb +1 -1
  178. data/app/views/alchemy/admin/pages/_anchor_link.html.erb +4 -4
  179. data/app/views/alchemy/admin/pages/_create_language_form.html.erb +2 -2
  180. data/app/views/alchemy/admin/pages/_current_page.html.erb +1 -1
  181. data/app/views/alchemy/admin/pages/_external_link.html.erb +4 -4
  182. data/app/views/alchemy/admin/pages/_file_link.html.erb +5 -5
  183. data/app/views/alchemy/admin/pages/_form.html.erb +10 -21
  184. data/app/views/alchemy/admin/pages/_internal_link.html.erb +4 -4
  185. data/app/views/alchemy/admin/pages/_locked_page.html.erb +2 -2
  186. data/app/views/alchemy/admin/pages/_new_page_form.html.erb +4 -17
  187. data/app/views/alchemy/admin/pages/_page.html.erb +76 -72
  188. data/app/views/alchemy/admin/pages/_page_infos.html.erb +23 -7
  189. data/app/views/alchemy/admin/pages/_page_layout_filter.html.erb +2 -1
  190. data/app/views/alchemy/admin/pages/_page_status.html.erb +11 -21
  191. data/app/views/alchemy/admin/pages/_publication_fields.html.erb +2 -5
  192. data/app/views/alchemy/admin/pages/_table.html.erb +1 -1
  193. data/app/views/alchemy/admin/pages/_table_row.html.erb +43 -39
  194. data/app/views/alchemy/admin/pages/_toolbar.html.erb +43 -38
  195. data/app/views/alchemy/admin/pages/configure.html.erb +12 -14
  196. data/app/views/alchemy/admin/pages/edit.html.erb +80 -103
  197. data/app/views/alchemy/admin/pages/info.html.erb +20 -11
  198. data/app/views/alchemy/admin/pages/link.html.erb +22 -16
  199. data/app/views/alchemy/admin/pages/new.html.erb +9 -11
  200. data/app/views/alchemy/admin/pages/unlock.js.erb +10 -3
  201. data/app/views/alchemy/admin/partials/_language_tree_select.html.erb +15 -13
  202. data/app/views/alchemy/admin/partials/_main_navigation_entry.html.erb +3 -5
  203. data/app/views/alchemy/admin/partials/_routes.html.erb +10 -2
  204. data/app/views/alchemy/admin/partials/_site_select.html.erb +6 -5
  205. data/app/views/alchemy/admin/partials/_toolbar_button.html.erb +28 -23
  206. data/app/views/alchemy/admin/pictures/_archive.html.erb +5 -5
  207. data/app/views/alchemy/admin/pictures/_archive_overlay.html.erb +1 -1
  208. data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +21 -23
  209. data/app/views/alchemy/admin/pictures/_infos.html.erb +2 -6
  210. data/app/views/alchemy/admin/pictures/_picture.html.erb +17 -21
  211. data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +17 -16
  212. data/app/views/alchemy/admin/pictures/_tag_list.html.erb +1 -1
  213. data/app/views/alchemy/admin/pictures/archive_overlay.js.erb +1 -1
  214. data/app/views/alchemy/admin/pictures/assign.js.erb +1 -1
  215. data/app/views/alchemy/admin/pictures/index.html.erb +34 -30
  216. data/app/views/alchemy/admin/pictures/show.html.erb +3 -3
  217. data/app/views/alchemy/admin/resources/_filter.html.erb +2 -2
  218. data/app/views/alchemy/admin/resources/_form.html.erb +2 -2
  219. data/app/views/alchemy/admin/resources/_per_page_select.html.erb +1 -1
  220. data/app/views/alchemy/admin/resources/_resource.html.erb +16 -9
  221. data/app/views/alchemy/admin/resources/_table.html.erb +4 -1
  222. data/app/views/alchemy/admin/resources/index.html.erb +22 -19
  223. data/app/views/alchemy/admin/sites/index.html.erb +2 -1
  224. data/app/views/alchemy/admin/styleguide/index.html.erb +54 -28
  225. data/app/views/alchemy/admin/tags/_tag.html.erb +16 -14
  226. data/app/views/alchemy/admin/tags/index.html.erb +15 -12
  227. data/app/views/alchemy/admin/tinymce/_setup.html.erb +28 -0
  228. data/app/views/alchemy/admin/uploader/_button.html.erb +23 -29
  229. data/app/views/alchemy/admin/uploader/_setup.html.erb +3 -8
  230. data/app/views/alchemy/base/500.html.erb +1 -1
  231. data/app/views/alchemy/base/error_notice.js.erb +0 -1
  232. data/app/views/alchemy/ingredients/_boolean_editor.html.erb +1 -1
  233. data/app/views/alchemy/ingredients/_datetime_editor.html.erb +1 -1
  234. data/app/views/alchemy/ingredients/_file_editor.html.erb +5 -5
  235. data/app/views/alchemy/ingredients/_link_editor.html.erb +1 -1
  236. data/app/views/alchemy/ingredients/_node_editor.html.erb +6 -19
  237. data/app/views/alchemy/ingredients/_page_editor.html.erb +7 -19
  238. data/app/views/alchemy/ingredients/_picture_editor.html.erb +2 -2
  239. data/app/views/alchemy/ingredients/_richtext_editor.html.erb +6 -15
  240. data/app/views/alchemy/ingredients/_select_editor.html.erb +2 -1
  241. data/app/views/alchemy/ingredients/_text_editor.html.erb +1 -1
  242. data/app/views/alchemy/ingredients/shared/_anchor.html.erb +1 -1
  243. data/app/views/alchemy/ingredients/shared/_link_tools.html.erb +10 -20
  244. data/app/views/alchemy/ingredients/shared/_picture_tools.html.erb +42 -49
  245. data/app/views/kaminari/alchemy/_first_page.html.erb +4 -2
  246. data/app/views/kaminari/alchemy/_gap.html.erb +1 -1
  247. data/app/views/kaminari/alchemy/_last_page.html.erb +4 -2
  248. data/app/views/kaminari/alchemy/_next_page.html.erb +4 -2
  249. data/app/views/kaminari/alchemy/_prev_page.html.erb +4 -2
  250. data/app/views/layouts/alchemy/admin.html.erb +10 -29
  251. data/bundles/shoelace.js +10 -0
  252. data/bundles/tinymce.js +20 -0
  253. data/config/alchemy/config.yml +11 -10
  254. data/config/alchemy/modules.yml +30 -30
  255. data/config/brakeman.ignore +0 -34
  256. data/config/importmap.rb +9 -5
  257. data/config/initializers/dragonfly.rb +1 -0
  258. data/config/initializers/rails_live_reload.rb +13 -0
  259. data/config/locales/alchemy.en.yml +25 -9
  260. data/config/routes.rb +2 -1
  261. data/lib/alchemy/auth_accessors.rb +6 -1
  262. data/lib/alchemy/config.rb +24 -2
  263. data/lib/alchemy/dev_support/live_reload_watcher.rb +5 -0
  264. data/lib/alchemy/engine.rb +10 -3
  265. data/lib/alchemy/forms/builder.rb +18 -12
  266. data/lib/alchemy/resources_helper.rb +3 -3
  267. data/lib/alchemy/test_support/capybara_helpers.rb +8 -5
  268. data/lib/alchemy/test_support/having_picture_thumbnails_examples.rb +6 -6
  269. data/lib/alchemy/test_support/rspec_matchers.rb +14 -0
  270. data/lib/alchemy/test_support/shared_uploader_examples.rb +1 -1
  271. data/lib/alchemy/tinymce.rb +19 -3
  272. data/lib/alchemy/version.rb +1 -1
  273. data/package.json +30 -9
  274. data/rollup.config.mjs +65 -0
  275. data/vendor/assets/fonts/remixicon.eot +0 -0
  276. data/vendor/assets/fonts/remixicon.svg +7816 -0
  277. data/vendor/assets/fonts/remixicon.ttf +0 -0
  278. data/vendor/assets/fonts/remixicon.woff +0 -0
  279. data/vendor/assets/fonts/remixicon.woff2 +0 -0
  280. data/vendor/assets/stylesheets/remixicon.scss +10480 -0
  281. data/vendor/assets/stylesheets/tinymce/skins/content/default/content.min.css +1 -0
  282. data/vendor/javascript/clipboard.min.js +7 -0
  283. data/vendor/javascript/flatpickr.min.js +1 -0
  284. data/vendor/javascript/keymaster.min.js +1 -0
  285. data/vendor/javascript/rails-ujs.min.js +1 -0
  286. data/vendor/javascript/shoelace.min.js +995 -0
  287. data/vendor/javascript/sortable.min.js +7 -0
  288. data/vendor/javascript/tinymce.min.js +1 -0
  289. data/vendor/javascript/ungap-custom-elements.min.js +3 -0
  290. metadata +111 -124
  291. data/.codeclimate.yml +0 -35
  292. data/.editorconfig +0 -23
  293. data/.github/FUNDING.yml +0 -4
  294. data/.github/ISSUE_TEMPLATE/Bug_report.md +0 -22
  295. data/.github/ISSUE_TEMPLATE/Feature_request.md +0 -17
  296. data/.github/PULL_REQUEST_TEMPLATE.md +0 -18
  297. data/.github/workflows/brakeman-analysis.yml +0 -46
  298. data/.github/workflows/lint.yml +0 -37
  299. data/.github/workflows/stale.yml +0 -33
  300. data/.github/workflows/test.yml +0 -124
  301. data/.gitignore +0 -31
  302. data/.hound.yml +0 -9
  303. data/.localeapp/config.rb +0 -8
  304. data/.prettierrc +0 -6
  305. data/.rspec +0 -1
  306. data/.rubocop.yml +0 -7
  307. data/.standard.yml +0 -4
  308. data/.yardopts +0 -5
  309. data/app/assets/javascripts/alchemy/alchemy.autocomplete.js.coffee +0 -30
  310. data/app/assets/javascripts/alchemy/alchemy.base.js.coffee +0 -53
  311. data/app/assets/javascripts/alchemy/alchemy.buttons.js.coffee +0 -45
  312. data/app/assets/javascripts/alchemy/alchemy.char_counter.js.coffee +0 -19
  313. data/app/assets/javascripts/alchemy/alchemy.dirty.js.coffee +0 -59
  314. data/app/assets/javascripts/alchemy/alchemy.dragndrop.js.coffee +0 -79
  315. data/app/assets/javascripts/alchemy/alchemy.element_editors.js.coffee +0 -267
  316. data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +0 -27
  317. data/app/assets/javascripts/alchemy/alchemy.spinner.js +0 -32
  318. data/app/assets/javascripts/alchemy/alchemy.tooltips.coffee +0 -10
  319. data/app/assets/javascripts/alchemy/alchemy.uploader.js.coffee +0 -131
  320. data/app/assets/javascripts/alchemy/menubar.js.coffee +0 -8
  321. data/app/assets/javascripts/alchemy/node_select.js +0 -39
  322. data/app/assets/javascripts/alchemy/page_select.js +0 -46
  323. data/app/assets/javascripts/alchemy/templates/node.hbs +0 -16
  324. data/app/assets/javascripts/alchemy/templates/spinner.hbs +0 -7
  325. data/app/assets/stylesheets/alchemy/jquery-ui.scss +0 -435
  326. data/app/assets/stylesheets/tinymce/skins/alchemy/content.min.css.scss +0 -94
  327. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.svg +0 -63
  328. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.ttf +0 -0
  329. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.woff +0 -0
  330. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.svg +0 -129
  331. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.ttf +0 -0
  332. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.woff +0 -0
  333. data/app/assets/stylesheets/tinymce/skins/alchemy/img/anchor.gif +0 -0
  334. data/app/assets/stylesheets/tinymce/skins/alchemy/img/loader.gif +0 -0
  335. data/app/assets/stylesheets/tinymce/skins/alchemy/img/object.gif +0 -0
  336. data/app/assets/stylesheets/tinymce/skins/alchemy/img/trans.gif +0 -0
  337. data/app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss +0 -2105
  338. data/app/javascript/alchemy_admin/datepicker.js +0 -33
  339. data/app/javascript/alchemy_admin/tinymce.js +0 -146
  340. data/app/javascript/alchemy_admin/translations.js +0 -32
  341. data/app/views/alchemy/admin/elements/fold.js.erb +0 -33
  342. data/app/views/alchemy/admin/elements/order.js.erb +0 -11
  343. data/app/views/alchemy/admin/elements/publish.js.erb +0 -21
  344. data/app/views/alchemy/admin/elements/update.js.erb +0 -27
  345. data/vendor/assets/fonts/fa-regular-400.eot +0 -0
  346. data/vendor/assets/fonts/fa-regular-400.svg +0 -803
  347. data/vendor/assets/fonts/fa-regular-400.ttf +0 -0
  348. data/vendor/assets/fonts/fa-regular-400.woff +0 -0
  349. data/vendor/assets/fonts/fa-regular-400.woff2 +0 -0
  350. data/vendor/assets/fonts/fa-solid-900.eot +0 -0
  351. data/vendor/assets/fonts/fa-solid-900.svg +0 -4938
  352. data/vendor/assets/fonts/fa-solid-900.ttf +0 -0
  353. data/vendor/assets/fonts/fa-solid-900.woff +0 -0
  354. data/vendor/assets/fonts/fa-solid-900.woff2 +0 -0
  355. data/vendor/assets/javascripts/clipboard.min.js +0 -7
  356. data/vendor/assets/javascripts/fileupload/jquery.fileupload-process.js +0 -178
  357. data/vendor/assets/javascripts/fileupload/jquery.fileupload-validate.js +0 -125
  358. data/vendor/assets/javascripts/fileupload/jquery.fileupload.js +0 -1502
  359. data/vendor/assets/javascripts/fileupload/jquery.iframe-transport.js +0 -224
  360. data/vendor/assets/javascripts/jquery-ui/data.js +0 -45
  361. data/vendor/assets/javascripts/jquery-ui/ie.js +0 -20
  362. data/vendor/assets/javascripts/jquery-ui/keycode.js +0 -51
  363. data/vendor/assets/javascripts/jquery-ui/plugin.js +0 -49
  364. data/vendor/assets/javascripts/jquery-ui/safe-active-element.js +0 -46
  365. data/vendor/assets/javascripts/jquery-ui/safe-blur.js +0 -27
  366. data/vendor/assets/javascripts/jquery-ui/scroll-parent.js +0 -50
  367. data/vendor/assets/javascripts/jquery-ui/unique-id.js +0 -54
  368. data/vendor/assets/javascripts/jquery-ui/version.js +0 -20
  369. data/vendor/assets/javascripts/jquery-ui/widget.js +0 -754
  370. data/vendor/assets/javascripts/jquery-ui/widgets/draggable.js +0 -1268
  371. data/vendor/assets/javascripts/jquery-ui/widgets/mouse.js +0 -241
  372. data/vendor/assets/javascripts/jquery-ui/widgets/sortable.js +0 -1623
  373. data/vendor/assets/javascripts/jquery-ui/widgets/tabs.js +0 -931
  374. data/vendor/assets/javascripts/jquery_plugins/jquery.scrollTo.min.js +0 -7
  375. data/vendor/assets/javascripts/jquery_plugins/jquery.ui.tabspaging.js +0 -296
  376. data/vendor/assets/javascripts/keymaster.js +0 -296
  377. data/vendor/assets/javascripts/requestAnimationFrame.js +0 -31
  378. data/vendor/assets/javascripts/tinymce/license.txt +0 -504
  379. data/vendor/assets/javascripts/tinymce/tinymce.min.js +0 -2
  380. data/vendor/assets/stylesheets/fontawesome/_animated.scss +0 -20
  381. data/vendor/assets/stylesheets/fontawesome/_bordered-pulled.scss +0 -20
  382. data/vendor/assets/stylesheets/fontawesome/_core.scss +0 -21
  383. data/vendor/assets/stylesheets/fontawesome/_fixed-width.scss +0 -6
  384. data/vendor/assets/stylesheets/fontawesome/_icons.scss +0 -1441
  385. data/vendor/assets/stylesheets/fontawesome/_larger.scss +0 -23
  386. data/vendor/assets/stylesheets/fontawesome/_list.scss +0 -18
  387. data/vendor/assets/stylesheets/fontawesome/_mixins.scss +0 -56
  388. data/vendor/assets/stylesheets/fontawesome/_rotated-flipped.scss +0 -24
  389. data/vendor/assets/stylesheets/fontawesome/_screen-reader.scss +0 -5
  390. data/vendor/assets/stylesheets/fontawesome/_stacked.scss +0 -31
  391. data/vendor/assets/stylesheets/fontawesome/_variables.scss +0 -1458
  392. data/vendor/assets/stylesheets/fontawesome/fontawesome.scss +0 -16
  393. data/vendor/assets/stylesheets/fontawesome/regular.scss +0 -23
  394. data/vendor/assets/stylesheets/fontawesome/solid.scss +0 -24
@@ -1,46 +0,0 @@
1
- # This workflow integrates Brakeman with GitHub's Code Scanning feature
2
- # Brakeman is a static analysis security vulnerability scanner for Ruby on Rails applications
3
-
4
- name: Brakeman Scan
5
-
6
- on:
7
- push:
8
- branches: [main]
9
- pull_request:
10
- # The branches below must be a subset of the branches above
11
- branches: [main]
12
- schedule:
13
- - cron: "40 4 * * 2"
14
-
15
- jobs:
16
- brakeman-scan:
17
- name: Brakeman Scan
18
- runs-on: ubuntu-latest
19
- steps:
20
- # Checkout the repository to the GitHub Actions runner
21
- - name: Checkout
22
- uses: actions/checkout@v3
23
-
24
- # Customize the ruby version depending on your needs
25
- - name: Set up Ruby
26
- uses: ruby/setup-ruby@v1
27
- with:
28
- ruby-version: "3.0"
29
-
30
- - name: Setup Brakeman
31
- env:
32
- BRAKEMAN_VERSION: "5.4" # SARIF support is provided in Brakeman version 4.10+
33
- run: |
34
- gem install brakeman --version $BRAKEMAN_VERSION
35
-
36
- # Execute Brakeman CLI and generate a SARIF output with the security issues identified during the analysis
37
- - name: Scan
38
- continue-on-error: true
39
- run: |
40
- brakeman -f sarif -o output.sarif.json .
41
-
42
- # Upload the SARIF file generated in the previous step
43
- - name: Upload SARIF
44
- uses: github/codeql-action/upload-sarif@v2
45
- with:
46
- sarif_file: output.sarif.json
@@ -1,37 +0,0 @@
1
- name: Lint
2
-
3
- on: [pull_request]
4
-
5
- jobs:
6
- Standard:
7
- runs-on: ubuntu-latest
8
- steps:
9
- - name: Checkout code
10
- uses: actions/checkout@v3
11
- - name: Install Ruby and gems
12
- uses: ruby/setup-ruby@v1
13
- with:
14
- ruby-version: "3.0"
15
- bundler-cache: true
16
- - name: Lint Ruby files
17
- run: bundle exec standardrb
18
- Prettier:
19
- runs-on: ubuntu-latest
20
- steps:
21
- - name: Checkout
22
- uses: actions/checkout@v3
23
- - name: Setup Node
24
- uses: actions/setup-node@v3
25
- with:
26
- node-version: "18"
27
- - name: Restore node_modules cache
28
- uses: actions/cache@v3
29
- with:
30
- path: node_modules
31
- key: ${{ runner.os }}-node-modules-${{ hashFiles('package.json') }}
32
- restore-keys: |
33
- ${{ runner.os }}-node-modules
34
- - name: Install dependencies
35
- run: yarn install
36
- - name: Lint code
37
- run: yarn lint
@@ -1,33 +0,0 @@
1
- name: Mark stale issues and pull requests
2
-
3
- on:
4
- schedule:
5
- - cron: "0 0 * * *"
6
-
7
- jobs:
8
- stale:
9
- runs-on: ubuntu-latest
10
-
11
- steps:
12
- - uses: actions/stale@v5
13
- with:
14
- repo-token: ${{ secrets.GITHUB_TOKEN }}
15
- days-before-issue-stale: 180
16
- days-before-close: 30
17
- stale-issue-message: |
18
- This issue has not seen any activity in a long time.
19
- Please create a pull request with a fix or ask someone of the community if they can help.
20
- This issue will be closed in 7 days if no further activity happens.
21
- close-issue-message: |
22
- This issue has not seen any activity in a long time.
23
- If the issue described still exists in recent versions of Alchemy,
24
- please open a new issue with. Thanks for reporting.
25
- stale-pr-message: |
26
- This pull request has not seen any activiy in a long time.
27
- Probably because of missing tests or a necessary rebase.
28
- This PR will be closed in 7 days if no further activity happens.
29
- close-pr-message: |
30
- This pull request has not seen any activiy in a long time.
31
- Probably because of missing tests or a necessary rebase.
32
- Please open a new PR to latest main if you want to continue working on this.
33
- Thanks for the contribution.
@@ -1,124 +0,0 @@
1
- name: Test
2
-
3
- on: [push, pull_request]
4
-
5
- jobs:
6
- RSpec:
7
- runs-on: ubuntu-latest
8
- strategy:
9
- fail-fast: false
10
- matrix:
11
- rails:
12
- - "6.1"
13
- - "7.0"
14
- - "7.1"
15
- ruby:
16
- - "3.0"
17
- - "3.1"
18
- - "3.2"
19
- database:
20
- - mysql
21
- - postgresql
22
- - mariadb
23
- env:
24
- DB: ${{ matrix.database }}
25
- DB_USER: alchemy_user
26
- DB_PASSWORD: password
27
- DB_HOST: "127.0.0.1"
28
- RAILS_ENV: test
29
- RAILS_VERSION: ${{ matrix.rails }}
30
- services:
31
- postgres:
32
- image: postgres:11
33
- env:
34
- POSTGRES_USER: alchemy_user
35
- POSTGRES_PASSWORD: password
36
- POSTGRES_DB: alchemy_cms_dummy_test
37
- ports: ["5432:5432"]
38
- options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
39
- mysql:
40
- image: mysql:latest
41
- ports: ["3306:3306"]
42
- env:
43
- MYSQL_USER: alchemy_user
44
- MYSQL_PASSWORD: password
45
- MYSQL_DATABASE: alchemy_cms_dummy_test
46
- MYSQL_ROOT_PASSWORD: password
47
- options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
48
- mariadb:
49
- image: mariadb:latest
50
- ports: ["3307:3306"]
51
- env:
52
- MARIADB_USER: alchemy_user
53
- MARIADB_PASSWORD: password
54
- MARIADB_DATABASE: alchemy_cms_dummy_test
55
- MARIADB_ROOT_PASSWORD: password
56
- options: --health-cmd="mariadb-admin ping" --health-interval=10s --health-timeout=5s --health-retries=5
57
- steps:
58
- - uses: actions/checkout@v3
59
- - name: Set up Ruby
60
- uses: ruby/setup-ruby@v1
61
- with:
62
- ruby-version: ${{ matrix.ruby }}
63
- bundler-cache: true
64
- - name: Restore apt cache
65
- id: apt-cache
66
- uses: actions/cache@v3
67
- with:
68
- path: /home/runner/apt/cache
69
- key: ${{ runner.os }}-apt-${{ matrix.database }}
70
- restore-keys: |
71
- ${{ runner.os }}-apt-
72
- - name: Install Postgres headers
73
- if: matrix.database == 'postgresql'
74
- run: |
75
- mkdir -p /home/runner/apt/cache
76
- sudo apt update -qq
77
- sudo apt install -qq --fix-missing libpq-dev -o dir::cache::archives="/home/runner/apt/cache"
78
- sudo chown -R runner /home/runner/apt/cache
79
- - name: Install MySQL headers
80
- if: matrix.database == 'mysql' || matrix.database == 'mariadb'
81
- run: |
82
- mkdir -p /home/runner/apt/cache
83
- sudo apt update -qq
84
- sudo apt install -qq --fix-missing libmysqlclient-dev -o dir::cache::archives="/home/runner/apt/cache"
85
- sudo chown -R runner /home/runner/apt/cache
86
- - name: Restore node modules cache
87
- id: yarn-cache
88
- uses: actions/cache@v3
89
- with:
90
- path: spec/dummy/node_modules
91
- key: ${{ runner.os }}-yarn-dummy-${{ hashFiles('./package.json') }}
92
- restore-keys: |
93
- ${{ runner.os }}-yarn-dummy-
94
- - name: Prepare database
95
- run: |
96
- bundle exec rake alchemy:spec:prepare
97
- - name: Run tests & publish code coverage
98
- uses: paambaati/codeclimate-action@v3.2.0
99
- env:
100
- CC_TEST_REPORTER_ID: bca4349e32f97919210ac8a450b04904b90683fcdd57d65a22c0f5065482bc22
101
- with:
102
- coverageCommand: bundle exec rspec
103
- - uses: actions/upload-artifact@main
104
- if: failure()
105
- with:
106
- name: Screenshots
107
- path: spec/dummy/tmp/screenshots
108
- Jest:
109
- runs-on: ubuntu-latest
110
- env:
111
- NODE_ENV: test
112
- steps:
113
- - uses: actions/checkout@v3
114
- - name: Restore node modules cache
115
- uses: actions/cache@v3
116
- with:
117
- path: node_modules
118
- key: ${{ runner.os }}-yarn-${{ hashFiles('./package.json') }}
119
- restore-keys: |
120
- ${{ runner.os }}-yarn-
121
- - name: Install yarn
122
- run: yarn install
123
- - name: Run jest
124
- run: yarn jest
data/.gitignore DELETED
@@ -1,31 +0,0 @@
1
- .idea
2
- .yardoc
3
- .DS_Store
4
- .svn
5
- doc/
6
- rdoc/
7
- Gemfile.lock
8
- pkg
9
- tmp
10
- log
11
- .sass-cache
12
- spec/dummy/config/alchemy/config.yml
13
- spec/dummy/db/*.sqlite3*
14
- spec/dummy/postcss.config.js
15
- spec/dummy/public/assets/
16
- spec/dummy/uploads/
17
- .rvmrc
18
- /coverage/
19
- *.gem
20
- /index/
21
- /.bundle/
22
- .rbenv-version
23
- .ruby-gemset
24
- .ruby-version
25
- .env
26
- node_modules
27
- yarn-error.log
28
- yarn-debug.log*
29
- .yarn-integrity
30
- yarn.lock
31
- /spec/dummy/public/pictures
data/.hound.yml DELETED
@@ -1,9 +0,0 @@
1
- rubocop:
2
- enabled: false
3
- scss:
4
- enabled: false
5
- coffeescript:
6
- enabled: false
7
- javascript:
8
- enabled: false
9
- fail_on_violations: false
data/.localeapp/config.rb DELETED
@@ -1,8 +0,0 @@
1
- require 'dotenv/load'
2
-
3
- Localeapp.configure do |config|
4
- config.api_key = ENV['LOCALEAPP_API_KEY']
5
- config.translation_data_directory = 'config/locales'
6
- config.synchronization_data_file = '.localeapp/log.yml'
7
- config.daemon_pid_file = '.localeapp/localeapp.pid'
8
- end
data/.prettierrc DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "semi": false,
3
- "trailingComma": "none",
4
- "vueIndentScriptAndStyle": true,
5
- "arrowParens": "always"
6
- }
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,7 +0,0 @@
1
- require: standard
2
-
3
- AllCops:
4
- TargetRubyVersion: 3.0
5
-
6
- inherit_gem:
7
- standard: config/base.yml
data/.standard.yml DELETED
@@ -1,4 +0,0 @@
1
- parallel: true
2
- ignore:
3
- - "spec/dummy/**/*"
4
- ruby_version: 3.0
data/.yardopts DELETED
@@ -1,5 +0,0 @@
1
- --title "Alchemy CMS"
2
- app/**/*.rb
3
- config/**/*.yml
4
- lib/**/*.rb
5
- README.md
@@ -1,30 +0,0 @@
1
- window.Alchemy = {} if typeof(window.Alchemy) is 'undefined'
2
-
3
- Alchemy.Autocomplete =
4
-
5
- tags: (scope) ->
6
- field = $('[data-autocomplete]', scope)
7
- url = field.data('autocomplete')
8
- field.select2
9
- tags: true
10
- tokenSeparators: [","]
11
- minimumInputLength: 1
12
- openOnEnter: false
13
- createSearchChoice: @_createResultItem
14
- ajax:
15
- url: url
16
- dataType: 'json'
17
- data: (term, page) -> term: term
18
- results: (data, page) -> results: data
19
- initSelection: @_initializeSelection
20
-
21
- _createResultItem: (term, data) ->
22
- if $(data).filter(-> @text.localeCompare(term) is 0).length is 0
23
- id: term
24
- text: term
25
-
26
- _initializeSelection: (element, callback) ->
27
- data = []
28
- $(element.val().split(",")).each ->
29
- data.push id: $.trim(this), text: this
30
- callback(data)
@@ -1,53 +0,0 @@
1
- window.Alchemy = {} if typeof(window.Alchemy) is 'undefined'
2
-
3
- # Setting jQueryUIs global animation duration to something more snappy
4
- $.fx.speeds._default = 400
5
-
6
- # The Alchemy object contains all base functions, that don't fit in its own module.
7
- # All other modules uses this global Alchemy object as namespace.
8
- $.extend Alchemy,
9
-
10
- # Multiple picture select handler for the picture archive.
11
- pictureSelector: ->
12
- $selected_item_tools = $(".selected_item_tools")
13
- $picture_selects = $(".picture_tool.select input")
14
- $picture_selects.on "change", ->
15
- if $picture_selects.filter(":checked").size() > 0
16
- $selected_item_tools.show()
17
- else
18
- $selected_item_tools.hide()
19
- if @checked
20
- $(this).parent().addClass("visible").removeClass "hidden"
21
- else
22
- $(this).parent().removeClass("visible").addClass "hidden"
23
- return
24
- $("a#edit_multiple_pictures").on "click", (e) ->
25
- $this = $(this)
26
- picture_ids = $("input:checkbox", "#picture_archive").serialize()
27
- url = $this.attr("href") + "?" + picture_ids
28
- Alchemy.openDialog url, {title: $this.attr("title"), size: '400x295'}
29
- false
30
- return
31
-
32
- # To show the "Please wait" overlay.
33
- # Pass false to hide it.
34
- pleaseWaitOverlay: (show = true) ->
35
- $overlay = $('#overlay')
36
- if show
37
- spinner = new Alchemy.Spinner('medium')
38
- spinner.spin $overlay
39
- $overlay.show()
40
- else
41
- $overlay.find('.spinner').remove()
42
- $overlay.hide()
43
- return
44
-
45
- # Initializes all select tag with .alchemy_selectbox class as select2 instance
46
- # Pass a jQuery scope to only init a subset of selectboxes.
47
- SelectBox: (scope) ->
48
- $("select.alchemy_selectbox", scope).select2
49
- minimumResultsForSearch: 7
50
- dropdownAutoWidth: true
51
- return
52
-
53
-
@@ -1,45 +0,0 @@
1
- window.Alchemy = {} if typeof(window.Alchemy) is 'undefined'
2
-
3
- Alchemy.Buttons =
4
-
5
- observe: (scope) ->
6
- $('form', scope).not('.button_with_label form').on 'submit', (event) ->
7
- $form = $(this)
8
- $btn = $form.find(':submit')
9
- $outside_button = $('[data-alchemy-button][form="'+$form.attr('id')+'"]')
10
-
11
- if ($btn.attr('disabled') == 'disabled') || ($outside_button.attr('disabled') == 'disabled')
12
- event.preventDefault()
13
- event.stopPropagation()
14
- false
15
- else
16
- Alchemy.Buttons.disable($btn)
17
- if $outside_button
18
- Alchemy.Buttons.disable($outside_button)
19
- true
20
-
21
- disable: (button) ->
22
- $button = $(button)
23
- spinner = new Alchemy.Spinner('small')
24
- $button.data('content', $button.html())
25
- $button.attr('disabled', true)
26
- $button.attr('tabindex', '-1')
27
- $button.addClass('disabled')
28
- $button.css
29
- width: $button.outerWidth()
30
- height: $button.outerHeight()
31
- $button.empty()
32
- spinner.spin($button)
33
- return true
34
-
35
- enable: (scope) ->
36
- $buttons = $('form :submit:disabled, [data-alchemy-button].disabled', scope)
37
- $.each $buttons, ->
38
- $button = $(this)
39
- $button.removeClass('disabled')
40
- $button.removeAttr('disabled')
41
- $button.removeAttr('tabindex')
42
- $button.css("width", "")
43
- $button.css("height", "")
44
- $button.html($button.data('content'))
45
- return true
@@ -1,19 +0,0 @@
1
- class window.Alchemy.CharCounter
2
-
3
- constructor: (field) ->
4
- @$field = $(field)
5
- @max_chars = @$field.data('alchemy-char-counter')
6
- @text = Alchemy.t('allowed_chars', @max_chars)
7
- @$display = $('<small class="alchemy-char-counter"/>')
8
- @$field.after(@$display)
9
- countChars.call(this)
10
- @$field.keyup =>
11
- countChars.call(this)
12
- true
13
-
14
- countChars = ->
15
- char_length = @$field.val().length
16
- @$display.removeClass('too-long')
17
- @$display.text("#{char_length} #{@text}")
18
- if char_length > @max_chars
19
- @$display.addClass('too-long')
@@ -1,59 +0,0 @@
1
- window.Alchemy = {} if typeof (window.Alchemy) is "undefined"
2
-
3
- $.extend Alchemy,
4
-
5
- ElementDirtyObserver: (selector) ->
6
- $(selector).find('input[type="text"], select').change (e) =>
7
- $content = $(e.target)
8
- $content.addClass('dirty')
9
- @setElementDirty $content.closest(".element-editor")
10
- return
11
-
12
- setElementDirty: (element) ->
13
- $element = $(element)
14
- $element.addClass('dirty')
15
- window.onbeforeunload = @pageUnload
16
-
17
- pageUnload: ->
18
- Alchemy.t('page_dirty_notice')
19
-
20
- setElementClean: (element) ->
21
- $element = $(element)
22
- $element.removeClass('dirty')
23
- $element.find('> .element-body .dirty').removeClass('dirty')
24
- window.onbeforeunload = undefined
25
-
26
- isPageDirty: ->
27
- $('#element_area').find('.element-editor.dirty').length > 0
28
-
29
- isElementDirty: (element) ->
30
- $(element).hasClass('dirty')
31
-
32
- checkPageDirtyness: (element) ->
33
- callback = undefined
34
- if $(element).is("form")
35
- callback = ->
36
- $form = $("<form action=\"#{element.action}\" method=\"POST\" style=\"display: none\" />")
37
- $form.append $(element).find("input")
38
- $form.appendTo "body"
39
- Alchemy.pleaseWaitOverlay()
40
- $form.submit()
41
- else if $(element).is("a")
42
- callback = ->
43
- Turbo.visit(element.pathname)
44
- if Alchemy.isPageDirty()
45
- Alchemy.openConfirmDialog Alchemy.t('page_dirty_notice'),
46
- title: Alchemy.t('warning')
47
- ok_label: Alchemy.t('ok')
48
- cancel_label: Alchemy.t('cancel')
49
- on_ok: ->
50
- window.onbeforeunload = undefined
51
- callback()
52
- false
53
- else
54
- true
55
-
56
- PageLeaveObserver: ->
57
- $('#main_navi a').click (event) ->
58
- unless Alchemy.checkPageDirtyness(event.currentTarget)
59
- event.preventDefault()
@@ -1,79 +0,0 @@
1
- #= require jquery-ui/widgets/draggable
2
- #= require jquery-ui/widgets/sortable
3
- #
4
- window.Alchemy = {} if typeof (window.Alchemy) is "undefined"
5
-
6
- $.extend Alchemy,
7
-
8
- SortableElements: (page_id, form_token, selector = '#element_area .sortable-elements') ->
9
- Alchemy.initializedSortableElements = false
10
- $sortable_area = $(selector)
11
-
12
- getTinymceIDs = (ui) ->
13
- ids = []
14
- $textareas = ui.item.find('textarea.has_tinymce')
15
- $($textareas).each ->
16
- id = this.id.replace(/tinymce_/, '')
17
- ids.push parseInt(id, 10)
18
- return ids
19
-
20
- sortable_options =
21
- items: "> .element-editor"
22
- handle: "> .element-header .element-handle"
23
- placeholder: "droppable_element_placeholder"
24
- dropOnEmpty: true
25
- opacity: 0.5
26
- cursor: "move"
27
- containment: $('#element_area')
28
- tolerance: "pointer"
29
- update: (event, ui) ->
30
- # This callback is called twice for both elements, the source and the receiving
31
- # but, we only want to call ajax callback once on the receiving element.
32
- return if Alchemy.initializedSortableElements
33
- $this = ui.item.parent().closest('.ui-sortable')
34
- params = {}
35
- Alchemy.initializedSortableElements = true
36
- element_ids = $.map $this.children(), (child) ->
37
- $(child).attr("data-element-id")
38
- parent_element_id = ui.item.parent().closest("[data-element-id]").data('element-id')
39
- params =
40
- page_id: page_id
41
- authenticity_token: encodeURIComponent(form_token)
42
- element_ids: element_ids
43
- if parent_element_id?
44
- params['parent_element_id'] = parent_element_id
45
- $(event.target).css("cursor", "progress")
46
- $.ajax
47
- url: Alchemy.routes.order_admin_elements_path
48
- type: "POST"
49
- data: params
50
- complete: ->
51
- Alchemy.initializedSortableElements = false
52
- $(event.target).css("cursor", "")
53
- return
54
- start: (event, ui) ->
55
- $this = $(this)
56
- name = ui.item.data('element-name')
57
- $dropzone = $("[data-droppable-elements~='#{name}']")
58
- ids = getTinymceIDs(ui)
59
- $this.sortable('option', 'connectWith', $dropzone)
60
- $this.sortable('refresh')
61
- $dropzone.css('minHeight', 36)
62
- ui.item.addClass('dragged')
63
- if ui.item.hasClass('compact')
64
- ui.placeholder.addClass('compact').css
65
- height: ui.item.outerHeight()
66
- Alchemy.Tinymce.remove(ids)
67
- return
68
- stop: (event, ui) ->
69
- ids = getTinymceIDs(ui)
70
- name = ui.item.data('element-name')
71
- $dropzone = $("[data-droppable-elements~='#{name}']")
72
- $dropzone.css('minHeight', '')
73
- ui.item.removeClass('dragged')
74
- Alchemy.Tinymce.init(ids)
75
- return
76
-
77
- $sortable_area.sortable(sortable_options)
78
- $sortable_area.find('.nested-elements').sortable(sortable_options)
79
- return