trusty-cms 7.0.48 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/app/assets/builds/trusty_cms/ckeditor5.css +459 -81
- data/app/assets/builds/trusty_cms/ckeditor5.css.map +3 -3
- data/app/assets/builds/trusty_cms/ckeditor5.js +11247 -7722
- data/app/assets/builds/trusty_cms/ckeditor5.js.map +4 -4
- data/app/controllers/admin/assets_controller.rb +1 -12
- data/app/javascript/plugins/asset_tags/asset_tag_builder.js +7 -2
- data/app/models/asset.rb +107 -38
- data/app/models/asset_type.rb +29 -25
- data/app/views/admin/assets/_search_results.html.haml +2 -3
- data/app/views/admin/assets/edit.html.haml +2 -2
- data/app/views/admin/assets/remove.html.haml +1 -1
- data/config/initializers/trusty_cms_config.rb +1 -49
- data/config/locales/en.yml +1 -1
- data/config/routes.rb +0 -2
- data/db/migrate/20110606111250_update_configuration.rb +0 -16
- data/lib/trusty_cms/geometry.rb +117 -0
- data/lib/trusty_cms/version.rb +1 -1
- data/package.json +1 -1
- data/spec/lib/trusty_cms/geometry_spec.rb +28 -0
- data/spec/models/asset_spec.rb +66 -0
- data/vendor/extensions/clipped-extension/clipped_extension.rb +3 -7
- data/vendor/extensions/clipped-extension/lib/asset_tags.rb +10 -4
- data/vendor/extensions/clipped-extension/lib/generators/templates/clipped_config.rb +9 -34
- data/vendor/extensions/clipped-extension/lib/tasks/active_storage_tasks.rake +66 -0
- data/vendor/extensions/clipped-extension/lib/tasks/clipped_extension_tasks.rake +5 -2
- data/vendor/extensions/clipped-extension/lib/trusty_cms_clipped_extension/cloud.rb +32 -27
- data/yarn.lock +731 -727
- metadata +6 -6
- data/lib/trusty_cms/deprecation.rb +0 -15
- data/vendor/extensions/clipped-extension/lib/paperclip/frame_grab.rb +0 -73
- data/vendor/extensions/clipped-extension/lib/paperclip/geometry_transformation.rb +0 -80
- data/vendor/extensions/clipped-extension/lib/tasks/paperclip_tasks.rake +0 -79
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: trusty-cms
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 7.0
|
|
4
|
+
version: 7.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- TrustyCms CMS dev team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-03-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activestorage-validator
|
|
@@ -1134,12 +1134,12 @@ files:
|
|
|
1134
1134
|
- lib/trusty_cms/admin_ui/region_set.rb
|
|
1135
1135
|
- lib/trusty_cms/available_locales.rb
|
|
1136
1136
|
- lib/trusty_cms/config/definition.rb
|
|
1137
|
-
- lib/trusty_cms/deprecation.rb
|
|
1138
1137
|
- lib/trusty_cms/engine.rb
|
|
1139
1138
|
- lib/trusty_cms/extension.rb
|
|
1140
1139
|
- lib/trusty_cms/extension_loader.rb
|
|
1141
1140
|
- lib/trusty_cms/extension_migrator.rb
|
|
1142
1141
|
- lib/trusty_cms/extension_path.rb
|
|
1142
|
+
- lib/trusty_cms/geometry.rb
|
|
1143
1143
|
- lib/trusty_cms/initializer.rb
|
|
1144
1144
|
- lib/trusty_cms/pagination/controller.rb
|
|
1145
1145
|
- lib/trusty_cms/pagination/link_renderer.rb
|
|
@@ -1211,6 +1211,7 @@ files:
|
|
|
1211
1211
|
- spec/fixtures/files/sample.ics
|
|
1212
1212
|
- spec/fixtures/files/sample.txt
|
|
1213
1213
|
- spec/fixtures/users.yml
|
|
1214
|
+
- spec/lib/trusty_cms/geometry_spec.rb
|
|
1214
1215
|
- spec/models/asset_spec.rb
|
|
1215
1216
|
- spec/models/layout_spec.rb
|
|
1216
1217
|
- spec/models/snippets_spec.rb
|
|
@@ -1226,10 +1227,8 @@ files:
|
|
|
1226
1227
|
- vendor/extensions/clipped-extension/lib/clipped_admin_ui.rb
|
|
1227
1228
|
- vendor/extensions/clipped-extension/lib/generators/templates/clipped_config.rb
|
|
1228
1229
|
- vendor/extensions/clipped-extension/lib/page_asset_associations.rb
|
|
1229
|
-
- vendor/extensions/clipped-extension/lib/
|
|
1230
|
-
- vendor/extensions/clipped-extension/lib/paperclip/geometry_transformation.rb
|
|
1230
|
+
- vendor/extensions/clipped-extension/lib/tasks/active_storage_tasks.rake
|
|
1231
1231
|
- vendor/extensions/clipped-extension/lib/tasks/clipped_extension_tasks.rake
|
|
1232
|
-
- vendor/extensions/clipped-extension/lib/tasks/paperclip_tasks.rake
|
|
1233
1232
|
- vendor/extensions/clipped-extension/lib/trusty_cms_clipped_extension.rb
|
|
1234
1233
|
- vendor/extensions/clipped-extension/lib/trusty_cms_clipped_extension/cloud.rb
|
|
1235
1234
|
- vendor/extensions/layouts-extension/layouts_extension.rb
|
|
@@ -1369,6 +1368,7 @@ test_files:
|
|
|
1369
1368
|
- spec/fixtures/files/sample.ics
|
|
1370
1369
|
- spec/fixtures/files/sample.txt
|
|
1371
1370
|
- spec/fixtures/users.yml
|
|
1371
|
+
- spec/lib/trusty_cms/geometry_spec.rb
|
|
1372
1372
|
- spec/models/asset_spec.rb
|
|
1373
1373
|
- spec/models/layout_spec.rb
|
|
1374
1374
|
- spec/models/snippets_spec.rb
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
require 'active_support'
|
|
2
|
-
|
|
3
|
-
class AssetType
|
|
4
|
-
def paperclip_processors
|
|
5
|
-
deprecation = ActiveSupport::Deprecation.new
|
|
6
|
-
deprecation.warn('Paperclip processors will be deprecated soon in favor of ActiveStorage.')
|
|
7
|
-
|
|
8
|
-
active_storage_styles
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def paperclip_styles
|
|
12
|
-
deprecation = ActiveSupport::Deprecation.new
|
|
13
|
-
deprecation.warn('Paperclip styles will be deprecated soon in favor of ActiveStorage.')
|
|
14
|
-
end
|
|
15
|
-
end
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
module Paperclip
|
|
2
|
-
class FrameGrab < Processor
|
|
3
|
-
|
|
4
|
-
attr_accessor :time_offset, :current_geometry, :target_geometry, :whiny, :current_format, :target_format
|
|
5
|
-
|
|
6
|
-
def initialize(file, options = {}, attachment = nil)
|
|
7
|
-
super
|
|
8
|
-
@file = file
|
|
9
|
-
@time_offset = options[:time_offset] || '-4'
|
|
10
|
-
geometry = options[:geometry]
|
|
11
|
-
unless geometry.blank?
|
|
12
|
-
@crop = geometry[-1,1] == '#'
|
|
13
|
-
@target_geometry = Geometry.parse(geometry)
|
|
14
|
-
@current_geometry = Geometry.parse(video_dimensions(file))
|
|
15
|
-
end
|
|
16
|
-
@current_format = File.extname(@file.path)
|
|
17
|
-
@target_format = options[:format] || 'jpg'
|
|
18
|
-
@basename = File.basename(@file.path, @current_format)
|
|
19
|
-
@whiny = options[:whiny].nil? ? true : options[:whiny]
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def crop?
|
|
23
|
-
!!@crop
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def make
|
|
27
|
-
src = @file
|
|
28
|
-
dst = Tempfile.new([ @basename, @target_format ].compact.join("."))
|
|
29
|
-
dst.binmode
|
|
30
|
-
|
|
31
|
-
begin
|
|
32
|
-
# grab frame at offset
|
|
33
|
-
cmd = %Q[-itsoffset #{time_offset} -i :source -y -vcodec mjpeg -vframes 1 -an -f rawvideo ]
|
|
34
|
-
|
|
35
|
-
# if scale-and-crop parameters can be calculated, we pipe to convert for resizing
|
|
36
|
-
if scale_and_crop = transformation_options
|
|
37
|
-
cmd << %{pipe: | convert #{scale_and_crop} - #{target_format}:- }
|
|
38
|
-
|
|
39
|
-
# otherwise we let ffmpeg resize the to the right size without preserving aspect ratio
|
|
40
|
-
else
|
|
41
|
-
cmd << %{-s #{target_geometry} pipe: }
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
# then pipe to composite to overlay video icon
|
|
45
|
-
cmd << %{| composite -gravity center :icon - :dest }
|
|
46
|
-
|
|
47
|
-
Paperclip.run('ffmpeg', cmd, :source => File.expand_path(src.path), :dest => File.expand_path(dst.path), :icon => AssetType.find(:video).icon_path, :swallow_stderr => false)
|
|
48
|
-
rescue PaperclipCommandLineError => e
|
|
49
|
-
raise PaperclipError, "There was an error processing the thumbnail for #{@basename}: #{e}" if whiny
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
dst
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
# get video dimensions in nasty hacky way
|
|
56
|
-
def video_dimensions(file)
|
|
57
|
-
dim = Paperclip.run('ffmpeg', '-i :source 2>&1', :source => File.expand_path(file.path), :expected_outcodes => [0,1], :swallow_stderr => false)
|
|
58
|
-
$1 if dim =~ /(\d+x\d+)/
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
# Duplicated from Thumbnail. We can't just subclass because of assumed compatibility with Geometry.from_file
|
|
62
|
-
def transformation_options
|
|
63
|
-
if current_geometry
|
|
64
|
-
scale, crop = current_geometry.transformation_to(target_geometry, crop?)
|
|
65
|
-
trans = []
|
|
66
|
-
trans << "-resize" << %["#{scale}"] unless scale.nil? || scale.empty?
|
|
67
|
-
trans << "-crop" << %["#{crop}"] << "+repage" if crop
|
|
68
|
-
trans.join(" ")
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
end
|
|
73
|
-
end
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
module Paperclip
|
|
2
|
-
|
|
3
|
-
class TransformationError < PaperclipError; end
|
|
4
|
-
class StyleError < PaperclipError; end
|
|
5
|
-
|
|
6
|
-
class Geometry
|
|
7
|
-
|
|
8
|
-
# Returns a new Geometry object with the the same dimensions as this but with no modifier.
|
|
9
|
-
def without_modifier
|
|
10
|
-
Geometry.new(self.width, self.height)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
# Returns the dimensions that would result if a thumbnail was created by transforming this geometry into that geometry.
|
|
14
|
-
# Its purpose is to mimic imagemagick conversions. Used like so:
|
|
15
|
-
# file_geometry.transformed_by(style_geometry)
|
|
16
|
-
# it returns the size of the thumbnail image you would get by applying that rule.
|
|
17
|
-
# This saves us having to go back to the file, which is expensive with S3.
|
|
18
|
-
# We understand all the Imagemagick geometry arguments described at http://www.imagemagick.org/script/command-line-processing.php#geometry
|
|
19
|
-
# including both '^' and paperclip's own '#' modifier.
|
|
20
|
-
#
|
|
21
|
-
def transformed_by (other)
|
|
22
|
-
other = Geometry.parse(other) unless other.is_a? Geometry
|
|
23
|
-
# if the two geometries are similar, or the destination geometry is a fixed size, the resulting dimensions are fixed
|
|
24
|
-
return other.without_modifier if self =~ other || ['#', '!', '^'].include?(other.modifier)
|
|
25
|
-
# otherwise, we apply the transformation
|
|
26
|
-
raise TransformationError, "geometry is not transformable without both width and height" if self.height == 0 or self.width == 0
|
|
27
|
-
case other.modifier
|
|
28
|
-
when '>'
|
|
29
|
-
(other.width < self.width || other.height < self.height) ? scaled_to_fit(other) : self
|
|
30
|
-
when '<'
|
|
31
|
-
(other.width > self.width && other.height > self.height) ? scaled_to_fit(other) : self
|
|
32
|
-
when '%'
|
|
33
|
-
scaled_by(other)
|
|
34
|
-
when '@'
|
|
35
|
-
scaled_by(other.width * 100 / (self.width * self.height))
|
|
36
|
-
else
|
|
37
|
-
scaled_to_fit(other)
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
alias :* :transformed_by
|
|
41
|
-
|
|
42
|
-
# Tests whether two geometries are identical in dimensions and modifier.
|
|
43
|
-
def == (other)
|
|
44
|
-
self.to_s == other.to_s
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
# Tests whether two geometries have the same dimensions, ignoring modifier.
|
|
48
|
-
def =~ (other)
|
|
49
|
-
self.height.to_i == other.height.to_i && self.width.to_i == other.width.to_i
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
# Scales this geometry to fit within that geometry.
|
|
53
|
-
def scaled_to_fit(other)
|
|
54
|
-
if (other.width > 0 && other.height == 0)
|
|
55
|
-
Geometry.new(other.width, self.height * other.width / self.width)
|
|
56
|
-
elsif (other.width == 0 && other.height > 0)
|
|
57
|
-
Geometry.new(self.width * other.height / self.height, other.height)
|
|
58
|
-
else
|
|
59
|
-
ratio = Geometry.new( other.width / self.width, other.height / self.height )
|
|
60
|
-
if ratio.square?
|
|
61
|
-
other.without_modifier
|
|
62
|
-
elsif ratio.horizontal?
|
|
63
|
-
Geometry.new(ratio.height * self.width, other.height)
|
|
64
|
-
else
|
|
65
|
-
Geometry.new(other.width, ratio.width * self.height)
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
# Scales this geometry by the percentage(s) specified in that geometry.
|
|
71
|
-
def scaled_by(other)
|
|
72
|
-
other = Geometry.new("#{other}%") unless other.is_a? Geometry
|
|
73
|
-
if other.height > 0
|
|
74
|
-
Geometry.new(self.width * other.width / 100, self.height * other.height / 100)
|
|
75
|
-
else
|
|
76
|
-
Geometry.new(self.width * other.width / 100, self.height * other.width / 100)
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
end
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
def obtain_class
|
|
2
|
-
class_name = ENV['CLASS'] || ENV['class']
|
|
3
|
-
raise "Must specify CLASS" unless class_name
|
|
4
|
-
@klass = Object.const_get(class_name)
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
def obtain_attachments
|
|
8
|
-
name = ENV['ATTACHMENT'] || ENV['attachment']
|
|
9
|
-
raise "Class #{@klass.name} has no attachments specified" unless @klass.respond_to?(:attachment_definitions)
|
|
10
|
-
if !name.blank? && @klass.attachment_definitions.keys.include?(name)
|
|
11
|
-
[ name ]
|
|
12
|
-
else
|
|
13
|
-
@klass.attachment_definitions.keys
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def for_all_attachments
|
|
18
|
-
klass = obtain_class
|
|
19
|
-
names = obtain_attachments
|
|
20
|
-
ids = klass.connection.select_values(klass.send(:construct_finder_sql, :select => 'id'))
|
|
21
|
-
|
|
22
|
-
ids.each do |id|
|
|
23
|
-
instance = klass.find(id)
|
|
24
|
-
names.each do |name|
|
|
25
|
-
result = if instance.send("#{ name }?")
|
|
26
|
-
yield(instance, name)
|
|
27
|
-
else
|
|
28
|
-
true
|
|
29
|
-
end
|
|
30
|
-
print result ? "." : "x"; $stdout.flush
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
puts " Done."
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
namespace :paperclip do
|
|
37
|
-
desc "Refreshes both metadata and thumbnails."
|
|
38
|
-
task :refresh => ["paperclip:refresh:metadata", "paperclip:refresh:thumbnails"]
|
|
39
|
-
|
|
40
|
-
namespace :refresh do
|
|
41
|
-
desc "Regenerates thumbnails for a given CLASS (and optional ATTACHMENT)."
|
|
42
|
-
task :thumbnails => :environment do
|
|
43
|
-
errors = []
|
|
44
|
-
for_all_attachments do |instance, name|
|
|
45
|
-
result = instance.send(name).reprocess!
|
|
46
|
-
errors << [instance.id, instance.errors] unless instance.errors.blank?
|
|
47
|
-
result
|
|
48
|
-
end
|
|
49
|
-
errors.each{|e| puts "#{e.first}: #{e.last.full_messages.inspect}" }
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
desc "Regenerates content_type/size metadata for a given CLASS (and optional ATTACHMENT)."
|
|
53
|
-
task :metadata => :environment do
|
|
54
|
-
for_all_attachments do |instance, name|
|
|
55
|
-
if file = instance.send(name).to_file
|
|
56
|
-
instance.send("#{name}_file_name=", instance.send("#{name}_file_name").strip)
|
|
57
|
-
instance.send("#{name}_content_type=", file.content_type.strip)
|
|
58
|
-
instance.send("#{name}_file_size=", file.size) if instance.respond_to?("#{name}_file_size")
|
|
59
|
-
instance.save(false)
|
|
60
|
-
else
|
|
61
|
-
true
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
desc "Cleans out invalid attachments. Useful after you've added new validations."
|
|
68
|
-
task :clean => :environment do
|
|
69
|
-
for_all_attachments do |instance, name|
|
|
70
|
-
instance.send(name).send(:validate)
|
|
71
|
-
if instance.send(name).valid?
|
|
72
|
-
true
|
|
73
|
-
else
|
|
74
|
-
instance.send("#{name}=", nil)
|
|
75
|
-
instance.save
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
end
|