rhino_project_core 0.22.0.beta.14 → 0.22.0.beta.16
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/lib/rhino/resource/active_storage_extension.rb +24 -7
- data/lib/rhino/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4e60a13c3423ec6272e6827ef6aa0ef486bfa1f35b5aedb69c2a0e14dc7c71a
|
4
|
+
data.tar.gz: 5f720fce7978d5cb8e797eba9fc9625c9ed381fa7195ba8e093a6d0f4e8367f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b15fd92cd3e2d699f227326181f0ae26fe5aa6e9ef3970ef3194a71f72d3a2bf33f0c728a73d313285a5d0a2251ec425126eed43270ff23108896c4dae951bbd
|
7
|
+
data.tar.gz: a77279c76fcb085ac9293b6781c11711149a9417aa413ef7b440c937df37aec36e0a959f6be0e57c6513575a913606b3ae71f1ce8cfd9fae677903be6247954a
|
@@ -11,6 +11,8 @@ module Rhino
|
|
11
11
|
included do
|
12
12
|
attribute :url
|
13
13
|
attribute :url_attachment
|
14
|
+
attribute :previews, :json, default: {}
|
15
|
+
attribute :representations, :json, default: {}
|
14
16
|
attribute :variants, :json, default: {}
|
15
17
|
|
16
18
|
rhino_policy :active_storage_attachment
|
@@ -23,20 +25,35 @@ module Rhino
|
|
23
25
|
url(attachment, disposition: :attachment)
|
24
26
|
end
|
25
27
|
|
26
|
-
def
|
27
|
-
|
28
|
-
return unless variable?
|
28
|
+
def representations
|
29
|
+
return unless representable?
|
29
30
|
|
30
31
|
record.attachment_reflections[self.name]&.named_variants&.keys&.index_with do |v|
|
31
|
-
|
32
|
+
representation = representation(v)
|
32
33
|
|
33
34
|
{
|
34
|
-
url: url(
|
35
|
-
url_attachment: url_attachment(
|
35
|
+
url: url(representation),
|
36
|
+
url_attachment: url_attachment(representation)
|
36
37
|
}
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
41
|
+
# FIXME: Cache for performance
|
42
|
+
def previews
|
43
|
+
# Not everything may be processed into a preview based on mime type
|
44
|
+
return unless previewable?
|
45
|
+
|
46
|
+
representations
|
47
|
+
end
|
48
|
+
|
49
|
+
# FIXME: Cache for performance
|
50
|
+
def variants
|
51
|
+
# Not everything may be processed into a variant based on mime type
|
52
|
+
return unless variable?
|
53
|
+
|
54
|
+
representations
|
55
|
+
end
|
56
|
+
|
40
57
|
def display_name
|
41
58
|
filename.to_s
|
42
59
|
end
|
@@ -44,7 +61,7 @@ module Rhino
|
|
44
61
|
|
45
62
|
class_methods do
|
46
63
|
def readable_properties
|
47
|
-
super + [ "variants", "signed_id"]
|
64
|
+
super + [ "previews", "representations", "variants", "signed_id"]
|
48
65
|
end
|
49
66
|
end
|
50
67
|
|
data/lib/rhino/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rhino_project_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.22.0.beta.
|
4
|
+
version: 0.22.0.beta.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JP Rosevear
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|