alchemy_cms 5.1.7 → 5.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ea6dd239350801fa37b9fc87002bd98338b0cd6e38444de0a56b1c6f0c86f2f
4
- data.tar.gz: 7dfba85cd6ee44d94a6472524f9986dbf75c536238a248e29d38ba9e7e5a9744
3
+ metadata.gz: 22e0baf2c4ddddb60434bca77764c2d8b7a885cf164a17e5c1ef67f6e0f4a4ba
4
+ data.tar.gz: e74e655f91a8966bfe636504976c06df51675c24343b3fa606c37ae3f7019741
5
5
  SHA512:
6
- metadata.gz: ccf77d0e90db9547dace08e7350d91d28e05aab723dfffeaac8a3035c17c00b911b357b1cb684e02a88a4914a613b23c81726996989d8a7a2a83883193712bfe
7
- data.tar.gz: b62c2cded7a485fc2e3fc643e7d77fc5c0b75fecc3586b22ee0771d5d174312179c8b7f2dc8c9225ab601e6e5697408401782573fa3831905e4ca055ceeedca5
6
+ metadata.gz: 60e262f8c6f3683ba502ffb9cf07031216021d04c5db3c8743748dea49a499e310f0ee0d98a2bb5c06896510fe7c913a526e791ee82637def10012611706aad3
7
+ data.tar.gz: 05515f3c002cbaa8a797e156d3e83d296e3fff58e4a01d1c47bd7c61ca9487b34f12c29149e9616c33ef5200e1b491e15bafb101477b361457c6e93603969046
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## 5.1.10 (2022-02-28)
2
+
3
+ - Add crop_resize Dragonfly processor ([tvdeyen](https://github.com/tvdeyen))
4
+
5
+ ## 5.1.9 (2021-11-24)
6
+
7
+ - Adjust tinymce skin assets urls again ([tvdeyen](https://github.com/tvdeyen))
8
+
9
+ ## 5.1.8 (2021-11-17)
10
+
11
+ - Set stampable user_class_name without root identifier ([tvdeyen](https://github.com/tvdeyen))
12
+ - Use relative path for tinymce font-face ([tvdeyen](https://github.com/tvdeyen))
13
+
1
14
  ## 5.1.7 (2021-10-26)
2
15
 
3
16
  - Make sure to install correct npm package ([tvdeyen](https://github.com/tvdeyen))
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.0', '>= 1.0.7', '< 1.4.0']
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']
@@ -30,7 +30,7 @@ td,th {
30
30
 
31
31
  .mce-object {
32
32
  border: 1px dotted #3a3a3a;
33
- background: #d5d5d5 url(img/object.gif) no-repeat center;
33
+ background: #d5d5d5 url('tinymce/skins/alchemy/fonts/img/object.gif') no-repeat center;
34
34
  }
35
35
 
36
36
  .mce-pagebreak {
@@ -55,7 +55,7 @@ td,th {
55
55
  width: 9px!important;
56
56
  height: 9px!important;
57
57
  border: 1px dotted #3a3a3a;
58
- background: #d5d5d5 url(img/anchor.gif) no-repeat center;
58
+ background: #d5d5d5 url('tinymce/skins/alchemy/fonts/img/anchor.gif') no-repeat center;
59
59
  }
60
60
 
61
61
  .mce-nbsp {
@@ -77,7 +77,7 @@ hr {
77
77
  }
78
78
 
79
79
  .mce-spellchecker-word {
80
- background: url(img/wline.gif) repeat-x bottom left;
80
+ background: url('tinymce/skins/alchemy/fonts/img/wline.gif') repeat-x bottom left;
81
81
  cursor: default;
82
82
  }
83
83
 
@@ -1561,23 +1561,23 @@ i.mce-i-resize {
1561
1561
  opacity: 0.6;
1562
1562
  filter: alpha(opacity=60);
1563
1563
  zoom: 1;
1564
- background: #fff url('img/loader.gif') no-repeat center center;
1564
+ background: #fff url('tinymce/skins/alchemy/fonts/img/loader.gif') no-repeat center center;
1565
1565
  }
1566
1566
 
1567
1567
  @font-face {
1568
1568
  font-family: 'tinymce';
1569
- src: url('fonts/tinymce.woff') format('woff'),
1570
- url('fonts/tinymce.ttf') format('truetype'),
1571
- url('fonts/tinymce.svg#tinymce') format('svg');
1569
+ src: url('tinymce/skins/alchemy/fonts/tinymce.woff') format('woff'),
1570
+ url('tinymce/skins/alchemy/fonts/tinymce.ttf') format('truetype'),
1571
+ url('tinymce/skins/alchemy/fonts/tinymce.svg#tinymce') format('svg');
1572
1572
  font-weight: normal;
1573
1573
  font-style: normal;
1574
1574
  }
1575
1575
 
1576
1576
  @font-face {
1577
1577
  font-family: 'tinymce-small';
1578
- src: url('fonts/tinymce-small.woff') format('woff'),
1579
- url('fonts/tinymce-small.ttf') format('truetype'),
1580
- url('fonts/tinymce-small.svg#tinymce') format('svg');
1578
+ src: url('tinymce/skins/alchemy/fonts/tinymce-small.woff') format('woff'),
1579
+ url('tinymce/skins/alchemy/fonts/tinymce-small.ttf') format('truetype'),
1580
+ url('tinymce/skins/alchemy/fonts/tinymce-small.svg#tinymce') format('svg');
1581
1581
  font-weight: normal;
1582
1582
  font-style: normal;
1583
1583
  }
@@ -40,9 +40,7 @@ module Alchemy
40
40
  def exception_handler(error)
41
41
  exception_logger(error)
42
42
  show_error_notice(error)
43
- if defined?(Airbrake)
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.
@@ -147,6 +145,14 @@ module Alchemy
147
145
  site
148
146
  end
149
147
  end
148
+
149
+ def notify_error_tracker(exception)
150
+ if ::Alchemy::ErrorTracking.notification_handler.respond_to?(:call)
151
+ ::Alchemy::ErrorTracking.notification_handler.call(exception)
152
+ else
153
+ Rails.logger.warn("To use the Alchemy::ErrorTracking.notification_handler, it must respond to #call.")
154
+ end
155
+ end
150
156
  end
151
157
  end
152
158
  end
@@ -28,7 +28,7 @@ module Alchemy
28
28
  after_assign { |f| write_attribute(:file_mime_type, f.mime_type) }
29
29
  end
30
30
 
31
- stampable stamper_class_name: Alchemy.user_class_name
31
+ stampable stamper_class_name: Alchemy.user_class.name
32
32
 
33
33
  has_many :essence_files, class_name: "Alchemy::EssenceFile", foreign_key: "attachment_id"
34
34
  has_many :contents, through: :essence_files
@@ -60,7 +60,7 @@ module Alchemy
60
60
  #
61
61
  acts_as_list scope: [:page_id, :fixed, :parent_element_id]
62
62
 
63
- stampable stamper_class_name: Alchemy.user_class_name
63
+ stampable stamper_class_name: Alchemy.user_class.name
64
64
 
65
65
  has_many :contents, dependent: :destroy, inverse_of: :element
66
66
 
@@ -7,7 +7,7 @@ module Alchemy
7
7
  before_destroy :check_if_related_essence_nodes_present
8
8
 
9
9
  acts_as_nested_set scope: "language_id", touch: true
10
- stampable stamper_class_name: Alchemy.user_class_name
10
+ stampable stamper_class_name: Alchemy.user_class.name
11
11
 
12
12
  belongs_to :language, class_name: "Alchemy::Language"
13
13
  belongs_to :page, class_name: "Alchemy::Page", optional: true, inverse_of: :nodes
@@ -82,7 +82,7 @@ module Alchemy
82
82
 
83
83
  acts_as_nested_set(dependent: :destroy, scope: [:layoutpage, :language_id])
84
84
 
85
- stampable stamper_class_name: Alchemy.user_class_name
85
+ stampable stamper_class_name: Alchemy.user_class.name
86
86
 
87
87
  belongs_to :language
88
88
 
@@ -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 = "-crop #{dimensions_to_string(crop_dimensions)}"
200
+ crop_argument = dimensions_to_string(crop_dimensions)
201
201
  crop_argument += "+#{top_left[:x]}+#{top_left[:y]}"
202
202
 
203
- resize_argument = "-resize #{dimensions_to_string(dimensions)}"
203
+ resize_argument = dimensions_to_string(dimensions)
204
204
  resize_argument += ">" unless upsample
205
- image_file.convert "#{crop_argument} #{resize_argument}"
205
+ image_file.crop_resize(crop_argument, resize_argument)
206
206
  end
207
207
 
208
208
  # Used when centercropping.
@@ -108,7 +108,7 @@ module Alchemy
108
108
  case_sensitive: false,
109
109
  message: Alchemy.t("not a valid image")
110
110
 
111
- stampable stamper_class_name: Alchemy.user_class_name
111
+ stampable stamper_class_name: Alchemy.user_class.name
112
112
 
113
113
  scope :named, ->(name) { where("#{table_name}.name LIKE ?", "%#{name}%") }
114
114
  scope :recent, -> { where("#{table_name}.created_at > ?", Time.current - 24.hours).order(:created_at) }
@@ -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
@@ -40,9 +40,16 @@ module Alchemy
40
40
  if Alchemy.user_class
41
41
  ActiveSupport.on_load(:active_record) do
42
42
  Alchemy.user_class.model_stamper
43
- Alchemy.user_class.stampable(stamper_class_name: Alchemy.user_class_name)
43
+ Alchemy.user_class.stampable(stamper_class_name: Alchemy.user_class.name)
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,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Alchemy
4
+ module ErrorTracking
5
+ class AirbrakeHandler < BaseHandler
6
+ def self.call(exception)
7
+ return if ["development", "test"].include?(Rails.env)
8
+
9
+ notify_airbrake(exception)
10
+ end
11
+ end
12
+ end
13
+ 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
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alchemy
4
- VERSION = "5.1.7"
4
+ VERSION = "5.1.10"
5
5
 
6
6
  def self.version
7
7
  VERSION
data/lib/alchemy_cms.rb CHANGED
@@ -36,6 +36,7 @@ require_relative "alchemy/configuration_methods"
36
36
  require_relative "alchemy/controller_actions"
37
37
  require_relative "alchemy/deprecation"
38
38
  require_relative "alchemy/elements_finder"
39
+ require_relative "alchemy/error_tracking"
39
40
  require_relative "alchemy/errors"
40
41
  require_relative "alchemy/essence"
41
42
  require_relative "alchemy/filetypes"
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alchemy_cms/admin",
3
- "version": "5.1.7",
3
+ "version": "5.1.10",
4
4
  "description": "AlchemyCMS",
5
5
  "browser": "package/admin.js",
6
6
  "files": [
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.1.7
4
+ version: 5.1.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: 2021-10-26 00:00:00.000000000 Z
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
@@ -109,26 +109,14 @@ dependencies:
109
109
  requirements:
110
110
  - - "~>"
111
111
  - !ruby/object:Gem::Version
112
- version: '1.0'
113
- - - ">="
114
- - !ruby/object:Gem::Version
115
- version: 1.0.7
116
- - - "<"
117
- - !ruby/object:Gem::Version
118
- version: 1.4.0
112
+ version: '1.4'
119
113
  type: :runtime
120
114
  prerelease: false
121
115
  version_requirements: !ruby/object:Gem::Requirement
122
116
  requirements:
123
117
  - - "~>"
124
118
  - !ruby/object:Gem::Version
125
- version: '1.0'
126
- - - ">="
127
- - !ruby/object:Gem::Version
128
- version: 1.0.7
129
- - - "<"
130
- - !ruby/object:Gem::Version
131
- version: 1.4.0
119
+ version: '1.4'
132
120
  - !ruby/object:Gem::Dependency
133
121
  name: dragonfly_svg
134
122
  requirement: !ruby/object:Gem::Requirement
@@ -1092,8 +1080,11 @@ 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/elements_finder.rb
1096
1085
  - lib/alchemy/engine.rb
1086
+ - lib/alchemy/error_tracking.rb
1087
+ - lib/alchemy/error_tracking/airbrake_handler.rb
1097
1088
  - lib/alchemy/errors.rb
1098
1089
  - lib/alchemy/essence.rb
1099
1090
  - lib/alchemy/filetypes.rb
@@ -1284,7 +1275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1284
1275
  version: '0'
1285
1276
  requirements:
1286
1277
  - ImageMagick (libmagick), v6.6 or greater.
1287
- rubygems_version: 3.2.28
1278
+ rubygems_version: 3.1.6
1288
1279
  signing_key:
1289
1280
  specification_version: 4
1290
1281
  summary: A powerful, userfriendly and flexible CMS for Rails