alchemy_cms 6.1.10 → 7.0.0.pre.a

Sign up to get free protection for your applications and to get access to all the features.
Files changed (249) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +0 -3
  3. data/.gitignore +1 -6
  4. data/CHANGELOG.md +19 -44
  5. data/Gemfile +1 -1
  6. data/Rakefile +14 -9
  7. data/alchemy_cms.gemspec +2 -3
  8. data/app/assets/javascripts/alchemy/alchemy.dirty.js.coffee +1 -1
  9. data/app/assets/javascripts/alchemy/alchemy.element_editors.js.coffee +18 -32
  10. data/app/assets/javascripts/alchemy/alchemy.elements_window.js.coffee +2 -2
  11. data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +2 -2
  12. data/app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee +27 -29
  13. data/app/assets/stylesheets/alchemy/elements.scss +16 -35
  14. data/app/assets/stylesheets/alchemy/forms.scss +0 -4
  15. data/app/assets/stylesheets/alchemy/node-select.scss +2 -2
  16. data/app/controllers/alchemy/admin/attachments_controller.rb +0 -1
  17. data/app/controllers/alchemy/admin/elements_controller.rb +7 -32
  18. data/app/controllers/alchemy/admin/pages_controller.rb +1 -1
  19. data/app/controllers/alchemy/admin/pictures_controller.rb +1 -1
  20. data/app/controllers/alchemy/admin/resources_controller.rb +1 -18
  21. data/app/controllers/alchemy/api/elements_controller.rb +0 -2
  22. data/app/controllers/alchemy/api/pages_controller.rb +8 -4
  23. data/app/controllers/alchemy/messages_controller.rb +9 -9
  24. data/app/controllers/alchemy/pages_controller.rb +23 -18
  25. data/app/decorators/alchemy/element_editor.rb +10 -30
  26. data/app/helpers/alchemy/admin/elements_helper.rb +0 -2
  27. data/app/helpers/alchemy/elements_block_helper.rb +5 -42
  28. data/app/helpers/alchemy/elements_helper.rb +3 -11
  29. data/app/helpers/alchemy/pages_helper.rb +0 -4
  30. data/app/models/alchemy/attachment.rb +6 -3
  31. data/app/models/alchemy/base_record.rb +2 -0
  32. data/app/models/alchemy/eager_loading.rb +0 -1
  33. data/app/models/alchemy/element/element_ingredients.rb +1 -8
  34. data/app/models/alchemy/element/presenters.rb +9 -25
  35. data/app/models/alchemy/element.rb +2 -18
  36. data/app/models/alchemy/ingredient.rb +17 -6
  37. data/app/models/alchemy/ingredients/audio.rb +2 -0
  38. data/app/models/alchemy/ingredients/datetime.rb +3 -1
  39. data/app/models/alchemy/ingredients/file.rb +7 -0
  40. data/app/models/alchemy/ingredients/headline.rb +6 -0
  41. data/app/models/alchemy/ingredients/link.rb +2 -0
  42. data/app/models/alchemy/ingredients/node.rb +2 -0
  43. data/app/models/alchemy/ingredients/page.rb +2 -0
  44. data/app/models/alchemy/ingredients/picture.rb +11 -0
  45. data/app/models/alchemy/ingredients/richtext.rb +6 -0
  46. data/app/models/alchemy/ingredients/select.rb +1 -0
  47. data/app/models/alchemy/ingredients/text.rb +8 -0
  48. data/app/models/alchemy/ingredients/video.rb +2 -0
  49. data/app/models/alchemy/node.rb +9 -6
  50. data/app/models/alchemy/page/page_elements.rb +5 -26
  51. data/app/models/alchemy/page/page_layouts.rb +0 -14
  52. data/app/models/alchemy/page/page_natures.rb +0 -10
  53. data/app/models/alchemy/page.rb +0 -10
  54. data/app/models/alchemy/picture/transformations.rb +0 -30
  55. data/app/models/alchemy/picture/url.rb +1 -1
  56. data/app/models/alchemy/picture.rb +14 -13
  57. data/app/models/alchemy/picture_thumb/create.rb +7 -18
  58. data/app/models/alchemy/picture_thumb/file_store.rb +33 -0
  59. data/app/models/alchemy/picture_thumb.rb +10 -10
  60. data/app/models/concerns/alchemy/picture_thumbnails.rb +2 -6
  61. data/app/serializers/alchemy/element_serializer.rb +1 -6
  62. data/app/services/alchemy/delete_elements.rb +1 -7
  63. data/app/services/alchemy/duplicate_element.rb +1 -6
  64. data/app/views/alchemy/admin/elements/_element.html.erb +5 -22
  65. data/app/views/alchemy/admin/elements/create.js.erb +1 -1
  66. data/app/views/alchemy/admin/elements/fold.js.erb +2 -2
  67. data/app/views/alchemy/admin/elements/order.js.erb +1 -1
  68. data/app/views/alchemy/admin/elements/update.js.erb +1 -2
  69. data/app/views/alchemy/admin/pages/_external_link.html.erb +2 -2
  70. data/app/views/alchemy/admin/pages/_file_link.html.erb +2 -2
  71. data/app/views/alchemy/admin/pages/_internal_link.html.erb +2 -2
  72. data/app/views/alchemy/admin/pages/_table.html.erb +0 -6
  73. data/app/views/alchemy/admin/pages/_tinymce_custom_config.html.erb +3 -6
  74. data/app/views/alchemy/admin/pages/edit.html.erb +1 -1
  75. data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +1 -3
  76. data/app/views/alchemy/admin/pictures/_infos.html.erb +4 -6
  77. data/app/views/alchemy/admin/resources/_per_page_select.html.erb +1 -1
  78. data/app/views/alchemy/ingredients/_boolean_editor.html.erb +1 -1
  79. data/app/views/alchemy/ingredients/_headline_editor.html.erb +1 -1
  80. data/app/views/alchemy/ingredients/_html_editor.html.erb +1 -1
  81. data/app/views/alchemy/ingredients/_node_editor.html.erb +1 -1
  82. data/app/views/alchemy/ingredients/_picture_editor.html.erb +4 -4
  83. data/app/views/alchemy/ingredients/_select_editor.html.erb +2 -2
  84. data/app/views/alchemy/ingredients/_text_editor.html.erb +1 -1
  85. data/app/views/alchemy/ingredients/shared/_link_tools.html.erb +3 -3
  86. data/app/views/alchemy/pages/_meta_data.html.erb +0 -1
  87. data/app/views/layouts/alchemy/admin.html.erb +5 -1
  88. data/config/alchemy/config.yml +6 -6
  89. data/config/brakeman.ignore +56 -57
  90. data/config/locales/alchemy.en.yml +99 -113
  91. data/config/routes.rb +1 -16
  92. data/db/migrate/20230121212637_alchemy_six_point_one.rb +248 -0
  93. data/lib/alchemy/cache_digests/template_tracker.rb +6 -7
  94. data/lib/alchemy/config.rb +2 -2
  95. data/lib/alchemy/deprecation.rb +1 -1
  96. data/lib/alchemy/errors.rb +0 -11
  97. data/lib/alchemy/hints.rb +10 -10
  98. data/lib/alchemy/permissions.rb +4 -17
  99. data/lib/alchemy/routing_constraints.rb +3 -3
  100. data/lib/alchemy/searchable_resource.rb +38 -0
  101. data/lib/alchemy/seeder.rb +2 -8
  102. data/lib/alchemy/tasks/tidy.rb +0 -38
  103. data/lib/alchemy/test_support/capybara_helpers.rb +69 -0
  104. data/lib/alchemy/test_support/factories/element_factory.rb +0 -6
  105. data/lib/alchemy/test_support/factories/ingredient_factory.rb +1 -1
  106. data/lib/alchemy/test_support/factories/page_factory.rb +4 -2
  107. data/lib/alchemy/test_support/having_picture_thumbnails_examples.rb +0 -20
  108. data/lib/alchemy/test_support/shared_dom_ids_examples.rb +1 -1
  109. data/lib/alchemy/test_support/shared_ingredient_examples.rb +1 -1
  110. data/lib/alchemy/tinymce.rb +1 -18
  111. data/lib/alchemy/upgrader/seven_point_zero.rb +45 -0
  112. data/lib/alchemy/upgrader/tasks/.keep +0 -0
  113. data/lib/alchemy/upgrader.rb +8 -3
  114. data/lib/alchemy/version.rb +1 -1
  115. data/lib/alchemy.rb +0 -19
  116. data/lib/alchemy_cms.rb +1 -2
  117. data/lib/generators/alchemy/elements/elements_generator.rb +0 -1
  118. data/lib/generators/alchemy/elements/templates/view.html.erb +1 -10
  119. data/lib/generators/alchemy/elements/templates/view.html.haml +1 -9
  120. data/lib/generators/alchemy/elements/templates/view.html.slim +1 -9
  121. data/lib/generators/alchemy/install/files/alchemy.en.yml +7 -8
  122. data/lib/generators/alchemy/install/files/application.html.erb +1 -1
  123. data/lib/generators/alchemy/install/install_generator.rb +18 -34
  124. data/lib/generators/alchemy/install/templates/elements.yml.tt +12 -12
  125. data/lib/non_stupid_digest_assets.rb +1 -1
  126. data/lib/tasks/alchemy/thumbnails.rake +2 -21
  127. data/lib/tasks/alchemy/tidy.rake +1 -12
  128. data/lib/tasks/alchemy/upgrade.rake +10 -47
  129. data/package/dist/admin.js +16 -0
  130. data/package/dist/admin.js.map +7 -0
  131. data/package.json +5 -3
  132. metadata +18 -147
  133. data/app/controllers/alchemy/admin/contents_controller.rb +0 -21
  134. data/app/controllers/alchemy/admin/essence_audios_controller.rb +0 -30
  135. data/app/controllers/alchemy/admin/essence_files_controller.rb +0 -31
  136. data/app/controllers/alchemy/admin/essence_pictures_controller.rb +0 -43
  137. data/app/controllers/alchemy/admin/essence_videos_controller.rb +0 -34
  138. data/app/controllers/alchemy/api/contents_controller.rb +0 -52
  139. data/app/decorators/alchemy/content_editor.rb +0 -119
  140. data/app/helpers/alchemy/admin/contents_helper.rb +0 -42
  141. data/app/helpers/alchemy/admin/essences_helper.rb +0 -31
  142. data/app/models/alchemy/content/factory.rb +0 -143
  143. data/app/models/alchemy/content.rb +0 -247
  144. data/app/models/alchemy/element/element_contents.rb +0 -200
  145. data/app/models/alchemy/element/element_essences.rb +0 -133
  146. data/app/models/alchemy/essence_audio.rb +0 -13
  147. data/app/models/alchemy/essence_boolean.rb +0 -20
  148. data/app/models/alchemy/essence_date.rb +0 -25
  149. data/app/models/alchemy/essence_file.rb +0 -49
  150. data/app/models/alchemy/essence_headline.rb +0 -41
  151. data/app/models/alchemy/essence_html.rb +0 -23
  152. data/app/models/alchemy/essence_link.rb +0 -21
  153. data/app/models/alchemy/essence_node.rb +0 -19
  154. data/app/models/alchemy/essence_page.rb +0 -17
  155. data/app/models/alchemy/essence_picture.rb +0 -67
  156. data/app/models/alchemy/essence_picture_view.rb +0 -90
  157. data/app/models/alchemy/essence_richtext.rb +0 -44
  158. data/app/models/alchemy/essence_select.rb +0 -19
  159. data/app/models/alchemy/essence_text.rb +0 -23
  160. data/app/models/alchemy/essence_video.rb +0 -13
  161. data/app/serializers/alchemy/content_serializer.rb +0 -17
  162. data/app/serializers/alchemy/essence_boolean_serializer.rb +0 -10
  163. data/app/serializers/alchemy/essence_date_serializer.rb +0 -10
  164. data/app/serializers/alchemy/essence_file_serializer.rb +0 -13
  165. data/app/serializers/alchemy/essence_html_serializer.rb +0 -10
  166. data/app/serializers/alchemy/essence_link_serializer.rb +0 -13
  167. data/app/serializers/alchemy/essence_picture_serializer.rb +0 -28
  168. data/app/serializers/alchemy/essence_richtext_serializer.rb +0 -11
  169. data/app/serializers/alchemy/essence_select_serializer.rb +0 -10
  170. data/app/serializers/alchemy/essence_text_serializer.rb +0 -22
  171. data/app/views/alchemy/admin/contents/create.js.erb +0 -21
  172. data/app/views/alchemy/admin/essence_audios/edit.html.erb +0 -7
  173. data/app/views/alchemy/admin/essence_files/edit.html.erb +0 -21
  174. data/app/views/alchemy/admin/essence_pictures/destroy.js.erb +0 -5
  175. data/app/views/alchemy/admin/essence_pictures/edit.html.erb +0 -30
  176. data/app/views/alchemy/admin/essence_pictures/save_link.js.erb +0 -3
  177. data/app/views/alchemy/admin/essence_pictures/update.js.erb +0 -8
  178. data/app/views/alchemy/admin/essence_videos/edit.html.erb +0 -12
  179. data/app/views/alchemy/essences/_essence_audio_editor.html.erb +0 -4
  180. data/app/views/alchemy/essences/_essence_audio_view.html.erb +0 -15
  181. data/app/views/alchemy/essences/_essence_boolean_editor.html.erb +0 -11
  182. data/app/views/alchemy/essences/_essence_boolean_view.html.erb +0 -2
  183. data/app/views/alchemy/essences/_essence_date_editor.html.erb +0 -16
  184. data/app/views/alchemy/essences/_essence_date_view.html.erb +0 -10
  185. data/app/views/alchemy/essences/_essence_file_editor.html.erb +0 -54
  186. data/app/views/alchemy/essences/_essence_file_view.html.erb +0 -18
  187. data/app/views/alchemy/essences/_essence_headline_editor.html.erb +0 -36
  188. data/app/views/alchemy/essences/_essence_headline_view.html.erb +0 -10
  189. data/app/views/alchemy/essences/_essence_html_editor.html.erb +0 -10
  190. data/app/views/alchemy/essences/_essence_html_view.html.erb +0 -2
  191. data/app/views/alchemy/essences/_essence_link_editor.html.erb +0 -30
  192. data/app/views/alchemy/essences/_essence_link_view.html.erb +0 -10
  193. data/app/views/alchemy/essences/_essence_node_editor.html.erb +0 -27
  194. data/app/views/alchemy/essences/_essence_node_view.html.erb +0 -1
  195. data/app/views/alchemy/essences/_essence_page_editor.html.erb +0 -26
  196. data/app/views/alchemy/essences/_essence_page_view.html.erb +0 -5
  197. data/app/views/alchemy/essences/_essence_picture_editor.html.erb +0 -59
  198. data/app/views/alchemy/essences/_essence_picture_view.html.erb +0 -6
  199. data/app/views/alchemy/essences/_essence_richtext_editor.html.erb +0 -14
  200. data/app/views/alchemy/essences/_essence_richtext_view.html.erb +0 -4
  201. data/app/views/alchemy/essences/_essence_select_editor.html.erb +0 -28
  202. data/app/views/alchemy/essences/_essence_select_view.html.erb +0 -2
  203. data/app/views/alchemy/essences/_essence_text_editor.html.erb +0 -29
  204. data/app/views/alchemy/essences/_essence_text_view.html.erb +0 -17
  205. data/app/views/alchemy/essences/_essence_video_editor.html.erb +0 -4
  206. data/app/views/alchemy/essences/_essence_video_view.html.erb +0 -19
  207. data/app/views/alchemy/essences/shared/_essence_picture_tools.html.erb +0 -59
  208. data/app/views/alchemy/essences/shared/_linkable_essence_tools.html.erb +0 -20
  209. data/app/views/alchemy/pages/show.rss.builder +0 -21
  210. data/db/migrate/20200226213334_alchemy_four_point_four.rb +0 -313
  211. data/db/migrate/20200423073425_create_alchemy_essence_nodes.rb +0 -11
  212. data/db/migrate/20200504210159_remove_site_id_from_nodes.rb +0 -28
  213. data/db/migrate/20200505215518_add_language_id_foreign_key_to_alchemy_pages.rb +0 -8
  214. data/db/migrate/20200511113603_add_menu_type_to_alchemy_nodes.rb +0 -27
  215. data/db/migrate/20200514091507_make_page_layoutpage_null_false.rb +0 -6
  216. data/db/migrate/20200519073500_remove_visible_from_alchemy_pages.rb +0 -24
  217. data/db/migrate/20200617110713_create_alchemy_picture_thumbs.rb +0 -22
  218. data/db/migrate/20200907111332_remove_tri_state_booleans.rb +0 -33
  219. data/db/migrate/20201207131309_create_page_versions.rb +0 -19
  220. data/db/migrate/20201207135820_add_page_version_id_to_alchemy_elements.rb +0 -76
  221. data/db/migrate/20210205143548_rename_public_on_and_public_until_on_alchemy_pages.rb +0 -10
  222. data/db/migrate/20210326105046_add_sanitized_body_to_alchemy_essence_richtexts.rb +0 -7
  223. data/db/migrate/20210406093436_add_alchemy_essence_headlines.rb +0 -12
  224. data/db/migrate/20210506135919_create_essence_audios.rb +0 -19
  225. data/db/migrate/20210506140258_create_essence_videos.rb +0 -23
  226. data/db/migrate/20210508091432_create_alchemy_ingredients.rb +0 -22
  227. data/db/migrate/20220514072456_restrict_on_delete_page_id_foreign_key_from_alchemy_nodes.rb +0 -13
  228. data/db/migrate/20220622130905_add_playsinline_to_alchemy_essence_videos.rb +0 -9
  229. data/lib/alchemy/essence.rb +0 -250
  230. data/lib/alchemy/tasks/usage.rb +0 -34
  231. data/lib/alchemy/test_support/essence_shared_examples.rb +0 -271
  232. data/lib/alchemy/test_support/factories/content_factory.rb +0 -20
  233. data/lib/alchemy/test_support/factories/essence_audio_factory.rb +0 -7
  234. data/lib/alchemy/test_support/factories/essence_file_factory.rb +0 -7
  235. data/lib/alchemy/test_support/factories/essence_page_factory.rb +0 -7
  236. data/lib/alchemy/test_support/factories/essence_picture_factory.rb +0 -11
  237. data/lib/alchemy/test_support/factories/essence_text_factory.rb +0 -7
  238. data/lib/alchemy/test_support/factories/essence_video_factory.rb +0 -7
  239. data/lib/alchemy/upgrader/five_point_zero.rb +0 -41
  240. data/lib/alchemy/upgrader/six_point_zero.rb +0 -21
  241. data/lib/alchemy/upgrader/tasks/add_page_versions.rb +0 -33
  242. data/lib/alchemy/upgrader/tasks/element_views_updater.rb +0 -34
  243. data/lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb +0 -29
  244. data/lib/alchemy/upgrader/tasks/ingredients_migrator.rb +0 -73
  245. data/lib/generators/alchemy/essence/essence_generator.rb +0 -49
  246. data/lib/generators/alchemy/essence/templates/editor.html.erb +0 -17
  247. data/lib/generators/alchemy/essence/templates/view.html.erb +0 -2
  248. data/lib/generators/alchemy/install/files/babel.config.js +0 -64
  249. data/lib/tasks/alchemy/usage.rake +0 -44
