alchemy_cms 4.5.0 → 4.6.0
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 +23 -17
- data/.rubocop.yml +7 -15
- data/CHANGELOG.md +17 -0
- data/app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee +5 -5
- data/app/assets/javascripts/alchemy/templates/page.hbs +1 -1
- data/app/assets/stylesheets/alchemy/_mixins.scss +2 -3
- data/app/assets/stylesheets/alchemy/_variables.scss +2 -2
- data/app/assets/stylesheets/alchemy/lists.scss +0 -8
- data/app/assets/stylesheets/alchemy/nodes.scss +1 -1
- data/app/assets/stylesheets/alchemy/sitemap.scss +59 -21
- data/app/controllers/alchemy/admin/pages_controller.rb +0 -1
- data/app/controllers/alchemy/api/pages_controller.rb +2 -0
- data/app/decorators/alchemy/content_editor.rb +55 -0
- data/app/helpers/alchemy/admin/pages_helper.rb +16 -16
- data/app/models/alchemy/content.rb +8 -22
- data/app/models/alchemy/node.rb +8 -7
- data/app/models/alchemy/page.rb +11 -0
- data/app/models/alchemy/page/url_path.rb +66 -0
- data/app/serializers/alchemy/page_serializer.rb +2 -1
- data/app/serializers/alchemy/page_tree_serializer.rb +4 -3
- data/app/views/alchemy/admin/layoutpages/index.html.erb +5 -1
- data/app/views/alchemy/admin/nodes/_form.html.erb +2 -2
- data/app/views/alchemy/admin/pages/_form.html.erb +1 -1
- data/app/views/alchemy/admin/pages/_menu_fields.html.erb +33 -29
- data/app/views/alchemy/admin/pages/_page.html.erb +3 -6
- data/app/views/alchemy/admin/pages/_sitemap.html.erb +6 -0
- data/app/views/alchemy/admin/pages/info.html.erb +1 -1
- data/config/alchemy/config.yml +0 -6
- data/config/locales/alchemy.en.yml +6 -6
- data/lib/alchemy/config.rb +30 -2
- data/lib/alchemy/ssl_protection.rb +3 -1
- data/lib/alchemy/upgrader/four_point_six.rb +50 -0
- data/lib/alchemy/version.rb +1 -1
- data/lib/tasks/alchemy/convert.rake +2 -0
- data/lib/tasks/alchemy/upgrade.rake +67 -46
- metadata +6 -2
@@ -1,4 +1,10 @@
|
|
1
1
|
<div id="sitemap-wrapper">
|
2
|
+
<h4 id="sitemap_heading">
|
3
|
+
<span class="page_name"><%= Alchemy::Page.human_attribute_name(:name) %></span>
|
4
|
+
<span class="page_urlname"><%= Alchemy::Page.human_attribute_name(:urlname) %></span>
|
5
|
+
<span class="page_status"><%= Alchemy.t(:page_status) %></span>
|
6
|
+
</h4>
|
7
|
+
|
2
8
|
<p class="loading"></p>
|
3
9
|
</div>
|
4
10
|
|
@@ -18,7 +18,7 @@
|
|
18
18
|
<label><%= Alchemy::Page.human_attribute_name(:urlname) %></label>
|
19
19
|
<p><%= @page.urlname %></p>
|
20
20
|
<% else %>
|
21
|
-
<label><%= Alchemy::
|
21
|
+
<label><%= Alchemy::Page.human_attribute_name(:urlname) %></label>
|
22
22
|
<p><%= "/#{@page.urlname}" %></p>
|
23
23
|
<% end %>
|
24
24
|
</div>
|
data/config/alchemy/config.yml
CHANGED
@@ -1,12 +1,6 @@
|
|
1
1
|
# == This is the global Alchemy configuration file
|
2
2
|
#
|
3
3
|
|
4
|
-
# === Require SSL for login form and all admin modules
|
5
|
-
#
|
6
|
-
# NOTE: You have to create a SSL certificate on your server to make this work
|
7
|
-
#
|
8
|
-
require_ssl: false
|
9
|
-
|
10
4
|
# === Auto Log Out Time
|
11
5
|
#
|
12
6
|
# The amount of time of inactivity in minutes after which the user is kicked out of his current session.
|
@@ -573,7 +573,6 @@ en:
|
|
573
573
|
button_label: Upload image(s)
|
574
574
|
upload_success: "Picture %{name} uploaded successfully"
|
575
575
|
upload_failure: "Error while uploading %{name}: %{error}"
|
576
|
-
url_name: "URL-Name"
|
577
576
|
visible: "visible"
|
578
577
|
want_to_create_new_language: "Do you want to create a new empty language tree?"
|
579
578
|
want_to_make_copy_of_existing_language: "Do you want to copy an existing language tree?"
|
@@ -670,9 +669,9 @@ en:
|
|
670
669
|
page_layout:
|
671
670
|
blank: "^Please choose a page layout."
|
672
671
|
urlname:
|
673
|
-
too_short: "^
|
674
|
-
taken: "^URL-
|
675
|
-
exclusion: "^URL-
|
672
|
+
too_short: "^URL-Path is too short (minimum of 3 characters)."
|
673
|
+
taken: "^URL-Path already taken."
|
674
|
+
exclusion: "^URL-Path reserved."
|
676
675
|
alchemy/picture:
|
677
676
|
attributes:
|
678
677
|
image_file:
|
@@ -780,7 +779,7 @@ en:
|
|
780
779
|
locale: Localization
|
781
780
|
code: ISO Code
|
782
781
|
alchemy/legacy_page_url:
|
783
|
-
urlname: "URL
|
782
|
+
urlname: "URL-Path"
|
784
783
|
alchemy/node:
|
785
784
|
name: "Name"
|
786
785
|
title: "Title"
|
@@ -805,7 +804,8 @@ en:
|
|
805
804
|
tag_list: Tags
|
806
805
|
title: "Title"
|
807
806
|
updated_at: "Updated at"
|
808
|
-
urlname: "
|
807
|
+
urlname: "URL-Path"
|
808
|
+
slug: "Slug"
|
809
809
|
visible: "visible in navigation"
|
810
810
|
alchemy/picture:
|
811
811
|
image_file_name: "Filename"
|
data/lib/alchemy/config.rb
CHANGED
@@ -8,8 +8,10 @@ module Alchemy
|
|
8
8
|
# @param name [String]
|
9
9
|
#
|
10
10
|
def get(name)
|
11
|
+
check_deprecation(name)
|
11
12
|
show[name.to_s]
|
12
13
|
end
|
14
|
+
|
13
15
|
alias_method :parameter, :get
|
14
16
|
|
15
17
|
# Returns a merged configuration of the following files
|
@@ -25,11 +27,22 @@ module Alchemy
|
|
25
27
|
@config ||= merge_configs!(alchemy_config, main_app_config, env_specific_config)
|
26
28
|
end
|
27
29
|
|
30
|
+
# A list of deprecated configurations
|
31
|
+
# a value of nil means there is no new default
|
32
|
+
# any not nil value is the new default
|
33
|
+
def deprecated_configs
|
34
|
+
{
|
35
|
+
url_nesting: true,
|
36
|
+
require_ssl: nil,
|
37
|
+
auto_logout_time: nil,
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
28
41
|
private
|
29
42
|
|
30
43
|
# Alchemy default configuration
|
31
44
|
def alchemy_config
|
32
|
-
read_file(File.join(File.dirname(__FILE__),
|
45
|
+
read_file(File.join(File.dirname(__FILE__), "..", "..", "config/alchemy/config.yml"))
|
33
46
|
end
|
34
47
|
|
35
48
|
# Application specific configuration
|
@@ -54,11 +67,26 @@ module Alchemy
|
|
54
67
|
# Merges all given configs together
|
55
68
|
#
|
56
69
|
def merge_configs!(*config_files)
|
57
|
-
raise LoadError,
|
70
|
+
raise LoadError, "No Alchemy config file found!" if config_files.map(&:blank?).all?
|
71
|
+
|
58
72
|
config = {}
|
59
73
|
config_files.each { |h| config.merge!(h.stringify_keys!) }
|
60
74
|
config
|
61
75
|
end
|
76
|
+
|
77
|
+
def check_deprecation(name)
|
78
|
+
if deprecated_configs.key?(name.to_sym)
|
79
|
+
config = deprecated_configs[name.to_sym]
|
80
|
+
if config.nil?
|
81
|
+
Alchemy::Deprecation.warn("#{name} configuration is deprecated and will be removed from Alchemy 5.0")
|
82
|
+
else
|
83
|
+
value = show[name.to_s]
|
84
|
+
if value != config
|
85
|
+
Alchemy::Deprecation.warn("Setting #{name} configuration to #{value} is deprecated and will be always #{config} in Alchemy 5.0")
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
62
90
|
end
|
63
91
|
end
|
64
92
|
end
|
@@ -26,7 +26,9 @@ module Alchemy
|
|
26
26
|
|
27
27
|
# Redirects current request to https.
|
28
28
|
def enforce_ssl
|
29
|
-
redirect_to url_for(request.params.merge(protocol:
|
29
|
+
redirect_to url_for(request.params.merge(protocol: "https"))
|
30
30
|
end
|
31
|
+
|
32
|
+
deprecate :enforce_ssl, deprecator: Alchemy::Deprecation
|
31
33
|
end
|
32
34
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Alchemy
|
4
|
+
class Upgrader::FourPointSix < Upgrader
|
5
|
+
class << self
|
6
|
+
def todos
|
7
|
+
notice = <<-NOTE.strip_heredoc
|
8
|
+
|
9
|
+
ℹ️ Page visible attribute is deprecated
|
10
|
+
----------------------------------------
|
11
|
+
|
12
|
+
Page slugs will be visible in URLs of child pages all the time in the future.
|
13
|
+
Please use Menus and Tags instead to re-organize your pages if your page tree does not reflect the URL hierarchy.
|
14
|
+
|
15
|
+
A rake task to help with the migration is available.
|
16
|
+
|
17
|
+
bin/rake alchemy:upgrade:4.6:restructure_page_tree
|
18
|
+
|
19
|
+
NOTE
|
20
|
+
todo notice, "Alchemy v4.6 TODO"
|
21
|
+
end
|
22
|
+
|
23
|
+
def restructure_page_tree
|
24
|
+
desc "Move child pages of invisible pages to visible parent."
|
25
|
+
Alchemy::Deprecation.silence do
|
26
|
+
# All leaves can safely be marked visible
|
27
|
+
Alchemy::Page.leaves.update_all(visible: true)
|
28
|
+
Alchemy::Page.language_roots.each do |root_page|
|
29
|
+
# Root pages are always visible
|
30
|
+
root_page.update!(visible: true)
|
31
|
+
remove_invisible_children(root_page)
|
32
|
+
end
|
33
|
+
Alchemy::Page.update_all(visible: true)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def remove_invisible_children(page)
|
40
|
+
page.children.each { |child| remove_invisible_children(child) }
|
41
|
+
if !page.visible
|
42
|
+
page.children.reload.reverse.each do |child|
|
43
|
+
puts "Moving #{child.urlname} to right of #{page.urlname}"
|
44
|
+
child.move_to_right_of(page)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/lib/alchemy/version.rb
CHANGED
@@ -3,6 +3,7 @@ namespace :alchemy do
|
|
3
3
|
namespace :urlnames do
|
4
4
|
desc "Converts the urlname of all pages to nested url paths."
|
5
5
|
task to_nested: [:environment] do
|
6
|
+
Alchemy::Deprecation.warn('alchemy:convert:urlnames:to_nested task is deprecated and will be removed from Alchemy 5.0')
|
6
7
|
unless Alchemy::Config.get(:url_nesting)
|
7
8
|
raise "\nURL nesting is disabled! Please enable url_nesting in `config/alchemy/config.yml` first.\n\n"
|
8
9
|
end
|
@@ -18,6 +19,7 @@ namespace :alchemy do
|
|
18
19
|
|
19
20
|
desc "Converts the urlname of all pages to contain the slug only."
|
20
21
|
task to_slug: [:environment] do
|
22
|
+
Alchemy::Deprecation.warn('alchemy:convert:urlnames:to_slug task is deprecated and will be removed from Alchemy 5.0')
|
21
23
|
if Alchemy::Config.get(:url_nesting)
|
22
24
|
raise "\nURL nesting is enabled! Please disable url_nesting in `config/alchemy/config.yml` first.\n\n"
|
23
25
|
end
|
@@ -1,29 +1,32 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "alchemy/upgrader"
|
4
|
+
require "alchemy/version"
|
3
5
|
|
4
6
|
namespace :alchemy do
|
5
7
|
desc "Upgrades your app to AlchemyCMS v#{Alchemy::VERSION}."
|
6
8
|
task upgrade: [
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
"alchemy:upgrade:prepare",
|
10
|
+
"alchemy:upgrade:4.1:run", "alchemy:upgrade:4.1:todo",
|
11
|
+
"alchemy:upgrade:4.2:run", "alchemy:upgrade:4.2:todo",
|
12
|
+
"alchemy:upgrade:4.4:run", "alchemy:upgrade:4.4:todo",
|
13
|
+
"alchemy:upgrade:4.6:run", "alchemy:upgrade:4.6:todo",
|
11
14
|
] do
|
12
15
|
Alchemy::Upgrader.display_todos
|
13
16
|
end
|
14
17
|
|
15
18
|
namespace :upgrade do
|
16
|
-
desc
|
19
|
+
desc "Alchemy Upgrader: Prepares the database and updates Alchemys configuration file."
|
17
20
|
task prepare: [
|
18
|
-
|
19
|
-
|
21
|
+
"alchemy:upgrade:database",
|
22
|
+
"alchemy:upgrade:config",
|
20
23
|
]
|
21
24
|
|
22
25
|
desc "Alchemy Upgrader: Prepares the database."
|
23
26
|
task database: [
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
+
"alchemy:install:migrations",
|
28
|
+
"db:migrate",
|
29
|
+
"alchemy:db:seed",
|
27
30
|
]
|
28
31
|
|
29
32
|
desc "Alchemy Upgrader: Copy configuration file."
|
@@ -37,19 +40,19 @@ namespace :alchemy do
|
|
37
40
|
end
|
38
41
|
end
|
39
42
|
|
40
|
-
desc
|
41
|
-
task
|
42
|
-
|
43
|
-
|
44
|
-
|
43
|
+
desc "Upgrade Alchemy to v4.1"
|
44
|
+
task "4.1" => [
|
45
|
+
"alchemy:upgrade:prepare",
|
46
|
+
"alchemy:upgrade:4.1:run",
|
47
|
+
"alchemy:upgrade:4.1:todo",
|
45
48
|
] do
|
46
49
|
Alchemy::Upgrader.display_todos
|
47
50
|
end
|
48
51
|
|
49
|
-
namespace
|
50
|
-
task run: [
|
52
|
+
namespace "4.1" do
|
53
|
+
task run: ["alchemy:upgrade:4.1:harden_acts_as_taggable_on_migrations"]
|
51
54
|
|
52
|
-
desc
|
55
|
+
desc "Harden acts_as_taggable_on migrations"
|
53
56
|
task harden_acts_as_taggable_on_migrations: [:environment] do
|
54
57
|
Alchemy::Upgrader::FourPointOne.harden_acts_as_taggable_on_migrations
|
55
58
|
end
|
@@ -59,45 +62,45 @@ namespace :alchemy do
|
|
59
62
|
end
|
60
63
|
end
|
61
64
|
|
62
|
-
desc
|
63
|
-
task
|
64
|
-
|
65
|
-
|
66
|
-
|
65
|
+
desc "Upgrade Alchemy to v4.2"
|
66
|
+
task "4.2" => [
|
67
|
+
"alchemy:upgrade:prepare",
|
68
|
+
"alchemy:upgrade:4.2:run",
|
69
|
+
"alchemy:upgrade:4.2:todo",
|
67
70
|
] do
|
68
71
|
Alchemy::Upgrader.display_todos
|
69
72
|
end
|
70
73
|
|
71
|
-
namespace
|
74
|
+
namespace "4.2" do
|
72
75
|
task run: [
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
76
|
+
"alchemy:upgrade:4.2:convert_picture_galleries",
|
77
|
+
"alchemy:upgrade:4.2:migrate_picture_galleries",
|
78
|
+
"alchemy:upgrade:4.2:convert_cells",
|
79
|
+
"alchemy:upgrade:4.2:migrate_cells",
|
80
|
+
"alchemy:upgrade:4.2:update_element_partial_name_variable",
|
78
81
|
]
|
79
82
|
|
80
|
-
desc
|
83
|
+
desc "Convert `picture_gallery` element definitions to `nestable_elements`."
|
81
84
|
task convert_picture_galleries: [:environment] do
|
82
85
|
Alchemy::Upgrader::FourPointTwo.convert_picture_galleries
|
83
86
|
end
|
84
87
|
|
85
|
-
desc
|
88
|
+
desc "Migrate `picture_gallery` elements to `nestable_elements`."
|
86
89
|
task migrate_picture_galleries: [:environment] do
|
87
90
|
Alchemy::Upgrader::FourPointTwo.migrate_picture_galleries
|
88
91
|
end
|
89
92
|
|
90
|
-
desc
|
93
|
+
desc "Convert cells config to fixed nestable elements."
|
91
94
|
task convert_cells: [:environment] do
|
92
95
|
Alchemy::Upgrader::FourPointTwo.convert_cells
|
93
96
|
end
|
94
97
|
|
95
|
-
desc
|
96
|
-
task migrate_cells: [
|
98
|
+
desc "Migrate existing cells to fixed nestable elements."
|
99
|
+
task migrate_cells: ["alchemy:install:migrations", "db:migrate"] do
|
97
100
|
Alchemy::Upgrader::FourPointTwo.migrate_cells
|
98
101
|
end
|
99
102
|
|
100
|
-
desc
|
103
|
+
desc "Update element views to use element partial name variable."
|
101
104
|
task :update_element_partial_name_variable do
|
102
105
|
Alchemy::Upgrader::FourPointTwo.update_element_views_variable_name
|
103
106
|
end
|
@@ -107,19 +110,19 @@ namespace :alchemy do
|
|
107
110
|
end
|
108
111
|
end
|
109
112
|
|
110
|
-
desc
|
111
|
-
task
|
112
|
-
|
113
|
-
|
114
|
-
|
113
|
+
desc "Upgrade Alchemy to v4.4"
|
114
|
+
task "4.4" => [
|
115
|
+
"alchemy:upgrade:prepare",
|
116
|
+
"alchemy:upgrade:4.4:run",
|
117
|
+
"alchemy:upgrade:4.4:todo",
|
115
118
|
] do
|
116
119
|
Alchemy::Upgrader.display_todos
|
117
120
|
end
|
118
121
|
|
119
|
-
namespace
|
122
|
+
namespace "4.4" do
|
120
123
|
task run: [
|
121
|
-
|
122
|
-
|
124
|
+
"alchemy:upgrade:4.4:rename_element_views",
|
125
|
+
"alchemy:upgrade:4.4:update_local_variable",
|
123
126
|
]
|
124
127
|
|
125
128
|
desc "Remove '_view' suffix from element views."
|
@@ -127,7 +130,7 @@ namespace :alchemy do
|
|
127
130
|
Alchemy::Upgrader::FourPointFour.rename_element_views
|
128
131
|
end
|
129
132
|
|
130
|
-
desc
|
133
|
+
desc "Update element views local variable to element name."
|
131
134
|
task update_local_variable: [:environment] do
|
132
135
|
Alchemy::Upgrader::FourPointFour.update_local_variable
|
133
136
|
end
|
@@ -136,5 +139,23 @@ namespace :alchemy do
|
|
136
139
|
Alchemy::Upgrader::FourPointFour.alchemy_4_4_todos
|
137
140
|
end
|
138
141
|
end
|
142
|
+
|
143
|
+
desc "Upgrade Alchemy to v4.6"
|
144
|
+
task "4.6" => [
|
145
|
+
"alchemy:upgrade:prepare",
|
146
|
+
]
|
147
|
+
|
148
|
+
namespace "4.6" do
|
149
|
+
task run: []
|
150
|
+
|
151
|
+
desc "Move child pages of invisible pages to visible parent."
|
152
|
+
task restructure_page_tree: [:environment] do
|
153
|
+
Alchemy::Upgrader::FourPointSix.restructure_page_tree
|
154
|
+
end
|
155
|
+
|
156
|
+
task :todo do
|
157
|
+
Alchemy::Upgrader::FourPointSix.todos
|
158
|
+
end
|
159
|
+
end
|
139
160
|
end
|
140
161
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alchemy_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas von Deyen
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2020-
|
16
|
+
date: 2020-06-04 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: active_model_serializers
|
@@ -739,6 +739,7 @@ files:
|
|
739
739
|
- app/controllers/concerns/alchemy/locale_redirects.rb
|
740
740
|
- app/controllers/concerns/alchemy/page_redirects.rb
|
741
741
|
- app/controllers/concerns/alchemy/site_redirects.rb
|
742
|
+
- app/decorators/alchemy/content_editor.rb
|
742
743
|
- app/helpers/alchemy/admin/attachments_helper.rb
|
743
744
|
- app/helpers/alchemy/admin/base_helper.rb
|
744
745
|
- app/helpers/alchemy/admin/contents_helper.rb
|
@@ -790,6 +791,7 @@ files:
|
|
790
791
|
- app/models/alchemy/page/page_naming.rb
|
791
792
|
- app/models/alchemy/page/page_natures.rb
|
792
793
|
- app/models/alchemy/page/page_scopes.rb
|
794
|
+
- app/models/alchemy/page/url_path.rb
|
793
795
|
- app/models/alchemy/picture.rb
|
794
796
|
- app/models/alchemy/picture/transformations.rb
|
795
797
|
- app/models/alchemy/picture/url.rb
|
@@ -1102,6 +1104,7 @@ files:
|
|
1102
1104
|
- lib/alchemy/upgrader.rb
|
1103
1105
|
- lib/alchemy/upgrader/four_point_four.rb
|
1104
1106
|
- lib/alchemy/upgrader/four_point_one.rb
|
1107
|
+
- lib/alchemy/upgrader/four_point_six.rb
|
1105
1108
|
- lib/alchemy/upgrader/four_point_two.rb
|
1106
1109
|
- lib/alchemy/upgrader/tasks/cells_migration.rb
|
1107
1110
|
- lib/alchemy/upgrader/tasks/cells_upgrader.rb
|
@@ -1246,3 +1249,4 @@ signing_key:
|
|
1246
1249
|
specification_version: 4
|
1247
1250
|
summary: A powerful, userfriendly and flexible CMS for Rails 5
|
1248
1251
|
test_files: []
|
1252
|
+
...
|