rhino_project_core 0.22.0.beta.7 → 0.30.0.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rhino/resource/active_storage_extension.rb +20 -5
- data/lib/rhino/version.rb +2 -2
- 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: '09bab6f8b81658c76669317d949e44e1e0728d7be46cb80793fa2488ffcff097'
|
4
|
+
data.tar.gz: 571b132824ac728b7e8072095a106c9731350abe88ce69d74b46852fe3ada36f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 134e615ee50fbfe6de3f37a04a633dc82b89cdcae1d7c2e881b2000f759bdabae4ff22d2e0912d9d642660ee4ff323238b2d134c4644552082dc2d05e252e896
|
7
|
+
data.tar.gz: 975781708959682419d2f40637cf1833dc316f05d353d12422de0074a1a541f63db49f06d7de18e084ecaaaad3460604df9ccaf929ba5ad1e6050b155e176e18
|
@@ -11,15 +11,30 @@ module Rhino
|
|
11
11
|
included do
|
12
12
|
attribute :url
|
13
13
|
attribute :url_attachment
|
14
|
+
attribute :variants, :json, default: {}
|
14
15
|
|
15
16
|
rhino_policy :active_storage_attachment
|
16
17
|
|
17
|
-
def url
|
18
|
-
Rails.application.routes.url_helpers.rails_blob_url(
|
18
|
+
def url(attachment = self, **options)
|
19
|
+
Rails.application.routes.url_helpers.rails_blob_url(attachment, only_path: false, **options)
|
19
20
|
end
|
20
21
|
|
21
|
-
def url_attachment
|
22
|
-
|
22
|
+
def url_attachment(attachment = self)
|
23
|
+
url(attachment, disposition: :attachment)
|
24
|
+
end
|
25
|
+
|
26
|
+
def variants
|
27
|
+
# Not everything may be processed into a variant based on mime type
|
28
|
+
return unless variable?
|
29
|
+
|
30
|
+
record.attachment_reflections[self.name]&.named_variants&.keys&.index_with do |v|
|
31
|
+
variant = variant(v)
|
32
|
+
|
33
|
+
{
|
34
|
+
url: url(variant),
|
35
|
+
url_attachment: url_attachment(variant)
|
36
|
+
}
|
37
|
+
end
|
23
38
|
end
|
24
39
|
|
25
40
|
def display_name
|
@@ -29,7 +44,7 @@ module Rhino
|
|
29
44
|
|
30
45
|
class_methods do
|
31
46
|
def readable_properties
|
32
|
-
super + ["signed_id"]
|
47
|
+
super + [ "variants", "signed_id"]
|
33
48
|
end
|
34
49
|
end
|
35
50
|
|
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.
|
4
|
+
version: 0.30.0.alpha.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JP Rosevear
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|