@@ -42,10 +42,12 @@ FactoryBot.define do
42
42
  after(:create) do |page|
43
43
  if page.autogenerate_elements
44
44
  page.definition["autogenerate"].each do |name|
45
- create(:alchemy_element,
45
+ create(
46
+ :alchemy_element,
46
47
  name: name,
47
48
  page_version: page.public_version,
48
- autogenerate_contents: true)
49
+ autogenerate_ingredients: true,
50
+ )
49
51
  end
50
52
  end
51
53
  end
@@ -385,26 +385,6 @@ RSpec.shared_examples_for "having picture thumbnails" do
385
385
  size: "160x120",
386
386
  )
387
387
  end
388
-
389
- context "with settings indicating free height" do
390
- let(:settings) do
391
- {
392
- crop: true,
393
- size: "800x"
394
- }
395
- end
396
-
397
- it "returns default thumbnail options" do
398
- is_expected.to eq(
399
- crop: true,
400
- crop_from: nil,
401
- crop_size: nil,
402
- flatten: true,
403
- format: "jpg",
404
- size: "160x120"
405
- )
406
- end
407
- end
408
388
  end
409
389
  end
410
390
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  RSpec.shared_examples_for "having dom ids" do
4
- let(:element) { build(:alchemy_element, name: "element_with_ingredients") }
4
+ let(:element) { build(:alchemy_element, name: "article") }
5
5
 
