alchemy_cms 5.2.5 → 5.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/alchemy_cms.gemspec +1 -1
- data/app/controllers/alchemy/admin/base_controller.rb +9 -3
- data/app/models/alchemy/picture/transformations.rb +3 -3
- data/config/initializers/dragonfly.rb +8 -0
- data/lib/alchemy/dragonfly/processors/crop_resize.rb +35 -0
- data/lib/alchemy/engine.rb +7 -0
- data/lib/alchemy/error_tracking/airbrake_handler.rb +13 -0
- data/lib/alchemy/error_tracking.rb +14 -0
- data/lib/alchemy/version.rb +1 -1
- data/lib/alchemy_cms.rb +1 -0
- data/package.json +1 -1
- metadata +5 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97e1ed1598e179337636198e31cf6d94b85bce3376cd1cb704e6a6e3312224b7
|
4
|
+
data.tar.gz: 2cfe0ee0fb63eddb1d5de0ac156e9f3abfcc6ac91d6652ebf8aaf80db3da6e61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43f19d474f2e3e153af2b98d3867e7b0151f6ccc3fa4518e88f4b88055fe99cda98a11d53e668e8e5c8485ed17e4a52f0547a8e819f8475ba95c06b6de5f33c1
|
7
|
+
data.tar.gz: 641ade4c39110add57ddcf2c5a5968541ebafc953f47b9c3f10d6681cfa6d31357794df4b03d488597bc5f56b0e1696a550d57e29da170aac74946bf8b86d167
|
data/CHANGELOG.md
CHANGED
data/alchemy_cms.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |gem|
|
|
23
23
|
gem.add_runtime_dependency 'awesome_nested_set', ['~> 3.1']
|
24
24
|
gem.add_runtime_dependency 'cancancan', ['>= 2.1', '< 4.0']
|
25
25
|
gem.add_runtime_dependency 'coffee-rails', ['>= 4.0', '< 6.0']
|
26
|
-
gem.add_runtime_dependency 'dragonfly', ['~> 1.
|
26
|
+
gem.add_runtime_dependency 'dragonfly', ['~> 1.4']
|
27
27
|
gem.add_runtime_dependency 'dragonfly_svg', ['~> 0.0.4']
|
28
28
|
gem.add_runtime_dependency 'gutentag', ['~> 2.2', '>= 2.2.1']
|
29
29
|
gem.add_runtime_dependency 'handlebars_assets', ['~> 0.23']
|
@@ -40,9 +40,7 @@ module Alchemy
|
|
40
40
|
def exception_handler(error)
|
41
41
|
exception_logger(error)
|
42
42
|
show_error_notice(error)
|
43
|
-
|
44
|
-
notify_airbrake(error) unless Rails.env.development? || Rails.env.test?
|
45
|
-
end
|
43
|
+
notify_error_tracker(error)
|
46
44
|
end
|
47
45
|
|
48
46
|
# Displays an error notice in the Alchemy backend.
|
@@ -148,6 +146,14 @@ module Alchemy
|
|
148
146
|
site
|
149
147
|
end
|
150
148
|
end
|
149
|
+
|
150
|
+
def notify_error_tracker(exception)
|
151
|
+
if ::Alchemy::ErrorTracking.notification_handler.respond_to?(:call)
|
152
|
+
::Alchemy::ErrorTracking.notification_handler.call(exception)
|
153
|
+
else
|
154
|
+
Rails.logger.warn("To use the Alchemy::ErrorTracking.notification_handler, it must respond to #call.")
|
155
|
+
end
|
156
|
+
end
|
151
157
|
end
|
152
158
|
end
|
153
159
|
end
|
@@ -197,12 +197,12 @@ module Alchemy
|
|
197
197
|
# Use imagemagick to custom crop an image. Uses -thumbnail for better performance when resizing.
|
198
198
|
#
|
199
199
|
def xy_crop_resize(dimensions, top_left, crop_dimensions, upsample)
|
200
|
-
crop_argument =
|
200
|
+
crop_argument = dimensions_to_string(crop_dimensions)
|
201
201
|
crop_argument += "+#{top_left[:x]}+#{top_left[:y]}"
|
202
202
|
|
203
|
-
resize_argument =
|
203
|
+
resize_argument = dimensions_to_string(dimensions)
|
204
204
|
resize_argument += ">" unless upsample
|
205
|
-
image_file.
|
205
|
+
image_file.crop_resize(crop_argument, resize_argument)
|
206
206
|
end
|
207
207
|
|
208
208
|
# Used when centercropping.
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require "dragonfly_svg"
|
3
|
+
require "alchemy/dragonfly/processors/crop_resize"
|
3
4
|
|
4
5
|
# Logger
|
5
6
|
Dragonfly.logger = Rails.logger
|
@@ -9,3 +10,10 @@ if defined?(ActiveRecord::Base)
|
|
9
10
|
ActiveRecord::Base.extend Dragonfly::Model
|
10
11
|
ActiveRecord::Base.extend Dragonfly::Model::Validations
|
11
12
|
end
|
13
|
+
|
14
|
+
# Dragonfly 1.4.0 only allows `quality` as argument to `encode`
|
15
|
+
Dragonfly::ImageMagick::Processors::Encode::WHITELISTED_ARGS << "flatten"
|
16
|
+
|
17
|
+
Rails.application.config.after_initialize do
|
18
|
+
Dragonfly.app(:alchemy_pictures).add_processor(:crop_resize, Alchemy::Dragonfly::Processors::CropResize.new)
|
19
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dragonfly/image_magick/commands"
|
4
|
+
|
5
|
+
module Alchemy
|
6
|
+
module Dragonfly
|
7
|
+
module Processors
|
8
|
+
class CropResize
|
9
|
+
include ::Dragonfly::ParamValidators
|
10
|
+
|
11
|
+
IS_CROP_ARGUMENT = ->(args_string) {
|
12
|
+
args_string.match?(::Dragonfly::ImageMagick::Processors::Thumb::CROP_GEOMETRY)
|
13
|
+
}
|
14
|
+
|
15
|
+
IS_RESIZE_ARGUMENT = ->(args_string) {
|
16
|
+
args_string.match?(::Dragonfly::ImageMagick::Processors::Thumb::RESIZE_GEOMETRY)
|
17
|
+
}
|
18
|
+
|
19
|
+
def call(content, crop_argument, resize_argument)
|
20
|
+
validate!(crop_argument, &IS_CROP_ARGUMENT)
|
21
|
+
validate!(resize_argument, &IS_RESIZE_ARGUMENT)
|
22
|
+
::Dragonfly::ImageMagick::Commands.convert(
|
23
|
+
content,
|
24
|
+
"-crop #{crop_argument} -resize #{resize_argument}"
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
def update_url(attrs, _args = "", opts = {})
|
29
|
+
format = opts["format"]
|
30
|
+
attrs.ext = format if format
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/alchemy/engine.rb
CHANGED
@@ -44,5 +44,12 @@ module Alchemy
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
47
|
+
|
48
|
+
initializer "alchemy.error_tracking" do
|
49
|
+
if defined?(Airbrake)
|
50
|
+
require_relative "error_tracking/airbrake_handler"
|
51
|
+
Alchemy::ErrorTracking.notification_handler = Alchemy::ErrorTracking::AirbrakeHandler
|
52
|
+
end
|
53
|
+
end
|
47
54
|
end
|
48
55
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Alchemy
|
4
|
+
module ErrorTracking
|
5
|
+
class BaseHandler
|
6
|
+
def self.call(exception)
|
7
|
+
# implement your own notification method
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
mattr_accessor :notification_handler
|
12
|
+
@@notification_handler = BaseHandler
|
13
|
+
end
|
14
|
+
end
|
data/lib/alchemy/version.rb
CHANGED
data/lib/alchemy_cms.rb
CHANGED
@@ -37,6 +37,7 @@ require_relative "alchemy/controller_actions"
|
|
37
37
|
require_relative "alchemy/deprecation"
|
38
38
|
require_relative "alchemy/element_definition"
|
39
39
|
require_relative "alchemy/elements_finder"
|
40
|
+
require_relative "alchemy/error_tracking"
|
40
41
|
require_relative "alchemy/errors"
|
41
42
|
require_relative "alchemy/essence"
|
42
43
|
require_relative "alchemy/filetypes"
|
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.2.
|
4
|
+
version: 5.2.6
|
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:
|
16
|
+
date: 2022-02-28 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: active_model_serializers
|
@@ -108,12 +108,6 @@ dependencies:
|
|
108
108
|
requirement: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
110
|
- - "~>"
|
111
|
-
- !ruby/object:Gem::Version
|
112
|
-
version: '1.0'
|
113
|
-
- - ">="
|
114
|
-
- !ruby/object:Gem::Version
|
115
|
-
version: 1.0.7
|
116
|
-
- - "<"
|
117
111
|
- !ruby/object:Gem::Version
|
118
112
|
version: '1.4'
|
119
113
|
type: :runtime
|
@@ -121,12 +115,6 @@ dependencies:
|
|
121
115
|
version_requirements: !ruby/object:Gem::Requirement
|
122
116
|
requirements:
|
123
117
|
- - "~>"
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '1.0'
|
126
|
-
- - ">="
|
127
|
-
- !ruby/object:Gem::Version
|
128
|
-
version: 1.0.7
|
129
|
-
- - "<"
|
130
118
|
- !ruby/object:Gem::Version
|
131
119
|
version: '1.4'
|
132
120
|
- !ruby/object:Gem::Dependency
|
@@ -1092,9 +1080,12 @@ files:
|
|
1092
1080
|
- lib/alchemy/configuration_methods.rb
|
1093
1081
|
- lib/alchemy/controller_actions.rb
|
1094
1082
|
- lib/alchemy/deprecation.rb
|
1083
|
+
- lib/alchemy/dragonfly/processors/crop_resize.rb
|
1095
1084
|
- lib/alchemy/element_definition.rb
|
1096
1085
|
- lib/alchemy/elements_finder.rb
|
1097
1086
|
- lib/alchemy/engine.rb
|
1087
|
+
- lib/alchemy/error_tracking.rb
|
1088
|
+
- lib/alchemy/error_tracking/airbrake_handler.rb
|
1098
1089
|
- lib/alchemy/errors.rb
|
1099
1090
|
- lib/alchemy/essence.rb
|
1100
1091
|
- lib/alchemy/filetypes.rb
|