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.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +0 -3
- data/.gitignore +1 -6
- data/CHANGELOG.md +19 -44
- data/Gemfile +1 -1
- data/Rakefile +14 -9
- data/alchemy_cms.gemspec +2 -3
- data/app/assets/javascripts/alchemy/alchemy.dirty.js.coffee +1 -1
- data/app/assets/javascripts/alchemy/alchemy.element_editors.js.coffee +18 -32
- data/app/assets/javascripts/alchemy/alchemy.elements_window.js.coffee +2 -2
- data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +2 -2
- data/app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee +27 -29
- data/app/assets/stylesheets/alchemy/elements.scss +16 -35
- data/app/assets/stylesheets/alchemy/forms.scss +0 -4
- data/app/assets/stylesheets/alchemy/node-select.scss +2 -2
- data/app/controllers/alchemy/admin/attachments_controller.rb +0 -1
- data/app/controllers/alchemy/admin/elements_controller.rb +7 -32
- data/app/controllers/alchemy/admin/pages_controller.rb +1 -1
- data/app/controllers/alchemy/admin/pictures_controller.rb +1 -1
- data/app/controllers/alchemy/admin/resources_controller.rb +1 -18
- data/app/controllers/alchemy/api/elements_controller.rb +0 -2
- data/app/controllers/alchemy/api/pages_controller.rb +8 -4
- data/app/controllers/alchemy/messages_controller.rb +9 -9
- data/app/controllers/alchemy/pages_controller.rb +23 -18
- data/app/decorators/alchemy/element_editor.rb +10 -30
- data/app/helpers/alchemy/admin/elements_helper.rb +0 -2
- data/app/helpers/alchemy/elements_block_helper.rb +5 -42
- data/app/helpers/alchemy/elements_helper.rb +3 -11
- data/app/helpers/alchemy/pages_helper.rb +0 -4
- data/app/models/alchemy/attachment.rb +6 -3
- data/app/models/alchemy/base_record.rb +2 -0
- data/app/models/alchemy/eager_loading.rb +0 -1
- data/app/models/alchemy/element/element_ingredients.rb +1 -8
- data/app/models/alchemy/element/presenters.rb +9 -25
- data/app/models/alchemy/element.rb +2 -18
- data/app/models/alchemy/ingredient.rb +17 -6
- data/app/models/alchemy/ingredients/audio.rb +2 -0
- data/app/models/alchemy/ingredients/datetime.rb +3 -1
- data/app/models/alchemy/ingredients/file.rb +7 -0
- data/app/models/alchemy/ingredients/headline.rb +6 -0
- data/app/models/alchemy/ingredients/link.rb +2 -0
- data/app/models/alchemy/ingredients/node.rb +2 -0
- data/app/models/alchemy/ingredients/page.rb +2 -0
- data/app/models/alchemy/ingredients/picture.rb +11 -0
- data/app/models/alchemy/ingredients/richtext.rb +6 -0
- data/app/models/alchemy/ingredients/select.rb +1 -0
- data/app/models/alchemy/ingredients/text.rb +8 -0
- data/app/models/alchemy/ingredients/video.rb +2 -0
- data/app/models/alchemy/node.rb +9 -6
- data/app/models/alchemy/page/page_elements.rb +5 -26
- data/app/models/alchemy/page/page_layouts.rb +0 -14
- data/app/models/alchemy/page/page_natures.rb +0 -10
- data/app/models/alchemy/page.rb +0 -10
- data/app/models/alchemy/picture/transformations.rb +0 -30
- data/app/models/alchemy/picture/url.rb +1 -1
- data/app/models/alchemy/picture.rb +14 -13
- data/app/models/alchemy/picture_thumb/create.rb +7 -18
- data/app/models/alchemy/picture_thumb/file_store.rb +33 -0
- data/app/models/alchemy/picture_thumb.rb +10 -10
- data/app/models/concerns/alchemy/picture_thumbnails.rb +2 -6
- data/app/serializers/alchemy/element_serializer.rb +1 -6
- data/app/services/alchemy/delete_elements.rb +1 -7
- data/app/services/alchemy/duplicate_element.rb +1 -6
- data/app/views/alchemy/admin/elements/_element.html.erb +5 -22
- data/app/views/alchemy/admin/elements/create.js.erb +1 -1
- data/app/views/alchemy/admin/elements/fold.js.erb +2 -2
- data/app/views/alchemy/admin/elements/order.js.erb +1 -1
- data/app/views/alchemy/admin/elements/update.js.erb +1 -2
- data/app/views/alchemy/admin/pages/_external_link.html.erb +2 -2
- data/app/views/alchemy/admin/pages/_file_link.html.erb +2 -2
- data/app/views/alchemy/admin/pages/_internal_link.html.erb +2 -2
- data/app/views/alchemy/admin/pages/_table.html.erb +0 -6
- data/app/views/alchemy/admin/pages/_tinymce_custom_config.html.erb +3 -6
- data/app/views/alchemy/admin/pages/edit.html.erb +1 -1
- data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +1 -3
- data/app/views/alchemy/admin/pictures/_infos.html.erb +4 -6
- data/app/views/alchemy/admin/resources/_per_page_select.html.erb +1 -1
- data/app/views/alchemy/ingredients/_boolean_editor.html.erb +1 -1
- data/app/views/alchemy/ingredients/_headline_editor.html.erb +1 -1
- data/app/views/alchemy/ingredients/_html_editor.html.erb +1 -1
- data/app/views/alchemy/ingredients/_node_editor.html.erb +1 -1
- data/app/views/alchemy/ingredients/_picture_editor.html.erb +4 -4
- data/app/views/alchemy/ingredients/_select_editor.html.erb +2 -2
- data/app/views/alchemy/ingredients/_text_editor.html.erb +1 -1
- data/app/views/alchemy/ingredients/shared/_link_tools.html.erb +3 -3
- data/app/views/alchemy/pages/_meta_data.html.erb +0 -1
- data/app/views/layouts/alchemy/admin.html.erb +5 -1
- data/config/alchemy/config.yml +6 -6
- data/config/brakeman.ignore +56 -57
- data/config/locales/alchemy.en.yml +99 -113
- data/config/routes.rb +1 -16
- data/db/migrate/20230121212637_alchemy_six_point_one.rb +248 -0
- data/lib/alchemy/cache_digests/template_tracker.rb +6 -7
- data/lib/alchemy/config.rb +2 -2
- data/lib/alchemy/deprecation.rb +1 -1
- data/lib/alchemy/errors.rb +0 -11
- data/lib/alchemy/hints.rb +10 -10
- data/lib/alchemy/permissions.rb +4 -17
- data/lib/alchemy/routing_constraints.rb +3 -3
- data/lib/alchemy/searchable_resource.rb +38 -0
- data/lib/alchemy/seeder.rb +2 -8
- data/lib/alchemy/tasks/tidy.rb +0 -38
- data/lib/alchemy/test_support/capybara_helpers.rb +69 -0
- data/lib/alchemy/test_support/factories/element_factory.rb +0 -6
- data/lib/alchemy/test_support/factories/ingredient_factory.rb +1 -1
- data/lib/alchemy/test_support/factories/page_factory.rb +4 -2
- data/lib/alchemy/test_support/having_picture_thumbnails_examples.rb +0 -20
- data/lib/alchemy/test_support/shared_dom_ids_examples.rb +1 -1
- data/lib/alchemy/test_support/shared_ingredient_examples.rb +1 -1
- data/lib/alchemy/tinymce.rb +1 -18
- data/lib/alchemy/upgrader/seven_point_zero.rb +45 -0
- data/lib/alchemy/upgrader/tasks/.keep +0 -0
- data/lib/alchemy/upgrader.rb +8 -3
- data/lib/alchemy/version.rb +1 -1
- data/lib/alchemy.rb +0 -19
- data/lib/alchemy_cms.rb +1 -2
- data/lib/generators/alchemy/elements/elements_generator.rb +0 -1
- data/lib/generators/alchemy/elements/templates/view.html.erb +1 -10
- data/lib/generators/alchemy/elements/templates/view.html.haml +1 -9
- data/lib/generators/alchemy/elements/templates/view.html.slim +1 -9
- data/lib/generators/alchemy/install/files/alchemy.en.yml +7 -8
- data/lib/generators/alchemy/install/files/application.html.erb +1 -1
- data/lib/generators/alchemy/install/install_generator.rb +18 -34
- data/lib/generators/alchemy/install/templates/elements.yml.tt +12 -12
- data/lib/non_stupid_digest_assets.rb +1 -1
- data/lib/tasks/alchemy/thumbnails.rake +2 -21
- data/lib/tasks/alchemy/tidy.rake +1 -12
- data/lib/tasks/alchemy/upgrade.rake +10 -47
- data/package/dist/admin.js +16 -0
- data/package/dist/admin.js.map +7 -0
- data/package.json +5 -3
- metadata +18 -147
- data/app/controllers/alchemy/admin/contents_controller.rb +0 -21
- data/app/controllers/alchemy/admin/essence_audios_controller.rb +0 -30
- data/app/controllers/alchemy/admin/essence_files_controller.rb +0 -31
- data/app/controllers/alchemy/admin/essence_pictures_controller.rb +0 -43
- data/app/controllers/alchemy/admin/essence_videos_controller.rb +0 -34
- data/app/controllers/alchemy/api/contents_controller.rb +0 -52
- data/app/decorators/alchemy/content_editor.rb +0 -119
- data/app/helpers/alchemy/admin/contents_helper.rb +0 -42
- data/app/helpers/alchemy/admin/essences_helper.rb +0 -31
- data/app/models/alchemy/content/factory.rb +0 -143
- data/app/models/alchemy/content.rb +0 -247
- data/app/models/alchemy/element/element_contents.rb +0 -200
- data/app/models/alchemy/element/element_essences.rb +0 -133
- data/app/models/alchemy/essence_audio.rb +0 -13
- data/app/models/alchemy/essence_boolean.rb +0 -20
- data/app/models/alchemy/essence_date.rb +0 -25
- data/app/models/alchemy/essence_file.rb +0 -49
- data/app/models/alchemy/essence_headline.rb +0 -41
- data/app/models/alchemy/essence_html.rb +0 -23
- data/app/models/alchemy/essence_link.rb +0 -21
- data/app/models/alchemy/essence_node.rb +0 -19
- data/app/models/alchemy/essence_page.rb +0 -17
- data/app/models/alchemy/essence_picture.rb +0 -67
- data/app/models/alchemy/essence_picture_view.rb +0 -90
- data/app/models/alchemy/essence_richtext.rb +0 -44
- data/app/models/alchemy/essence_select.rb +0 -19
- data/app/models/alchemy/essence_text.rb +0 -23
- data/app/models/alchemy/essence_video.rb +0 -13
- data/app/serializers/alchemy/content_serializer.rb +0 -17
- data/app/serializers/alchemy/essence_boolean_serializer.rb +0 -10
- data/app/serializers/alchemy/essence_date_serializer.rb +0 -10
- data/app/serializers/alchemy/essence_file_serializer.rb +0 -13
- data/app/serializers/alchemy/essence_html_serializer.rb +0 -10
- data/app/serializers/alchemy/essence_link_serializer.rb +0 -13
- data/app/serializers/alchemy/essence_picture_serializer.rb +0 -28
- data/app/serializers/alchemy/essence_richtext_serializer.rb +0 -11
- data/app/serializers/alchemy/essence_select_serializer.rb +0 -10
- data/app/serializers/alchemy/essence_text_serializer.rb +0 -22
- data/app/views/alchemy/admin/contents/create.js.erb +0 -21
- data/app/views/alchemy/admin/essence_audios/edit.html.erb +0 -7
- data/app/views/alchemy/admin/essence_files/edit.html.erb +0 -21
- data/app/views/alchemy/admin/essence_pictures/destroy.js.erb +0 -5
- data/app/views/alchemy/admin/essence_pictures/edit.html.erb +0 -30
- data/app/views/alchemy/admin/essence_pictures/save_link.js.erb +0 -3
- data/app/views/alchemy/admin/essence_pictures/update.js.erb +0 -8
- data/app/views/alchemy/admin/essence_videos/edit.html.erb +0 -12
- data/app/views/alchemy/essences/_essence_audio_editor.html.erb +0 -4
- data/app/views/alchemy/essences/_essence_audio_view.html.erb +0 -15
- data/app/views/alchemy/essences/_essence_boolean_editor.html.erb +0 -11
- data/app/views/alchemy/essences/_essence_boolean_view.html.erb +0 -2
- data/app/views/alchemy/essences/_essence_date_editor.html.erb +0 -16
- data/app/views/alchemy/essences/_essence_date_view.html.erb +0 -10
- data/app/views/alchemy/essences/_essence_file_editor.html.erb +0 -54
- data/app/views/alchemy/essences/_essence_file_view.html.erb +0 -18
- data/app/views/alchemy/essences/_essence_headline_editor.html.erb +0 -36
- data/app/views/alchemy/essences/_essence_headline_view.html.erb +0 -10
- data/app/views/alchemy/essences/_essence_html_editor.html.erb +0 -10
- data/app/views/alchemy/essences/_essence_html_view.html.erb +0 -2
- data/app/views/alchemy/essences/_essence_link_editor.html.erb +0 -30
- data/app/views/alchemy/essences/_essence_link_view.html.erb +0 -10
- data/app/views/alchemy/essences/_essence_node_editor.html.erb +0 -27
- data/app/views/alchemy/essences/_essence_node_view.html.erb +0 -1
- data/app/views/alchemy/essences/_essence_page_editor.html.erb +0 -26
- data/app/views/alchemy/essences/_essence_page_view.html.erb +0 -5
- data/app/views/alchemy/essences/_essence_picture_editor.html.erb +0 -59
- data/app/views/alchemy/essences/_essence_picture_view.html.erb +0 -6
- data/app/views/alchemy/essences/_essence_richtext_editor.html.erb +0 -14
- data/app/views/alchemy/essences/_essence_richtext_view.html.erb +0 -4
- data/app/views/alchemy/essences/_essence_select_editor.html.erb +0 -28
- data/app/views/alchemy/essences/_essence_select_view.html.erb +0 -2
- data/app/views/alchemy/essences/_essence_text_editor.html.erb +0 -29
- data/app/views/alchemy/essences/_essence_text_view.html.erb +0 -17
- data/app/views/alchemy/essences/_essence_video_editor.html.erb +0 -4
- data/app/views/alchemy/essences/_essence_video_view.html.erb +0 -19
- data/app/views/alchemy/essences/shared/_essence_picture_tools.html.erb +0 -59
- data/app/views/alchemy/essences/shared/_linkable_essence_tools.html.erb +0 -20
- data/app/views/alchemy/pages/show.rss.builder +0 -21
- data/db/migrate/20200226213334_alchemy_four_point_four.rb +0 -313
- data/db/migrate/20200423073425_create_alchemy_essence_nodes.rb +0 -11
- data/db/migrate/20200504210159_remove_site_id_from_nodes.rb +0 -28
- data/db/migrate/20200505215518_add_language_id_foreign_key_to_alchemy_pages.rb +0 -8
- data/db/migrate/20200511113603_add_menu_type_to_alchemy_nodes.rb +0 -27
- data/db/migrate/20200514091507_make_page_layoutpage_null_false.rb +0 -6
- data/db/migrate/20200519073500_remove_visible_from_alchemy_pages.rb +0 -24
- data/db/migrate/20200617110713_create_alchemy_picture_thumbs.rb +0 -22
- data/db/migrate/20200907111332_remove_tri_state_booleans.rb +0 -33
- data/db/migrate/20201207131309_create_page_versions.rb +0 -19
- data/db/migrate/20201207135820_add_page_version_id_to_alchemy_elements.rb +0 -76
- data/db/migrate/20210205143548_rename_public_on_and_public_until_on_alchemy_pages.rb +0 -10
- data/db/migrate/20210326105046_add_sanitized_body_to_alchemy_essence_richtexts.rb +0 -7
- data/db/migrate/20210406093436_add_alchemy_essence_headlines.rb +0 -12
- data/db/migrate/20210506135919_create_essence_audios.rb +0 -19
- data/db/migrate/20210506140258_create_essence_videos.rb +0 -23
- data/db/migrate/20210508091432_create_alchemy_ingredients.rb +0 -22
- data/db/migrate/20220514072456_restrict_on_delete_page_id_foreign_key_from_alchemy_nodes.rb +0 -13
- data/db/migrate/20220622130905_add_playsinline_to_alchemy_essence_videos.rb +0 -9
- data/lib/alchemy/essence.rb +0 -250
- data/lib/alchemy/tasks/usage.rb +0 -34
- data/lib/alchemy/test_support/essence_shared_examples.rb +0 -271
- data/lib/alchemy/test_support/factories/content_factory.rb +0 -20
- data/lib/alchemy/test_support/factories/essence_audio_factory.rb +0 -7
- data/lib/alchemy/test_support/factories/essence_file_factory.rb +0 -7
- data/lib/alchemy/test_support/factories/essence_page_factory.rb +0 -7
- data/lib/alchemy/test_support/factories/essence_picture_factory.rb +0 -11
- data/lib/alchemy/test_support/factories/essence_text_factory.rb +0 -7
- data/lib/alchemy/test_support/factories/essence_video_factory.rb +0 -7
- data/lib/alchemy/upgrader/five_point_zero.rb +0 -41
- data/lib/alchemy/upgrader/six_point_zero.rb +0 -21
- data/lib/alchemy/upgrader/tasks/add_page_versions.rb +0 -33
- data/lib/alchemy/upgrader/tasks/element_views_updater.rb +0 -34
- data/lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb +0 -29
- data/lib/alchemy/upgrader/tasks/ingredients_migrator.rb +0 -73
- data/lib/generators/alchemy/essence/essence_generator.rb +0 -49
- data/lib/generators/alchemy/essence/templates/editor.html.erb +0 -17
- data/lib/generators/alchemy/essence/templates/view.html.erb +0 -2
- data/lib/generators/alchemy/install/files/babel.config.js +0 -64
- 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(
|
45
|
+
create(
|
46
|
+
:alchemy_element,
|
46
47
|
name: name,
|
47
48
|
page_version: page.public_version,
|
48
|
-
|
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
|
|
@@ -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: "
|
6
|
+
let(:element) { build(:alchemy_element, name: "article") }
|
7
7
|
|
8
8
|
subject(:ingredient) do
|
9
9
|
described_class.new(
|
data/lib/alchemy/tinymce.rb
CHANGED
@@ -35,11 +35,7 @@ module Alchemy
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def custom_configs_present?(page)
|
38
|
-
|
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
|
data/lib/alchemy/upgrader.rb
CHANGED
@@ -26,9 +26,14 @@ module Alchemy
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def update_npm_package
|
29
|
-
desc "
|
30
|
-
|
31
|
-
|
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
|
data/lib/alchemy/version.rb
CHANGED
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.
|
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.
|
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.
|
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
|
13
|
-
|
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
|
19
|
-
|
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:
|
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
|
28
|
-
|
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
|
-
<%=
|
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
|
-
|
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
|
-
|
134
|
-
File.
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
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
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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 -%>
|
@@ -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
|
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.
|
30
|
+
merge(Alchemy::Element.published)
|
50
31
|
|
51
32
|
if ENV["ELEMENTS"].present?
|
52
33
|
ingredient_pictures = ingredient_pictures.merge(
|
data/lib/tasks/alchemy/tidy.rake
CHANGED
@@ -17,15 +17,9 @@ namespace :alchemy do
|
|
17
17
|
Alchemy::Tidy.update_element_positions
|
18
18
|
end
|
19
19
|
|
20
|
-
desc "
|
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:
|
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
|
40
|
-
task "
|
38
|
+
desc "Upgrade Alchemy to v7.0"
|
39
|
+
task "7.0" => [
|
41
40
|
"alchemy:upgrade:prepare",
|
42
|
-
"alchemy:upgrade:
|
41
|
+
"alchemy:upgrade:7.0:run",
|
43
42
|
] do
|
44
43
|
Alchemy::Upgrader.display_todos
|
45
44
|
end
|
46
45
|
|
47
|
-
namespace "
|
46
|
+
namespace "7.0" do
|
48
47
|
task "run" => [
|
49
|
-
"alchemy:upgrade:
|
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 "
|
55
|
-
task
|
56
|
-
|
57
|
-
|
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
|