6
6
  let(:ingredient) do
7
7
  described_class.new(
@@ -3,7 +3,7 @@
3
3
  require "shoulda-matchers"
4
4
 
5
5
  RSpec.shared_examples_for "an alchemy ingredient" do
6
- let(:element) { build(:alchemy_element, name: "element_with_ingredients") }
6
+ let(:element) { build(:alchemy_element, name: "article") }
7
7
 
8
8
  subject(:ingredient) do
9
9
  described_class.new(
@@ -35,11 +35,7 @@ module Alchemy
35
35
  end
36
36
 
37
37
  def custom_configs_present?(page)
38
- custom_config_contents(page).any? || custom_config_ingredients(page).any?
39
- end
40
-
41
- def custom_config_contents(page)
42
- content_definitions_from_elements(page.descendent_element_definitions)
38
+ custom_config_ingredients(page).any?
43
39
  end
44
40
 
45
41
  def custom_config_ingredients(page)
@@ -48,19 +44,6 @@ module Alchemy
48
44
 
49
45
  private
50
46
 
51
- def content_definitions_from_elements(definitions)
52
- definitions.collect do |el|
53
- next if el["contents"].blank?
54
-
55
- contents = el["contents"].select do |c|
56
- c["settings"] && c["settings"]["tinymce"].is_a?(Hash)
57
- end
58
- next if contents.blank?
59
-
60
- contents.map { |c| c.merge("element" => el["name"]) }
61
- end.flatten.compact
62
- end
63
-
64
47
  def ingredient_definitions_from_elements(definitions)
65
48
  definitions.collect do |el|
66
49
  next if el["ingredients"].blank?
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "thor"
4
+
5
+ module Alchemy
6
+ class Upgrader::SevenPointZero < Upgrader
7
+ include Thor::Base
8
+ include Thor::Actions
9
+
10
+ class << self
11
+ def update_admin_entrypoint
12
+ if File.exist? "app/javascript/packs/alchemy/admin.js"
13
+ FileUtils.mv "app/javascript/packs/alchemy/admin.js", "app/javascript/alchemy_admin.js"
14
+ else
15
+ log "Skipping. No alchemy/admin entrypoint found. Maybe already migrated from Webpacker?", :info
16
+ end
17
+ if Dir.exist?("app/javascript/packs/alchemy") && Dir.empty?("app/javascript/packs/alchemy")
18
+ FileUtils.rm_r "app/javascript/packs/alchemy"
19
+ end
20
+ if File.exist? "config/importmap.rb"
21
+ # We want the bundled package if using importmaps
22
+ task.gsub_file "app/javascript/alchemy_admin.js", 'import "@alchemy_cms/admin"', 'import "@alchemy_cms/dist/admin"'
23
+ end
24
+ if task.ask("Do you want to remove webpacker now? (y/N)", default: "N") == "y"
25
+ task.run "yarn remove @rails/webpacker webpack webpack-cli webpack-dev-server"
26
+ FileUtils.rm_r "app/javascript/packs"
27
+ FileUtils.rm_r "config/webpack"
28
+ FileUtils.rm "config/webpacker.yml"
29
+ FileUtils.rm "bin/webpack"
30
+ FileUtils.rm "bin/webpack-dev-server"
31
+ end
32
+ if task.ask("Do you want to add jsbundling-rails now? (Y/n)", default: "Y") == "Y"
33
+ task.run "bundle add jsbundling-rails"
34
+ task.run "bin/rails javascript:install:esbuild"
35
+ end
36
+ end
37
+
38
+ private
39
+
40
+ def task
41
+ @_task || new
42
+ end
43
+ end
44
+ end
45
+ end
File without changes
@@ -26,9 +26,14 @@ module Alchemy
26
26
  end
27
27
 
28
28
  def update_npm_package
29
- desc "Install new npm package."
30
- `yarn add @alchemy_cms/admin@~#{Alchemy.version}`
31
- log "Installed new npm package."
29
+ desc "Update npm package."
30
+ if File.exist? Rails.root.join("config/importmap.rb")
31
+ `bin/importmap pin @alchemy_cms/admin@~#{Alchemy.version}`
32
+ elsif File.exist? Rails.root.join("package.json")
33
+ `yarn add @alchemy_cms/admin@~#{Alchemy.version}`
34
+ else
35
+ log("Could not update alchemy admin package! Make sure you have a JS bundler installed", :warning)
36
+ end
32
37
  end
33
38
  end
34
39
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alchemy
4
- VERSION = "6.1.10"
4
+ VERSION = "7.0.0-a"
5
5
 
6
6
  def self.version
7
7
  VERSION
data/lib/alchemy.rb CHANGED
@@ -5,25 +5,6 @@ require "alchemy/admin/preview_url"
5
5
  module Alchemy
6
6
  YAML_PERMITTED_CLASSES = %w[Symbol Date Regexp]
7
7
 
8
- DEPRECATED_ESSENCE_CLASS_MAPPING = {
9
- "Alchemy::EssenceAudio" => "Alchemy::Ingredients::Audio",
10
- "Alchemy::EssenceBoolean" => "Alchemy::Ingredients::Boolean",
11
- "Alchemy::EssenceDate" => "Alchemy::Ingredients::Date",
12
- "Alchemy::EssenceFile" => "Alchemy::Ingredients::File",
13
- "Alchemy::EssenceHeadline" => "Alchemy::Ingredients::Headline",
14
- "Alchemy::EssenceHtml" => "Alchemy::Ingredients::Html",
15
- "Alchemy::EssenceLink" => "Alchemy::Ingredients::Link",
16
- "Alchemy::EssenceNode" => "Alchemy::Ingredients::Node",
17
- "Alchemy::EssencePage" => "Alchemy::Ingredients::Page",
18
- "Alchemy::EssencePicture" => "Alchemy::Ingredients::Picture",
19
- "Alchemy::EssenceRichtext" => "Alchemy::Ingredients::Richtext",
20
- "Alchemy::EssenceSelect" => "Alchemy::Ingredients::Select",
21
- "Alchemy::EssenceText" => "Alchemy::Ingredients::Text",
22
- "Alchemy::EssenceVideo" => "Alchemy::Ingredients::Video",
23
- }
24
-
25
- DEPRECATED_ESSENCE_CLASSES = DEPRECATED_ESSENCE_CLASS_MAPPING.keys
26
-
27
8
  # Define page preview sources
28
9
  #
29
10
  # A preview source is a Ruby class returning an URL
data/lib/alchemy_cms.rb CHANGED
@@ -23,7 +23,6 @@ require "sassc-rails"
23
23
  require "simple_form"
24
24
  require "turbolinks"
25
25
  require "userstamp"
26
- require "webpacker"
27
26
 
28
27
  # Require globally used Alchemy mixins
29
28
  require_relative "alchemy/ability_helper"
@@ -39,7 +38,6 @@ require_relative "alchemy/element_definition"
39
38
  require_relative "alchemy/elements_finder"
40
39
  require_relative "alchemy/error_tracking"
41
40
  require_relative "alchemy/errors"
42
- require_relative "alchemy/essence"
43
41
  require_relative "alchemy/filetypes"
44
42
  require_relative "alchemy/forms/builder"
45
43
  require_relative "alchemy/hints"
@@ -53,6 +51,7 @@ require_relative "alchemy/page_layout"
53
51
  require_relative "alchemy/paths"
54
52
  require_relative "alchemy/permissions"
55
53
  require_relative "alchemy/resource"
54
+ require_relative "alchemy/searchable_resource"
56
55
  require_relative "alchemy/tinymce"
57
56
  require_relative "alchemy/taggable"
58
57
  require_relative "alchemy/version"
@@ -13,7 +13,6 @@ module Alchemy
13
13
 
14
14
  @elements.each do |element|
15
15
  @element = element
16
- @contents = element["contents"] || []
17
16
  @ingredients = element["ingredients"] || []
18
17
  @element_name = element_name(element)
19
18
  conditional_template "view.html.#{template_engine}", "#{elements_dir}/_#{@element_name}.html.#{template_engine}"
@@ -1,14 +1,5 @@
1
1
  <%%- cache(<%= @element_name %>) do -%>
2
2
  <%%= element_view_for(<%= @element_name %>) do |el| -%>
3
- <%- @contents.each do |content| -%>
4
- <%- if @contents.length > 1 -%>
5
- <div class="<%= content["name"] %>">
6
- <%%= el.render :<%= content["name"] %> %>
7
- </div>
8
- <%- else -%>
9
- <%%= el.render :<%= content["name"] %> %>
10
- <%- end -%>
11
- <%- end -%>
12
3
  <%- @ingredients.each do |ingredient| -%>
13
4
  <%- if @ingredients.length > 1 -%>
14
5
  <div class="<%= ingredient["role"] %>">
@@ -19,7 +10,7 @@
19
10
  <%- end -%>
20
11
  <%- end -%>
21
12
  <%- if @element['nestable_elements'].present? -%>
22
- <%%= render <%= @element_name %>.nested_elements.available %>
13
+ <%%= render <%= @element_name %>.nested_elements.published %>
23
14
  <%- end -%>
24
15
  <%%- end -%>
25
16
  <%%- end -%>
@@ -1,13 +1,5 @@
1
1
  - cache(<%= @element_name -%>) do
2
2
  = element_view_for(<%= @element_name -%>) do |el|
3
- <%- @contents.each do |content| -%>
4
- <%- if @contents.length > 1 -%>
5
- .<%= content["name"] %>
6
- = el.render :<%= content["name"] %>
7
- <%- else -%>
8
- = el.render :<%= content["name"] %>
9
- <%- end -%>
10
- <%- end -%>
11
3
  <%- @ingredients.each do |ingredient| -%>
12
4
  <%- if @ingredients.length > 1 -%>
13
5
  .<%= ingredient["role"] %>
@@ -18,5 +10,5 @@
18
10
  <%- end -%>
19
11
  <%- end -%>
20
12
  <%- if @element['nestable_elements'].present? -%>
21
- = render <%= @element_name -%>.nested_elements.available
13
+ = render <%= @element_name -%>.nested_elements.published
22
14
  <%- end -%>
@@ -1,13 +1,5 @@
1
1
  - cache(<%= @element_name -%>) do
2
2
  = element_view_for(<%= @element_name -%>) do |el|
3
- <%- @contents.each do |content| -%>
4
- <%- if @contents.length > 1 -%>
5
- .<%= content["name"] %>
6
- = el.render :<%= content["name"] %>
7
- <%- else -%>
8
- = el.render :<%= content["name"] %>
9
- <%- end -%>
10
- <%- end -%>
11
3
  <%- @ingredients.each do |ingredient| -%>
12
4
  <%- if @ingredients.length > 1 -%>
13
5
  .<%= ingredient["role"] %>
@@ -18,5 +10,5 @@
18
10
  <%- end -%>
19
11
  <%- end -%>
20
12
  <%- if @element['nestable_elements'].present? -%>
21
- = render <%= @element_name -%>.nested_elements.available
13
+ = render <%= @element_name -%>.nested_elements.published
22
14
  <%- end -%>
@@ -1,6 +1,5 @@
1
1
  en:
2
2
  alchemy:
3
-
4
3
  # Translations for page layout names
5
4
  page_layout_names:
6
5
  index: Homepage
@@ -9,23 +8,23 @@ en:
9
8
  element_names:
10
9
  article: Article
11
10
 
12
- # Translations for content names
13
- content_names:
11
+ # Translations for ingredient roles
12
+ ingredient_roles:
14
13
  headline: Headline
15
14
  text: Text
16
15
  picture: Picture
17
16
 
18
- # Default texts for new contents created
19
- default_content_texts:
17
+ # Default texts for new ingredients created
18
+ default_ingredient_texts:
20
19
  article_headline: "Welcome to your first Alchemy CMS page"
21
- article_text: '<p><strong>How to get started.</strong></p><p>First of all you should read about Alchemy and its architecture in the <a class="external" href="http://guides.alchemy-cms.com/alchemy_approach.html" target="_blank" data-link-target="blank">guidelines</a>.</p><p>The most important things to know about Alchemy are elements and page layouts.</p><p><span style="text-decoration: underline;"><strong>Elements:</strong></span></p><p>With Alchemy you can split pages into content parts, elements. These elements can be defined out of several base content types: essences. The basic essences are:</p><ul><li>EssenceText - <em>A single line of text</em></li><li>EssenceRichtext - <em>A TinyMCE powered formatted text block</em></li><li>EssencePicture - <em>A reference to an image</em></li><li>EssenceHtml - <em>HTML embed code</em></li><li>EssenceSelect - <em>A selection of values</em></li><li>EssenceBoolean - <em>A checkbox</em></li></ul><p>Elements get defined in a YAML file <strong>config/alchemy/elements.yml</strong></p><p><a class="external" href="http://guides.alchemy-cms.com/elements.html" target="_blank" data-link-target="blank">Read more about elements and how to define them in the guidelines.</a></p><p><span style="text-decoration: underline;"><strong>Page types:</strong></span></p><p>You can define several types of pages, called page layouts. You can assign elements to page layouts and control how elements and the page of a certain layout behave.</p><p>Page layouts get defined in a YAML file <strong>config/alchemy/page_layouts.yml</strong></p><p><a class="external" href="http://guides.alchemy-cms.com/page_layouts.html" target="_blank" data-link-target="blank">Read more about defining page layouts in the guidelines.</a></p>'
20
+ article_text: '<p><strong>How to get started.</strong></p><p>First of all you should read about Alchemy and its architecture in the <a class="external" href="http://guides.alchemy-cms.com/alchemy_approach.html" target="_blank" data-link-target="blank">guidelines</a>.</p><p>The most important things to know about Alchemy are elements and page layouts.</p><p><span style="text-decoration: underline;"><strong>Elements:</strong></span></p><p>With Alchemy you can split pages into content parts, elements. These elements can be defined out of several base content types: ingredients. The ingredients are:</p><ul><li>Text - <em>A single line of text</em></li><li>Richtext - <em>A TinyMCE powered formatted text block</em></li><li>Picture - <em>A reference to an image</em></li><li>Html - <em>HTML embed code</em></li><li>Select - <em>A selection of values</em></li><li>Boolean - <em>A checkbox</em></li></ul><p>Elements get defined in a YAML file <strong>config/alchemy/elements.yml</strong></p><p><a class="external" href="http://guides.alchemy-cms.com/elements.html" target="_blank" data-link-target="blank">Read more about elements and how to define them in the guidelines.</a></p><p><span style="text-decoration: underline;"><strong>Page types:</strong></span></p><p>You can define several types of pages, called page layouts. You can assign elements to page layouts and control how elements and the page of a certain layout behave.</p><p>Page layouts get defined in a YAML file <strong>config/alchemy/page_layouts.yml</strong></p><p><a class="external" href="http://guides.alchemy-cms.com/page_layouts.html" target="_blank" data-link-target="blank">Read more about defining page layouts in the guidelines.</a></p>'
22
21
 
23
22
  # Hint texts for elements
24
23
  element_hints:
25
24
  article: "This is a hint text for the article element. You can change this text in `config/locales/alchemy.en.yml`. Feel free to change it as you like, it's yours."
26
25
 
27
- # Hint texts for contents
28
- content_hints:
26
+ # Hint texts for ingredients
27
+ ingredient_hints:
29
28
  headline: "This is a single line of unformatable Text"
30
29
  picture: "Pictures are stored in the library. You can assign a picture multiple times throughout your site. Alchemy has an image cropper build right in."
31
30
  text: "This is a rich text block powered by TinyMCE editor. You can change the configuration of the editor. See http://guides.alchemy-cms.com/customize_tinymce.html"
@@ -6,7 +6,7 @@
6
6
  <%= csp_meta_tag %>
7
7
 
8
8
  <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
9
- <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
9
+ <%= javascript_link_tag 'application', 'data-turbolinks-track': 'reload' %>
10
10
  </head>
11
11
 
12
12
  <body>
@@ -18,16 +18,6 @@ module Alchemy
18
18
  default: false,
19
19
  desc: "Skip creation of demo element, page and application layout."
20
20
 
21
- class_option :skip_webpacker_installer,
22
- type: :boolean,
23
- default: false,
24
- desc: "Skip running the webpacker installer."
25
-
26
- class_option :force_babel_config,
27
- type: :boolean,
28
- default: false,
29
- desc: "Force installing a patched babel config."
30
-
31
21
  class_option :skip_db_create,
32
22
  type: :boolean,
33
23
  default: false,
@@ -108,34 +98,28 @@ module Alchemy
108
98
  rake "gutentag:install:migrations"
109
99
  end
110
100
 
111
- def run_webpacker_installer
112
- unless options[:skip_webpacker_installer]
113
- # Webpacker does not create a package.json, but we need one
114
- unless File.exist? app_root.join("package.json")
115
- in_root { run "echo '{}' > package.json" }
116
- end
117
- rake("webpacker:install", abort_on_failure: true)
118
- end
119
- end
120
-
121
- # We need to force the babel.config.js file, because webpacker has an invalid one
122
- def copy_babel_config
123
- if options[:force_babel_config]
124
- copy_file "babel.config.js", app_root.join("babel.config.js"), force: true
125
- end
126
- end
127
-
128
101
  def add_npm_package
129
- run "yarn add @alchemy_cms/admin@~#{Alchemy.version}"
102
+ if File.exist? app_root.join("package.json")
103
+ run "yarn add @alchemy_cms/admin@~#{Alchemy.version}"
104
+ elsif File.exist? app_root.join("config/importmap.rb")
105
+ run "bin/importmap pin @alchemy_cms/admin@~#{Alchemy.version}"
106
+ else
107
+ log("Could not add alchemy admin package! Make sure you have a JS bundler installed", :warning)
108
+ end
130
109
  end
131
110
 
132
111
  def copy_alchemy_entry_point
133
- webpack_config = YAML.safe_load(
134
- File.read(app_root.join("config", "webpacker.yml")),
135
- aliases: true
136
- )[Rails.env]
137
- copy_file "alchemy_admin.js",
138
- app_root.join(webpack_config["source_path"], webpack_config["source_entry_path"], "alchemy/admin.js")
112
+ if Dir.exist? app_root.join("app/javascript")
113
+ if File.exist? app_root.join("config/importmap.rb")
114
+ # We want the bundled package if using importmaps
115
+ create_file app_root.join("app/javascript/alchemy_admin.js"), 'import "@alchemy_cms/dist/admin"'
116
+ else
117
+ # We want the normal package if using a bundler locally
118
+ create_file app_root.join("app/javascript/alchemy_admin.js"), 'import "@alchemy_cms/admin"'
119
+ end
120
+ else
121
+ log("Could not add alchemy admin entry point! Make sure you have a JS bundler installed", :warning)
122
+ end
139
123
  end
140
124
 
141
125
  def set_primary_language
@@ -6,16 +6,16 @@
6
6
  - name: article
7
7
  hint: true
8
8
  unique: true
9
- contents:
10
- - name: headline
11
- type: EssenceText
12
- default: :article_headline
13
- hint: true
14
- - name: picture
15
- type: EssencePicture
16
- hint: true
17
- - name: text
18
- type: EssenceRichtext
19
- default: :article_text
20
- hint: true
9
+ ingredients:
10
+ - role: headline
11
+ type: Text
12
+ default: :article_headline
13
+ hint: true
14
+ - role: picture
15
+ type: Picture
16
+ hint: true
17
+ - role: text
18
+ type: Richtext
19
+ default: :article_text
20
+ hint: true
21
21
  <%- end -%>
@@ -19,7 +19,7 @@ module NonStupidDigestAssets
19
19
  def whitelisted_assets(assets)
20
20
  assets.select do |logical_path, _digest_path|
21
21
  whitelist.any? do |item|
22
- /#{item}/ =~ logical_path
22
+ item =~ logical_path
23
23
  end
24
24
  end
25
25
  end
@@ -2,10 +2,9 @@
2
2
 
3
3
  namespace :alchemy do
4
4
  namespace :generate do
5
- desc "Generates all thumbnails for Alchemy Pictures and EssencePictures."
5
+ desc "Generates all thumbnails for Alchemy Pictures and Picture Ingredients."
6
6
  task thumbnails: [
7
7
  "alchemy:generate:picture_thumbnails",
8
- "alchemy:generate:essence_picture_thumbnails",
9
8
  "alchemy:generate:ingredient_picture_thumbnails",
10
9
  ]
11
10
 
@@ -23,30 +22,12 @@ namespace :alchemy do
23
22
  puts "Done!"
24
23
  end
25
24
 
26
- desc "Generates thumbnails for Alchemy EssencePictures."
27
- task essence_picture_thumbnails: :environment do
28
- essence_pictures = Alchemy::EssencePicture.joins(:content, :ingredient_association)
29
- puts "Regenerate #{essence_pictures.count} essence picture thumbnails."
30
- puts "Please wait..."
31
-
32
- essence_pictures.find_each do |essence_picture|
33
- puts essence_picture.picture_url
34
- puts essence_picture.thumbnail_url
35
-
36
- essence_picture.settings.fetch(:srcset, []).each do |src|
37
- puts essence_picture.picture_url(src)
38
- end
39
- end
40
-
41
- puts "Done!"
42
- end
43
-
44
25
  desc "Generates thumbnails for Alchemy Picture Ingredients (set ELEMENTS=element1,element2 to only generate thumbnails for a subset of elements)."
45
26
  task ingredient_picture_thumbnails: :environment do
46
27
  ingredient_pictures = Alchemy::Ingredients::Picture.
47
28
  joins(:element).
48
29
  preload({ related_object: :thumbs }).
49
- merge(Alchemy::Element.available)
30
+ merge(Alchemy::Element.published)
50
31
 
51
32
  if ENV["ELEMENTS"].present?
52
33
  ingredient_pictures = ingredient_pictures.merge(
@@ -17,15 +17,9 @@ namespace :alchemy do
17
17
  Alchemy::Tidy.update_element_positions
18
18
  end
19
19
 
20
- desc "Fixes content positions."
21
- task content_positions: [:environment] do
22
- Alchemy::Tidy.update_content_positions
23
- end
24
-
25
- desc "Remove orphaned records (elements & contents)."
20
+ desc "Remove orphaned records (elements)."
26
21
  task remove_orphaned_records: [:environment] do
27
22
  Rake::Task["alchemy:tidy:remove_orphaned_elements"].invoke
28
- Rake::Task["alchemy:tidy:remove_orphaned_contents"].invoke
29
23
  end
30
24
 
31
25
  desc "Remove orphaned elements."
@@ -33,11 +27,6 @@ namespace :alchemy do
33
27
  Alchemy::Tidy.remove_orphaned_elements
34
28
  end
35
29
 
36
- desc "Remove orphaned contents."
37
- task remove_orphaned_contents: [:environment] do
38
- Alchemy::Tidy.remove_orphaned_contents
39
- end
40
-
41
30
  desc "Remove trashed elements."
42
31
  task remove_trashed_elements: [:environment] do
43
32
  Alchemy::Tidy.remove_trashed_elements
@@ -6,8 +6,7 @@ namespace :alchemy do
6
6
  desc "Upgrades your app to AlchemyCMS v#{Alchemy::VERSION}."
7
7
  task upgrade: [
8
8
  "alchemy:upgrade:prepare",
9
- "alchemy:upgrade:5.0:run",
10
- "alchemy:upgrade:6.0:run",
9
+ "alchemy:upgrade:7.0:run",
11
10
  ] do
12
11
  Alchemy::Upgrader.display_todos
13
12
  end
@@ -36,59 +35,23 @@ namespace :alchemy do
36
35
  Alchemy::Upgrader.update_npm_package
37
36
  end
38
37
 
39
- desc "Upgrade Alchemy to v5.0"
40
- task "5.0" => [
38
+ desc "Upgrade Alchemy to v7.0"
39
+ task "7.0" => [
41
40
  "alchemy:upgrade:prepare",
42
- "alchemy:upgrade:5.0:run",
41
+ "alchemy:upgrade:7.0:run",
43
42
  ] do
44
43
  Alchemy::Upgrader.display_todos
45
44
  end
46
45
 
47
- namespace "5.0" do
46
+ namespace "7.0" do
48
47
  task "run" => [
49
- "alchemy:upgrade:5.0:install_gutentag_migrations",
50
- "alchemy:upgrade:5.0:remove_layout_roots",
51
- "alchemy:upgrade:5.0:remove_root_page",
48
+ "alchemy:upgrade:7.0:update_admin_entrypoint",
52
49
  ]
53
50
 
54
- desc "Install Gutentag migrations"
55
- task install_gutentag_migrations: [:environment] do
56
- Alchemy::Upgrader::FivePointZero.install_gutentag_migrations
57
- end
58
-
59
- desc "Remove layout root pages"
60
- task remove_layout_roots: [:environment] do
61
- Alchemy::Upgrader::FivePointZero.remove_layout_roots
62
- end
63
-
64
- desc "Remove root page"
65
- task remove_root_page: [:environment] do
66
- Alchemy::Upgrader::FivePointZero.remove_root_page
67
- end
68
- end
69
-
70
- desc "Upgrade Alchemy to v6.0"
71
- task "6.0" => [
72
- "alchemy:upgrade:prepare",
73
- "alchemy:upgrade:6.0:run",
74
- ] do
75
- Alchemy::Upgrader.display_todos
76
- end
77
-
78
- namespace "6.0" do
79
- task "run" => [
80
- "alchemy:upgrade:6.0:create_public_page_versions",
81
- "alchemy:upgrade:6.0:create_ingredients",
82
- ]
83
-
84
- desc "Create public page versions"
85
- task create_public_page_versions: [:environment] do
86
- Alchemy::Upgrader::SixPointZero.create_public_page_versions
87
- end
88
-
89
- desc "Create ingredients for elements with ingredients defined"
90
- task create_ingredients: [:environment] do
91
- Alchemy::Upgrader::SixPointZero.create_ingredients
51
+ desc "Update alchemy admin entrypoint"
52
+ task update_admin_entrypoint: [:environment] do
53
+ puts "adding npm_package..."
54
+ Alchemy::Upgrader::SevenPointZero.update_admin_entrypoint
92
55
  end
93
56
  end
94
57
  end