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
@@ -1,313 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class AlchemyFourPointFour < ActiveRecord::Migration[6.0]
4
- def up
5
- unless table_exists?("alchemy_attachments")
6
- create_table "alchemy_attachments" do |t|
7
- t.string "name"
8
- t.string "file_name"
9
- t.string "file_mime_type"
10
- t.integer "file_size"
11
- t.references "creator"
12
- t.references "updater"
13
- t.timestamps
14
- t.string "file_uid"
15
- t.index ["file_uid"], name: "index_alchemy_attachments_on_file_uid"
16
- end
17
- end
18
-
19
- unless table_exists?("alchemy_contents")
20
- create_table "alchemy_contents" do |t|
21
- t.string "name"
22
- t.references "essence", null: false, polymorphic: true, index: { unique: true }
23
- t.references "element", null: false
24
- end
25
- end
26
-
27
- unless table_exists?("alchemy_elements")
28
- create_table "alchemy_elements" do |t|
29
- t.string "name"
30
- t.integer "position"
31
- t.references "page", null: false, index: false
32
- t.boolean "public", default: true
33
- t.boolean "folded", default: false
34
- t.boolean "unique", default: false
35
- t.timestamps
36
- t.references "creator"
37
- t.references "updater"
38
- t.references "parent_element", index: false
39
- t.boolean "fixed", default: false, null: false
40
- t.index ["fixed"], name: "index_alchemy_elements_on_fixed"
41
- t.index ["page_id", "parent_element_id"], name: "index_alchemy_elements_on_page_id_and_parent_element_id"
42
- t.index ["page_id", "position"], name: "index_elements_on_page_id_and_position"
43
- end
44
- end
45
-
46
- unless table_exists?("alchemy_elements_alchemy_pages")
47
- create_table "alchemy_elements_alchemy_pages", id: false do |t|
48
- t.references "element"
49
- t.references "page"
50
- end
51
- end
52
-
53
- unless table_exists?("alchemy_essence_booleans")
54
- create_table "alchemy_essence_booleans" do |t|
55
- t.boolean "value"
56
- t.index ["value"], name: "index_alchemy_essence_booleans_on_value"
57
- end
58
- end
59
-
60
- unless table_exists?("alchemy_essence_dates")
61
- create_table "alchemy_essence_dates" do |t|
62
- t.datetime "date"
63
- end
64
- end
65
-
66
- unless table_exists?("alchemy_essence_files")
67
- create_table "alchemy_essence_files" do |t|
68
- t.references "attachment"
69
- t.string "title"
70
- t.string "css_class"
71
- t.string "link_text"
72
- end
73
- end
74
-
75
- unless table_exists?("alchemy_essence_htmls")
76
- create_table "alchemy_essence_htmls" do |t|
77
- t.text "source"
78
- end
79
- end
80
-
81
- unless table_exists?("alchemy_essence_links")
82
- create_table "alchemy_essence_links" do |t|
83
- t.string "link"
84
- t.string "link_title"
85
- t.string "link_target"
86
- t.string "link_class_name"
87
- end
88
- end
89
-
90
- unless table_exists?("alchemy_essence_pages")
91
- create_table "alchemy_essence_pages" do |t|
92
- t.references "page"
93
- end
94
- end
95
-
96
- unless table_exists?("alchemy_essence_pictures")
97
- create_table "alchemy_essence_pictures" do |t|
98
- t.references "picture"
99
- t.string "caption"
100
- t.string "title"
101
- t.string "alt_tag"
102
- t.string "link"
103
- t.string "link_class_name"
104
- t.string "link_title"
105
- t.string "css_class"
106
- t.string "link_target"
107
- t.string "crop_from"
108
- t.string "crop_size"
109
- t.string "render_size"
110
- end
111
- end
112
-
113
- unless table_exists?("alchemy_essence_richtexts")
114
- create_table "alchemy_essence_richtexts" do |t|
115
- t.text "body"
116
- t.text "stripped_body"
117
- t.boolean "public"
118
- end
119
- end
120
-
121
- unless table_exists?("alchemy_essence_selects")
122
- create_table "alchemy_essence_selects" do |t|
123
- t.string "value"
124
- t.index ["value"], name: "index_alchemy_essence_selects_on_value"
125
- end
126
- end
127
-
128
- unless table_exists?("alchemy_essence_texts")
129
- create_table "alchemy_essence_texts" do |t|
130
- t.text "body"
131
- t.string "link"
132
- t.string "link_title"
133
- t.string "link_class_name"
134
- t.boolean "public", default: false
135
- t.string "link_target"
136
- end
137
- end
138
-
139
- unless table_exists?("alchemy_folded_pages")
140
- create_table "alchemy_folded_pages" do |t|
141
- t.references "page", null: false, index: false
142
- t.references "user", null: false, index: false
143
- t.boolean "folded", default: false
144
- t.index ["page_id", "user_id"], name: "index_alchemy_folded_pages_on_page_id_and_user_id", unique: true
145
- end
146
- end
147
-
148
- unless table_exists?("alchemy_languages")
149
- create_table "alchemy_languages" do |t|
150
- t.string "name"
151
- t.string "language_code"
152
- t.string "frontpage_name"
153
- t.string "page_layout", default: "intro"
154
- t.boolean "public", default: false
155
- t.timestamps
156
- t.references "creator"
157
- t.references "updater"
158
- t.boolean "default", default: false
159
- t.string "country_code", default: "", null: false
160
- t.references "site", null: false
161
- t.string "locale"
162
- t.index ["language_code", "country_code"], name: "index_alchemy_languages_on_language_code_and_country_code"
163
- t.index ["language_code"], name: "index_alchemy_languages_on_language_code"
164
- end
165
- end
166
-
167
- unless table_exists?("alchemy_legacy_page_urls")
168
- create_table "alchemy_legacy_page_urls" do |t|
169
- t.string "urlname", null: false
170
- t.references "page", null: false
171
- t.timestamps
172
- t.index ["urlname"], name: "index_alchemy_legacy_page_urls_on_urlname"
173
- end
174
- end
175
-
176
- unless table_exists?("alchemy_nodes")
177
- create_table "alchemy_nodes" do |t|
178
- t.string "name"
179
- t.string "title"
180
- t.string "url"
181
- t.boolean "nofollow", default: false, null: false
182
- t.boolean "external", default: false, null: false
183
- t.boolean "folded", default: false, null: false
184
- t.references "parent"
185
- t.integer "lft", null: false
186
- t.integer "rgt", null: false
187
- t.integer "depth", default: 0, null: false
188
- t.references "page"
189
- t.references "language", null: false
190
- t.references "creator"
191
- t.references "updater"
192
- t.timestamps
193
- t.references "site", null: false
194
- t.index ["lft"], name: "index_alchemy_nodes_on_lft"
195
- t.index ["rgt"], name: "index_alchemy_nodes_on_rgt"
196
- end
197
- end
198
-
199
- unless table_exists?("alchemy_pages")
200
- create_table "alchemy_pages" do |t|
201
- t.string "name"
202
- t.string "urlname"
203
- t.string "title"
204
- t.string "language_code"
205
- t.boolean "language_root"
206
- t.string "page_layout"
207
- t.text "meta_keywords"
208
- t.text "meta_description"
209
- t.integer "lft"
210
- t.integer "rgt"
211
- t.references "parent", index: false
212
- t.integer "depth"
213
- t.boolean "visible", default: false
214
- t.integer "locked_by"
215
- t.boolean "restricted", default: false
216
- t.boolean "robot_index", default: true
217
- t.boolean "robot_follow", default: true
218
- t.boolean "sitemap", default: true
219
- t.boolean "layoutpage", default: false
220
- t.timestamps
221
- t.references "creator"
222
- t.references "updater"
223
- t.references "language"
224
- t.datetime "published_at"
225
- t.datetime "public_on"
226
- t.datetime "public_until"
227
- t.datetime "locked_at"
228
- t.index ["locked_at", "locked_by"], name: "index_alchemy_pages_on_locked_at_and_locked_by"
229
- t.index ["parent_id", "lft"], name: "index_pages_on_parent_id_and_lft"
230
- t.index ["public_on", "public_until"], name: "index_alchemy_pages_on_public_on_and_public_until"
231
- t.index ["rgt"], name: "index_alchemy_pages_on_rgt"
232
- t.index ["urlname"], name: "index_pages_on_urlname"
233
- end
234
- end
235
-
236
- unless table_exists?("alchemy_pictures")
237
- create_table "alchemy_pictures" do |t|
238
- t.string "name"
239
- t.string "image_file_name"
240
- t.integer "image_file_width"
241
- t.integer "image_file_height"
242
- t.timestamps
243
- t.references "creator"
244
- t.references "updater"
245
- t.string "upload_hash"
246
- t.string "image_file_uid"
247
- t.integer "image_file_size"
248
- t.string "image_file_format"
249
- end
250
- end
251
-
252
- unless table_exists?("alchemy_sites")
253
- create_table "alchemy_sites" do |t|
254
- t.string "host"
255
- t.string "name"
256
- t.timestamps
257
- t.boolean "public", default: false
258
- t.text "aliases"
259
- t.boolean "redirect_to_primary_host"
260
- t.index ["host", "public"], name: "alchemy_sites_public_hosts_idx"
261
- t.index ["host"], name: "index_alchemy_sites_on_host"
262
- end
263
- end
264
-
265
- unless foreign_key_exists?("alchemy_contents", column: "element_id")
266
- add_foreign_key "alchemy_contents", "alchemy_elements", column: "element_id", on_update: :cascade, on_delete: :cascade
267
- end
268
-
269
- unless foreign_key_exists?("alchemy_elements", column: "page_id")
270
- add_foreign_key "alchemy_elements", "alchemy_pages", column: "page_id", on_update: :cascade, on_delete: :cascade
271
- end
272
-
273
- unless foreign_key_exists?("alchemy_essence_pages", column: "page_id")
274
- add_foreign_key "alchemy_essence_pages", "alchemy_pages", column: "page_id"
275
- end
276
-
277
- unless foreign_key_exists?("alchemy_nodes", column: "language_id")
278
- add_foreign_key "alchemy_nodes", "alchemy_languages", column: "language_id"
279
- end
280
-
281
- unless foreign_key_exists?("alchemy_nodes", column: "page_id")
282
- add_foreign_key "alchemy_nodes", "alchemy_pages", column: "page_id", on_delete: :cascade
283
- end
284
-
285
- unless foreign_key_exists?("alchemy_nodes", column: "site_id")
286
- add_foreign_key "alchemy_nodes", "alchemy_sites", column: "site_id", on_delete: :cascade
287
- end
288
- end
289
-
290
- def down
291
- drop_table "alchemy_attachments" if table_exists?("alchemy_attachments")
292
- drop_table "alchemy_contents" if table_exists?("alchemy_contents")
293
- drop_table "alchemy_elements" if table_exists?("alchemy_elements")
294
- drop_table "alchemy_elements_alchemy_pages" if table_exists?("alchemy_elements_alchemy_pages")
295
- drop_table "alchemy_essence_booleans" if table_exists?("alchemy_essence_booleans")
296
- drop_table "alchemy_essence_dates" if table_exists?("alchemy_essence_dates")
297
- drop_table "alchemy_essence_files" if table_exists?("alchemy_essence_files")
298
- drop_table "alchemy_essence_htmls" if table_exists?("alchemy_essence_htmls")
299
- drop_table "alchemy_essence_links" if table_exists?("alchemy_essence_links")
300
- drop_table "alchemy_essence_pages" if table_exists?("alchemy_essence_pages")
301
- drop_table "alchemy_essence_pictures" if table_exists?("alchemy_essence_pictures")
302
- drop_table "alchemy_essence_richtexts" if table_exists?("alchemy_essence_richtexts")
303
- drop_table "alchemy_essence_selects" if table_exists?("alchemy_essence_selects")
304
- drop_table "alchemy_essence_texts" if table_exists?("alchemy_essence_texts")
305
- drop_table "alchemy_folded_pages" if table_exists?("alchemy_folded_pages")
306
- drop_table "alchemy_languages" if table_exists?("alchemy_languages")
307
- drop_table "alchemy_legacy_page_urls" if table_exists?("alchemy_legacy_page_urls")
308
- drop_table "alchemy_nodes" if table_exists?("alchemy_nodes")
309
- drop_table "alchemy_pages" if table_exists?("alchemy_pages")
310
- drop_table "alchemy_pictures" if table_exists?("alchemy_pictures")
311
- drop_table "alchemy_sites" if table_exists?("alchemy_sites")
312
- end
313
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class CreateAlchemyEssenceNodes < ActiveRecord::Migration[6.0]
4
- def change
5
- create_table :alchemy_essence_nodes do |t|
6
- t.references "node"
7
- t.timestamps
8
- end
9
- add_foreign_key "alchemy_essence_nodes", "alchemy_nodes", column: "node_id"
10
- end
11
- end
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
- class RemoveSiteIdFromNodes < ActiveRecord::Migration[6.0]
3
- def up
4
- remove_foreign_key :alchemy_nodes, :alchemy_sites
5
- remove_index :alchemy_nodes, :site_id
6
- remove_column :alchemy_nodes, :site_id, :integer, null: false
7
- end
8
-
9
- def down
10
- add_column :alchemy_nodes, :site_id, :integer, null: true
11
- sql = <<~SQL
12
- UPDATE alchemy_nodes
13
- SET site_id = (
14
- SELECT alchemy_languages.site_id FROM alchemy_languages WHERE alchemy_nodes.language_id = alchemy_languages.id
15
- ) WHERE
16
- EXISTS (
17
- SELECT *
18
- FROM alchemy_languages
19
- WHERE alchemy_languages.id = alchemy_nodes.language_id
20
- );
21
- SQL
22
-
23
- connection.execute(sql)
24
- change_column :alchemy_nodes, :site_id, :integer, null: false
25
- add_index :alchemy_nodes, :site_id
26
- add_foreign_key :alchemy_nodes, :alchemy_sites, column: :site_id
27
- end
28
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class AddLanguageIdForeignKeyToAlchemyPages < ActiveRecord::Migration[6.0]
4
- def change
5
- add_foreign_key :alchemy_pages, :alchemy_languages, column: :language_id
6
- change_column_null :alchemy_pages, :language_id, false, Alchemy::Language.default&.id
7
- end
8
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
- class AddMenuTypeToAlchemyNodes < ActiveRecord::Migration[6.0]
3
- class LocalNode < ActiveRecord::Base
4
- self.table_name = :alchemy_nodes
5
- acts_as_nested_set scope: :language_id
6
-
7
- def self.root_for(node)
8
- return node if node.parent_id.nil?
9
-
10
- root_for(node.parent)
11
- end
12
- end
13
-
14
- def up
15
- add_column :alchemy_nodes, :menu_type, :string
16
- LocalNode.all.each do |node|
17
- root = LocalNode.root_for(node)
18
- menu_type = root.name.parameterize.underscore
19
- node.update(menu_type: menu_type)
20
- end
21
- change_column_null :alchemy_nodes, :menu_type, false
22
- end
23
-
24
- def down
25
- remove_column :alchemy_nodes, :menu_type
26
- end
27
- end
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
- class MakePageLayoutpageNullFalse < ActiveRecord::Migration[6.0]
3
- def change
4
- change_column_null :alchemy_pages, :layoutpage, false, false
5
- end
6
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
- class RemoveVisibleFromAlchemyPages < ActiveRecord::Migration[6.0]
3
- class LocalPage < ActiveRecord::Base
4
- self.table_name = "alchemy_pages"
5
-
6
- scope :invisible, -> { where(visible: [false, nil]) }
7
- scope :contentpages, -> { where(layoutpage: [false, nil]) }
8
- end
9
-
10
- def up
11
- if LocalPage.invisible.contentpages.where.not(parent_id: nil).any?
12
- abort "You have invisible pages in your database! " \
13
- "Please re-structure your page tree before running this migration. " \
14
- "You might also downgrade to Alchemy 4.6 and " \
15
- "run the `alchemy:upgrade:4.6:restructure_page_tree` rake task."
16
- end
17
-
18
- remove_column :alchemy_pages, :visible
19
- end
20
-
21
- def down
22
- add_column :alchemy_pages, :visible, :boolean, default: false
23
- end
24
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class CreateAlchemyPictureThumbs < ActiveRecord::Migration[6.0]
4
- def up
5
- return if table_exists?(:alchemy_picture_thumbs)
6
-
7
- create_table :alchemy_picture_thumbs do |t|
8
- t.references :picture, foreign_key: { to_table: :alchemy_pictures }, null: false
9
- t.string :signature, null: false
10
- t.text :uid, null: false
11
- end
12
- add_index :alchemy_picture_thumbs, :signature, unique: true
13
- end
14
-
15
- def down
16
- return unless table_exists?(:alchemy_picture_thumbs)
17
-
18
- remove_foreign_key :alchemy_picture_thumbs, :alchemy_pictures, column: :picture_id
19
- remove_index :alchemy_picture_thumbs, :signature
20
- drop_table :alchemy_picture_thumbs
21
- end
22
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class RemoveTriStateBooleans < ActiveRecord::Migration[6.0]
4
- def change
5
- change_column_null :alchemy_elements, :public, false, false
6
- change_column_default :alchemy_elements, :public, true
7
-
8
- change_column_null :alchemy_elements, :folded, false
9
- change_column_null :alchemy_elements, :unique, false
10
-
11
- change_column_null :alchemy_essence_richtexts, :public, false, false
12
- change_column_default :alchemy_essence_richtexts, :public, false
13
-
14
- change_column_null :alchemy_essence_texts, :public, false
15
-
16
- change_column_null :alchemy_folded_pages, :folded, false
17
-
18
- change_column_null :alchemy_languages, :public, false
19
- change_column_null :alchemy_languages, :default, false
20
-
21
- change_column_null :alchemy_pages, :language_root, false, false
22
- change_column_default :alchemy_pages, :language_root, false
23
-
24
- change_column_null :alchemy_pages, :restricted, false
25
- change_column_null :alchemy_pages, :robot_index, false
26
- change_column_null :alchemy_pages, :robot_follow, false
27
- change_column_null :alchemy_pages, :sitemap, false
28
-
29
- change_column_null :alchemy_sites, :public, false
30
- change_column_null :alchemy_sites, :redirect_to_primary_host, false, false
31
- change_column_default :alchemy_sites, :redirect_to_primary_host, false
32
- end
33
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class CreatePageVersions < ActiveRecord::Migration[6.0]
4
- def change
5
- create_table :alchemy_page_versions do |t|
6
- t.references :page,
7
- null: false,
8
- index: true,
9
- foreign_key: {
10
- to_table: :alchemy_pages,
11
- on_delete: :cascade,
12
- }
13
- t.datetime :public_on
14
- t.datetime :public_until
15
- t.index [:public_on, :public_until]
16
- t.timestamps
17
- end
18
- end
19
- end
@@ -1,76 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class AddPageVersionIdToAlchemyElements < ActiveRecord::Migration[6.0]
4
- class LocalPage < ActiveRecord::Base
5
- self.table_name = :alchemy_pages
6
- has_many :elements, class_name: "LocalElement", inverse_of: :page
7
- has_many :versions, class_name: "LocalVersion", inverse_of: :page, foreign_key: :page_id
8
- end
9
-
10
- class LocalVersion < ActiveRecord::Base
11
- self.table_name = :alchemy_page_versions
12
- belongs_to :page, class_name: "LocalPage", inverse_of: :versions
13
- has_many :elements, class_name: "LocalElement", inverse_of: :versions
14
- end
15
-
16
- class LocalElement < ActiveRecord::Base
17
- self.table_name = :alchemy_elements
18
- belongs_to :page, class_name: "LocalPage", inverse_of: :elements
19
- belongs_to :page_version, class_name: "LocalVersion", inverse_of: :elements
20
- end
21
-
22
- def change
23
- add_reference :alchemy_elements, :page_version,
24
- index: false,
25
- foreign_key: {
26
- to_table: :alchemy_page_versions,
27
- on_delete: :cascade,
28
- }
29
- add_index :alchemy_elements, [:page_version_id, :parent_element_id],
30
- name: "idx_alchemy_elements_on_page_version_id_and_parent_element_id"
31
- add_index :alchemy_elements, [:page_version_id, :position],
32
- name: "idx_alchemy_elements_on_page_version_id_and_position"
33
-
34
- # Add a page version for each page so we can add a not null constraint
35
- reversible do |dir|
36
- dir.up do
37
- say_with_time "Create draft version for each page." do
38
- LocalPage.find_each do |page|
39
- next if page.versions.any?
40
-
41
- page.versions.create!.tap do |version|
42
- Alchemy::Element.where(page_id: page.id).update_all(page_version_id: version.id)
43
- end
44
- end
45
- LocalVersion.count
46
- end
47
- end
48
- end
49
-
50
- change_column_null :alchemy_elements, :page_version_id, false
51
-
52
- # Remove the existing page relation
53
- remove_reference :alchemy_elements, :page,
54
- null: false,
55
- index: false,
56
- foreign_key: {
57
- to_table: :alchemy_pages,
58
- on_delete: :cascade,
59
- on_update: :cascade,
60
- }
61
- if index_exists? :alchemy_elements,
62
- :parent_element_id,
63
- name: "index_alchemy_elements_on_page_id_and_parent_element_id"
64
- remove_index :alchemy_elements,
65
- column: [:parent_element_id],
66
- name: "index_alchemy_elements_on_page_id_and_parent_element_id"
67
- end
68
- if index_exists? :alchemy_elements,
69
- :position,
70
- name: "index_elements_on_page_id_and_position"
71
- remove_index :alchemy_elements,
72
- column: [:position],
73
- name: "index_elements_on_page_id_and_position"
74
- end
75
- end
76
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class RenamePublicOnAndPublicUntilOnAlchemyPages < ActiveRecord::Migration[6.0]
4
- def change
5
- remove_index :alchemy_pages, column: [:public_on, :public_until],
6
- name: "index_alchemy_pages_on_public_on_and_public_until"
7
- rename_column :alchemy_pages, :public_on, :legacy_public_on
8
- rename_column :alchemy_pages, :public_until, :legacy_public_until
9
- end
10
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class AddSanitizedBodyToAlchemyEssenceRichtexts < ActiveRecord::Migration[6.0]
4
- def change
5
- add_column :alchemy_essence_richtexts, :sanitized_body, :text
6
- end
7
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class AddAlchemyEssenceHeadlines < ActiveRecord::Migration[6.0]
4
- def change
5
- create_table :alchemy_essence_headlines do |t|
6
- t.text :body
7
- t.integer :level
8
- t.integer :size
9
- t.timestamps
10
- end
11
- end
12
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class CreateEssenceAudios < ActiveRecord::Migration[6.0]
4
- def up
5
- return if table_exists? :alchemy_essence_audios
6
-
7
- create_table :alchemy_essence_audios do |t|
8
- t.references :attachment
9
- t.boolean :controls, default: true, null: false
10
- t.boolean :autoplay, default: false
11
- t.boolean :loop, default: false, null: false
12
- t.boolean :muted, default: false, null: false
13
- end
14
- end
15
-
16
- def down
17
- drop_table :alchemy_essence_audios
18
- end
19
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class CreateEssenceVideos < ActiveRecord::Migration[6.0]
4
- def up
5
- return if table_exists? :alchemy_essence_videos
6
-
7
- create_table :alchemy_essence_videos do |t|
8
- t.references :attachment
9
- t.string :width
10
- t.string :height
11
- t.boolean :allow_fullscreen, default: true, null: false
12
- t.boolean :autoplay, default: false, null: false
13
- t.boolean :controls, default: true, null: false
14
- t.boolean :loop, default: false, null: false
15
- t.boolean :muted, default: false, null: false
16
- t.string :preload
17
- end
18
- end
19
-
20
- def down
21
- drop_table :alchemy_essence_videos
22
- end
23
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class CreateAlchemyIngredients < ActiveRecord::Migration[6.0]
4
- def change
5
- create_table :alchemy_ingredients do |t|
6
- t.references :element, null: false, foreign_key: { to_table: :alchemy_elements, on_delete: :cascade }
7
- t.string :type, index: true, null: false
8
- t.string :role, null: false
9
- t.text :value
10
- if ActiveRecord::Migration.connection.adapter_name.match?(/postgres/i)
11
- t.jsonb :data, default: {}
12
- else
13
- t.json :data
14
- end
15
- t.belongs_to :related_object, null: true, polymorphic: true, index: false
16
- t.index [:element_id, :role], unique: true
17
- t.index [:related_object_id, :related_object_type], name: "idx_alchemy_ingredient_relation"
18
-
19
- t.timestamps
20
- end
21
- end
22
- end