alchemy_cms 5.3.4 → 5.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee +1 -1
- data/app/assets/stylesheets/alchemy/selects.scss +0 -4
- data/app/controllers/alchemy/api/nodes_controller.rb +1 -0
- data/app/models/alchemy/page.rb +6 -0
- data/app/models/alchemy/picture/transformations.rb +2 -2
- data/app/models/alchemy/picture.rb +1 -1
- data/app/models/alchemy/picture_variant.rb +3 -1
- data/app/views/alchemy/admin/pages/update.js.erb +1 -1
- data/app/views/alchemy/essences/_essence_node_editor.html.erb +1 -1
- data/config/alchemy/config.yml +1 -0
- data/config/initializers/dragonfly.rb +2 -0
- data/lib/alchemy/dragonfly/processors/thumbnail.rb +27 -0
- data/lib/alchemy/engine.rb +11 -0
- data/lib/alchemy/hints.rb +7 -3
- data/lib/alchemy/page_layout.rb +6 -2
- data/lib/alchemy/version.rb +1 -1
- data/package.json +1 -1
- data/vendor/assets/stylesheets/alchemy_admin/select2.scss +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 848962eb77be3975e32f4c7e5bbb17ecdd28095e390c468781cae673de03d394
|
4
|
+
data.tar.gz: 4c4ad856ccc2fb65a9caca38fdca4e5e64185739694c81738e907d3ef9767457
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44c3dcb6bf2264875564056a6653e750b716717b2efd147312b75cc641018df7bbb7e56dbe4d621d0b6175cc42de8d86b69df0b1a004bebd6b1afd271b040710
|
7
|
+
data.tar.gz: b02f343d94a7b42cca11776189ab424d3ba90468fd43e7f60273000a80509da6cfc553521f22fac31383992c5c3d38494f42badd7afecd2cc91049b4ceb2a20a
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
## 5.3.7 (2022-06-10)
|
2
|
+
|
3
|
+
- Fix admin page tree links after update [#2348](https://github.com/AlchemyCMS/alchemy_cms/pull/2348) ([tvdeyen](https://github.com/tvdeyen))
|
4
|
+
- Fix initial selection of internal page link select [#2346](https://github.com/AlchemyCMS/alchemy_cms/pull/2346) ([tvdeyen](https://github.com/tvdeyen))
|
5
|
+
|
6
|
+
## 5.3.6 (2022-06-04)
|
7
|
+
|
8
|
+
- Use HashWithIndifferentAccess for Page definition. Key hint translation by page_layout [#2343](https://github.com/AlchemyCMS/alchemy_cms/pull/2343) ([dbwinger](https://github.com/dbwinger))
|
9
|
+
|
10
|
+
## 5.3.5 (2022-04-26)
|
11
|
+
|
12
|
+
- Add thumbnail processor to support resizing on animated GIFs [#2316](https://github.com/AlchemyCMS/alchemy_cms/pull/2316) ([kulturbande](https://github.com/kulturbande))
|
13
|
+
- Backport #2277 to 5.3 [#2306](https://github.com/AlchemyCMS/alchemy_cms/pull/2306) ([dbwinger](https://github.com/dbwinger))
|
14
|
+
- add webp - support to 5.3 stable [#2294](https://github.com/AlchemyCMS/alchemy_cms/pull/2294) ([kulturbande](https://github.com/kulturbande))
|
15
|
+
|
1
16
|
## 5.3.4 (2022-04-11)
|
2
17
|
|
3
18
|
- Don't delete locals in render_element so they can be used by all elem… [#2284](https://github.com/AlchemyCMS/alchemy_cms/pull/2284) ([dbwinger](https://github.com/dbwinger))
|
@@ -87,7 +87,7 @@ class window.Alchemy.LinkDialog extends Alchemy.Dialog
|
|
87
87
|
urlname = $element.val()
|
88
88
|
$.get Alchemy.routes.api_pages_path,
|
89
89
|
q:
|
90
|
-
urlname_eq: urlname.replace(/^\/([a-z]{2}(-[A-Z]{2})?\/)
|
90
|
+
urlname_eq: urlname.replace(/^\/([a-z]{2}(-[A-Z]{2})?\/)?(.+?)\/?$/, '$3')
|
91
91
|
page: 1
|
92
92
|
per_page: 1,
|
93
93
|
(data) =>
|
data/app/models/alchemy/page.rb
CHANGED
@@ -523,6 +523,12 @@ module Alchemy
|
|
523
523
|
locker.try(:name) || Alchemy.t("unknown")
|
524
524
|
end
|
525
525
|
|
526
|
+
# Key hint translations by page layout, rather than the default name.
|
527
|
+
#
|
528
|
+
def hint_translation_attribute
|
529
|
+
page_layout
|
530
|
+
end
|
531
|
+
|
526
532
|
# Menus (aka. root nodes) this page is attached to
|
527
533
|
#
|
528
534
|
def menus
|
@@ -67,7 +67,7 @@ module Alchemy
|
|
67
67
|
# Returns the rendered resized image using imagemagick directly.
|
68
68
|
#
|
69
69
|
def resize(size, upsample = false)
|
70
|
-
image_file.
|
70
|
+
image_file.thumbnail(upsample ? size : "#{size}>")
|
71
71
|
end
|
72
72
|
|
73
73
|
# Returns true if picture's width is greater than it's height
|
@@ -191,7 +191,7 @@ module Alchemy
|
|
191
191
|
if is_smaller_than?(dimensions) && upsample == false
|
192
192
|
dimensions = reduce_to_image(dimensions)
|
193
193
|
end
|
194
|
-
image_file.
|
194
|
+
image_file.thumbnail("#{dimensions_to_string(dimensions)}#")
|
195
195
|
end
|
196
196
|
|
197
197
|
# Use imagemagick to custom crop an image. Uses -thumbnail for better performance when resizing.
|
@@ -13,6 +13,8 @@ module Alchemy
|
|
13
13
|
include Alchemy::Logger
|
14
14
|
include Alchemy::Picture::Transformations
|
15
15
|
|
16
|
+
ANIMATED_IMAGE_FORMATS = %w[gif webp]
|
17
|
+
|
16
18
|
attr_reader :picture, :render_format
|
17
19
|
|
18
20
|
def_delegators :@picture,
|
@@ -86,7 +88,7 @@ module Alchemy
|
|
86
88
|
end
|
87
89
|
|
88
90
|
options = {
|
89
|
-
flatten: render_format
|
91
|
+
flatten: !render_format.in?(ANIMATED_IMAGE_FORMATS) && picture.image_file_format == "gif",
|
90
92
|
}.with_indifferent_access.merge(options)
|
91
93
|
|
92
94
|
encoding_options = []
|
@@ -23,7 +23,7 @@
|
|
23
23
|
<% else -%>
|
24
24
|
|
25
25
|
if (page) {
|
26
|
-
var page_html = "<%= j render('page', page: @page) %>"
|
26
|
+
var page_html = "<%= j render('page', page: @page) %>".replace(/__ID__/g, "<%= @page.id %>");;
|
27
27
|
var compiler = Handlebars.compile(page_html);
|
28
28
|
var tree = <%== @tree.to_json %>;
|
29
29
|
page.outerHTML = compiler(tree.pages[0]);
|
@@ -17,7 +17,7 @@
|
|
17
17
|
}) %>
|
18
18
|
$('#<%= essence_node_editor.form_field_id %>').alchemyNodeSelect({
|
19
19
|
placeholder: "<%= Alchemy.t(:search_node) %>",
|
20
|
-
url: "<%= alchemy.api_nodes_path %>",
|
20
|
+
url: "<%= alchemy.api_nodes_path(language_id: essence_node_editor.page&.language_id) %>",
|
21
21
|
query_params: <%== query_params.to_json %>,
|
22
22
|
<% if essence_node_editor.essence.node %>
|
23
23
|
<% serialized_node = ActiveModelSerializers::SerializableResource.new(essence_node_editor.essence.node, include: :ancestors) %>
|
data/config/alchemy/config.yml
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require "dragonfly_svg"
|
3
3
|
require "alchemy/dragonfly/processors/crop_resize"
|
4
|
+
require "alchemy/dragonfly/processors/thumbnail"
|
4
5
|
|
5
6
|
# Logger
|
6
7
|
Dragonfly.logger = Rails.logger
|
@@ -16,4 +17,5 @@ Dragonfly::ImageMagick::Processors::Encode::WHITELISTED_ARGS << "flatten"
|
|
16
17
|
|
17
18
|
Rails.application.config.after_initialize do
|
18
19
|
Dragonfly.app(:alchemy_pictures).add_processor(:crop_resize, Alchemy::Dragonfly::Processors::CropResize.new)
|
20
|
+
Dragonfly.app(:alchemy_pictures).add_processor(:thumbnail, Alchemy::Dragonfly::Processors::Thumbnail.new)
|
19
21
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dragonfly/image_magick/processors/thumb"
|
4
|
+
|
5
|
+
module Alchemy
|
6
|
+
module Dragonfly
|
7
|
+
module Processors
|
8
|
+
class Thumbnail < ::Dragonfly::ImageMagick::Processors::Thumb
|
9
|
+
def call(content, geometry, opts = {})
|
10
|
+
# store content into an instance variable to use it in args_for_geometry - method
|
11
|
+
@content = content
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
##
|
16
|
+
# due to a missing ImageMagick parameter animated GIFs were broken with the default
|
17
|
+
# Dragonfly Thumb processor
|
18
|
+
def args_for_geometry(geometry)
|
19
|
+
# resize all frames in a GIF
|
20
|
+
# @link https://imagemagick.org/script/command-line-options.php#coalesce
|
21
|
+
# @link https://imagemagick.org/script/command-line-options.php#deconstruct
|
22
|
+
@content&.mime_type == "image/gif" ? "-coalesce #{super} -deconstruct" : super
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/alchemy/engine.rb
CHANGED
@@ -45,6 +45,17 @@ module Alchemy
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
+
initializer "alchemy.webp-mime_type" do
|
49
|
+
# Rails does not know anything about webp even in 2022
|
50
|
+
unless Mime::Type.lookup_by_extension(:webp)
|
51
|
+
Mime::Type.register("image/webp", :webp)
|
52
|
+
end
|
53
|
+
# Dragonfly uses Rack to read the mime type and guess what
|
54
|
+
unless Rack::Mime::MIME_TYPES[".webp"]
|
55
|
+
Rack::Mime::MIME_TYPES[".webp"] = "image/webp"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
48
59
|
initializer "alchemy.error_tracking" do
|
49
60
|
if defined?(Airbrake)
|
50
61
|
require_relative "error_tracking/airbrake_handler"
|
data/lib/alchemy/hints.rb
CHANGED
@@ -37,19 +37,23 @@ module Alchemy
|
|
37
37
|
def hint
|
38
38
|
hint = definition["hint"]
|
39
39
|
if hint == true
|
40
|
-
Alchemy.t(
|
40
|
+
Alchemy.t(hint_translation_attribute, scope: hint_translation_scope)
|
41
41
|
else
|
42
42
|
hint
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
# Returns true if the element has a hint
|
46
|
+
# Returns true if the element has a hint defined
|
47
47
|
def has_hint?
|
48
|
-
hint
|
48
|
+
!!definition[:hint]
|
49
49
|
end
|
50
50
|
|
51
51
|
private
|
52
52
|
|
53
|
+
def hint_translation_attribute
|
54
|
+
name
|
55
|
+
end
|
56
|
+
|
53
57
|
def hint_translation_scope
|
54
58
|
"#{self.class.model_name.to_s.demodulize.downcase}_hints"
|
55
59
|
end
|
data/lib/alchemy/page_layout.rb
CHANGED
@@ -8,7 +8,7 @@ module Alchemy
|
|
8
8
|
# They are defined in +config/alchemy/page_layout.yml+ file.
|
9
9
|
#
|
10
10
|
def all
|
11
|
-
@definitions ||= read_definitions_file
|
11
|
+
@definitions ||= read_definitions_file.map(&:with_indifferent_access)
|
12
12
|
end
|
13
13
|
|
14
14
|
# Add additional page definitions to collection.
|
@@ -164,7 +164,11 @@ module Alchemy
|
|
164
164
|
#
|
165
165
|
def read_definitions_file
|
166
166
|
if File.exist?(layouts_file_path)
|
167
|
-
|
167
|
+
Array.wrap(
|
168
|
+
YAML.safe_load(
|
169
|
+
ERB.new(File.read(layouts_file_path)).result, YAML_WHITELIST_CLASSES, [], true
|
170
|
+
) || []
|
171
|
+
)
|
168
172
|
else
|
169
173
|
raise LoadError, "Could not find page_layouts.yml file! Please run `rails generate alchemy:install`"
|
170
174
|
end
|
data/lib/alchemy/version.rb
CHANGED
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: 5.3.
|
4
|
+
version: 5.3.7
|
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-06-10 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: active_model_serializers
|
@@ -1079,6 +1079,7 @@ files:
|
|
1079
1079
|
- lib/alchemy/controller_actions.rb
|
1080
1080
|
- lib/alchemy/deprecation.rb
|
1081
1081
|
- lib/alchemy/dragonfly/processors/crop_resize.rb
|
1082
|
+
- lib/alchemy/dragonfly/processors/thumbnail.rb
|
1082
1083
|
- lib/alchemy/element_definition.rb
|
1083
1084
|
- lib/alchemy/elements_finder.rb
|
1084
1085
|
- lib/alchemy/engine.rb
|