alchemy_cms 6.0.9 → 6.0.10
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 -21
- data/CHANGELOG.md +11 -0
- data/app/controllers/alchemy/api/pages_controller.rb +3 -8
- data/app/controllers/alchemy/pages_controller.rb +2 -2
- data/app/helpers/alchemy/elements_block_helper.rb +12 -3
- data/app/helpers/alchemy/elements_helper.rb +4 -3
- data/app/helpers/alchemy/url_helper.rb +6 -3
- data/app/models/alchemy/content.rb +1 -0
- data/app/models/alchemy/element/presenters.rb +1 -1
- data/app/models/alchemy/essence_audio.rb +1 -0
- data/app/models/alchemy/essence_boolean.rb +1 -0
- data/app/models/alchemy/essence_date.rb +1 -0
- data/app/models/alchemy/essence_file.rb +1 -0
- data/app/models/alchemy/essence_headline.rb +1 -0
- data/app/models/alchemy/essence_html.rb +1 -0
- data/app/models/alchemy/essence_link.rb +1 -0
- data/app/models/alchemy/essence_node.rb +1 -0
- data/app/models/alchemy/essence_page.rb +1 -0
- data/app/models/alchemy/essence_picture.rb +1 -0
- data/app/models/alchemy/essence_picture_view.rb +1 -0
- data/app/models/alchemy/essence_richtext.rb +1 -0
- data/app/models/alchemy/essence_select.rb +1 -0
- data/app/models/alchemy/essence_text.rb +1 -0
- data/app/models/alchemy/essence_video.rb +1 -0
- data/app/models/alchemy/ingredients/boolean.rb +3 -1
- data/app/views/alchemy/pages/show.rss.builder +2 -2
- data/lib/alchemy/essence.rb +5 -1
- data/lib/alchemy/permissions.rb +3 -1
- data/lib/alchemy/version.rb +1 -1
- data/lib/alchemy.rb +19 -0
- data/package.json +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03cfa47992384280268b398c712c0d2fe88402482c1acd514406ba784e5e74d0
|
4
|
+
data.tar.gz: 9793cf56d7592cdd552009efac7f065d0ee1c6511b4d4d2e6307997c850c88d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3600a98fec4301d4d5ed8dd156ecde606a1857cdd028e5c97318ca3284d19e54e13614e1192ef69bff3805037c325d8a57821efbebf449101cda575559c6874
|
7
|
+
data.tar.gz: e0d22ac66fb2b8d75a5bc3719372f12be3332dedad315f5f8758850407b7690a98d5eb24ac0b905199de40a7ba9f13930ef6c79c36304b02ee894f7410ad1273
|
data/.github/workflows/ci.yml
CHANGED
@@ -9,11 +9,9 @@ jobs:
|
|
9
9
|
fail-fast: false
|
10
10
|
matrix:
|
11
11
|
rails:
|
12
|
-
- "6.0"
|
13
12
|
- "6.1"
|
14
13
|
- "7.0"
|
15
14
|
ruby:
|
16
|
-
- "2.6"
|
17
15
|
- "2.7"
|
18
16
|
- "3.0"
|
19
17
|
- "3.1"
|
@@ -21,25 +19,6 @@ jobs:
|
|
21
19
|
- mysql
|
22
20
|
- postgresql
|
23
21
|
- mariadb
|
24
|
-
exclude:
|
25
|
-
- rails: "6.0"
|
26
|
-
ruby: "3.1"
|
27
|
-
database: mysql
|
28
|
-
- rails: "6.0"
|
29
|
-
ruby: "3.1"
|
30
|
-
database: postgresql
|
31
|
-
- rails: "6.0"
|
32
|
-
ruby: "3.1"
|
33
|
-
database: mariadb
|
34
|
-
- rails: "7.0"
|
35
|
-
ruby: "2.6"
|
36
|
-
database: mysql
|
37
|
-
- rails: "7.0"
|
38
|
-
ruby: "2.6"
|
39
|
-
database: postgresql
|
40
|
-
- rails: "7.0"
|
41
|
-
ruby: "2.6"
|
42
|
-
database: mariadb
|
43
22
|
env:
|
44
23
|
DB: ${{ matrix.database }}
|
45
24
|
DB_USER: alchemy_user
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## 6.0.10 (2022-09-04)
|
2
|
+
|
3
|
+
- Deprecate essence classes [#2371](https://github.com/AlchemyCMS/alchemy_cms/pull/2371) ([tvdeyen](https://github.com/tvdeyen))
|
4
|
+
- Deprecate full_url_for_element helper [#2368](https://github.com/AlchemyCMS/alchemy_cms/pull/2368) ([tvdeyen](https://github.com/tvdeyen))
|
5
|
+
- Deprecate element_dom_id helper [#2368](https://github.com/AlchemyCMS/alchemy_cms/pull/2368) ([tvdeyen](https://github.com/tvdeyen))
|
6
|
+
- Use position instead of id for element dom_id [#2368](https://github.com/AlchemyCMS/alchemy_cms/pull/2368) ([tvdeyen](https://github.com/tvdeyen))
|
7
|
+
- Fix ingredient boolean preview text [#2367](https://github.com/AlchemyCMS/alchemy_cms/pull/2367) ([tvdeyen](https://github.com/tvdeyen))
|
8
|
+
- Decide locale prefix with page language in show_alchemy_page_url helper [#2366](https://github.com/AlchemyCMS/alchemy_cms/pull/2366) ([tvdeyen](https://github.com/tvdeyen))
|
9
|
+
- Use cache_key_with_version in page_etag [#2365](https://github.com/AlchemyCMS/alchemy_cms/pull/2365) ([tvdeyen](https://github.com/tvdeyen))
|
10
|
+
- Fix author edit_content permissions [#2364](https://github.com/AlchemyCMS/alchemy_cms/pull/2364) ([tvdeyen](https://github.com/tvdeyen))
|
11
|
+
|
1
12
|
## 6.0.9 (2022-07-25)
|
2
13
|
|
3
14
|
- Allow Site managers to remove page locks [#2360](https://github.com/AlchemyCMS/alchemy_cms/pull/2360) ([mamhoff](https://github.com/mamhoff))
|
@@ -8,14 +8,9 @@ module Alchemy
|
|
8
8
|
# Returns all pages as json object
|
9
9
|
#
|
10
10
|
def index
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
else
|
15
|
-
language = Alchemy::Language.find_by(id: params[:language_id]) || Alchemy::Language.current
|
16
|
-
@pages = Alchemy::Page.accessible_by(current_ability, :index)
|
17
|
-
@pages = @pages.where(language: language)
|
18
|
-
end
|
11
|
+
language = Alchemy::Language.find_by(id: params[:language_id]) || Alchemy::Language.current
|
12
|
+
@pages = Alchemy::Page.accessible_by(current_ability, :index)
|
13
|
+
@pages = @pages.where(language: language)
|
19
14
|
@pages = @pages.includes(*page_includes)
|
20
15
|
@pages = @pages.ransack(params[:q]).result
|
21
16
|
|
@@ -218,12 +218,12 @@ module Alchemy
|
|
218
218
|
#
|
219
219
|
# IMPORTANT:
|
220
220
|
#
|
221
|
-
# If your user does not have a +
|
221
|
+
# If your user does not have a +cache_key_with_version+ method (i.e. it's not an ActiveRecord model),
|
222
222
|
# you have to ensure to implement it and return a unique identifier for that particular user.
|
223
223
|
# Otherwise all users will see the same cached page, regardless of user's state.
|
224
224
|
#
|
225
225
|
def page_etag
|
226
|
-
@page
|
226
|
+
[@page, current_alchemy_user]
|
227
227
|
end
|
228
228
|
|
229
229
|
# We only render the page if either the cache is disabled for this page
|
@@ -29,9 +29,16 @@ module Alchemy
|
|
29
29
|
# If the element uses +ingredients+ it renders the ingredient record.
|
30
30
|
#
|
31
31
|
def render(name, options = {}, html_options = {})
|
32
|
-
renderable = element.ingredient_by_role(name) || content(name)
|
32
|
+
renderable = element.ingredient_by_role(name) || Alchemy::Deprecation.silence { content(name) }
|
33
33
|
return if renderable.nil?
|
34
34
|
|
35
|
+
if Alchemy::DEPRECATED_ESSENCE_CLASSES.include?(renderable.try(:essence)&.class&.name)
|
36
|
+
Alchemy::Deprecation.warn(
|
37
|
+
"Using a '#{renderable.essence.class.name.demodulize}' content is deprecated. " \
|
38
|
+
"Please use a '#{Alchemy::DEPRECATED_ESSENCE_CLASS_MAPPING[renderable.essence.class.name].demodulize}' ingredient instead."
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
35
42
|
helpers.render(renderable, {
|
36
43
|
options: options,
|
37
44
|
html_options: html_options,
|
@@ -66,7 +73,9 @@ module Alchemy
|
|
66
73
|
if element.ingredient_definitions.any?
|
67
74
|
element.has_value_for?(name)
|
68
75
|
else
|
69
|
-
|
76
|
+
Alchemy::Deprecation.silence do
|
77
|
+
element.has_ingredient?(name)
|
78
|
+
end
|
70
79
|
end
|
71
80
|
end
|
72
81
|
|
@@ -128,7 +137,7 @@ module Alchemy
|
|
128
137
|
def element_view_for(element, options = {})
|
129
138
|
options = {
|
130
139
|
tag: :div,
|
131
|
-
id:
|
140
|
+
id: element.dom_id,
|
132
141
|
class: element.name,
|
133
142
|
tags_formatter: ->(tags) { tags.join(" ") },
|
134
143
|
}.merge(options)
|
@@ -167,12 +167,13 @@ module Alchemy
|
|
167
167
|
end
|
168
168
|
|
169
169
|
# Returns a string for the id attribute of a html element for the given element
|
170
|
+
# @deprecated
|
170
171
|
def element_dom_id(element)
|
171
|
-
|
172
|
-
|
173
|
-
"#{element.name}_#{element.id}".html_safe
|
172
|
+
element&.dom_id
|
174
173
|
end
|
175
174
|
|
175
|
+
deprecate element_dom_id: "element.dom_id", deprecator: Alchemy::Deprecation
|
176
|
+
|
176
177
|
# Renders the HTML tag attributes required for preview mode.
|
177
178
|
def element_preview_code(element)
|
178
179
|
tag_builder.tag_options(element_preview_code_attributes(element))
|
@@ -20,8 +20,8 @@ module Alchemy
|
|
20
20
|
def show_page_path_params(page, optional_params = {})
|
21
21
|
raise ArgumentError, "Page is nil" if page.nil?
|
22
22
|
|
23
|
-
url_params = {urlname: page.urlname}.update(optional_params)
|
24
|
-
prefix_locale? ? url_params.update(locale: page.language_code) : url_params
|
23
|
+
url_params = { urlname: page.urlname }.update(optional_params)
|
24
|
+
prefix_locale?(page.language_code) ? url_params.update(locale: page.language_code) : url_params
|
25
25
|
end
|
26
26
|
|
27
27
|
# Returns the path for downloading an alchemy attachment
|
@@ -35,8 +35,11 @@ module Alchemy
|
|
35
35
|
end
|
36
36
|
|
37
37
|
# Returns the full url containing host, page and anchor for the given element
|
38
|
+
# @deprecated
|
38
39
|
def full_url_for_element(element)
|
39
|
-
"#{current_server}/#{element.page.urlname}##{
|
40
|
+
"#{current_server}/#{element.page.urlname}##{element.dom_id}"
|
40
41
|
end
|
42
|
+
|
43
|
+
deprecate :full_url_for_element, deprecator: Alchemy::Deprecation
|
41
44
|
end
|
42
45
|
end
|
@@ -14,7 +14,9 @@ module Alchemy
|
|
14
14
|
# Used by the Element#preview_text method.
|
15
15
|
#
|
16
16
|
def preview_text(_max_length = nil)
|
17
|
-
|
17
|
+
return if value.nil?
|
18
|
+
|
19
|
+
Alchemy.t(value.to_s, scope: "ingredient_values.boolean")
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
@@ -13,8 +13,8 @@ xml.rss version: "2.0" do
|
|
13
13
|
if element.has_ingredient?("date")
|
14
14
|
xml.pubDate element.ingredient("date").to_s(:rfc822)
|
15
15
|
end
|
16
|
-
xml.link show_alchemy_page_url(@page, anchor:
|
17
|
-
xml.guid show_alchemy_page_url(@page, anchor:
|
16
|
+
xml.link show_alchemy_page_url(@page, anchor: "##{element.dom_id}")
|
17
|
+
xml.guid show_alchemy_page_url(@page, anchor: "##{element.dom_id}")
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
data/lib/alchemy/essence.rb
CHANGED
@@ -23,8 +23,12 @@ module Alchemy #:nodoc:
|
|
23
23
|
# The column the the validations run against.
|
24
24
|
# @option options [String || Symbol] preview_text_column (ingredient_column)
|
25
25
|
# Specify the column for the preview_text method.
|
26
|
-
#
|
26
|
+
# @deprecated
|
27
27
|
def acts_as_essence(options = {})
|
28
|
+
if !DEPRECATED_ESSENCE_CLASSES.include?(name)
|
29
|
+
Alchemy::Deprecation.warn "Please create a custom Alchemy::Ingredient for #{name} instead"
|
30
|
+
end
|
31
|
+
|
28
32
|
register_as_essence_association!
|
29
33
|
|
30
34
|
configuration = {
|
data/lib/alchemy/permissions.rb
CHANGED
@@ -121,7 +121,9 @@ module Alchemy
|
|
121
121
|
can :manage, Alchemy::Node
|
122
122
|
can [:read, :url], Alchemy::Picture
|
123
123
|
can [:read, :autocomplete], Alchemy::Tag
|
124
|
-
can
|
124
|
+
can :edit_content, Alchemy::Page, Alchemy::Page.all do |page|
|
125
|
+
page.editable_by?(@user)
|
126
|
+
end
|
125
127
|
end
|
126
128
|
end
|
127
129
|
|
data/lib/alchemy/version.rb
CHANGED
data/lib/alchemy.rb
CHANGED
@@ -5,6 +5,25 @@ 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
|
+
|
8
27
|
# Define page preview sources
|
9
28
|
#
|
10
29
|
# A preview source is a Ruby class returning an URL
|
data/package.json
CHANGED
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: 6.0.
|
4
|
+
version: 6.0.10
|
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: 2022-
|
16
|
+
date: 2022-09-04 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: actionmailer
|
@@ -1525,7 +1525,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1525
1525
|
version: '0'
|
1526
1526
|
requirements:
|
1527
1527
|
- ImageMagick (libmagick), v6.6 or greater.
|
1528
|
-
rubygems_version: 3.
|
1528
|
+
rubygems_version: 3.3.7
|
1529
1529
|
signing_key:
|
1530
1530
|
specification_version: 4
|
1531
1531
|
summary: A powerful, userfriendly and flexible CMS for Rails
|