effective_storage 0.4.3 → 0.4.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fd5855eb03beb973377deab121f3a632fe8afc28999b802717ab8300c1bfb60
|
4
|
+
data.tar.gz: b519d27a7ad134900899897874b40bf6a10cf36b34c64a3836507731880a8ba0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0093a45fdfe5cabef645f11913770d36070ccc395dc6aa85b71a9aa0fb750e8319be4f752dc628f8e9379ebf229503c0b5cdcf2d5179fec304d86a0f3504041e'
|
7
|
+
data.tar.gz: 255295667680f5a9dd9b5c9a097ea06d4b7d93ea1e849ecd5fb84cf5966634b9ec844acc92ce0148683f3e1a04c29fa2d034e78f044ff1f1b3c8126492725290
|
@@ -56,6 +56,10 @@ module Admin
|
|
56
56
|
end.join.html_safe
|
57
57
|
end
|
58
58
|
|
59
|
+
col :bucket, visible: false do |blob|
|
60
|
+
blob.attachments.map { |attachment| attachment.name }.join.html_safe
|
61
|
+
end
|
62
|
+
|
59
63
|
col :filename, label: 'File' do |blob|
|
60
64
|
content_tag(:div, class: 'col-resource_item') do
|
61
65
|
link_to(blob.filename, url_for(blob), target: '_blank')
|
@@ -80,7 +84,15 @@ module Admin
|
|
80
84
|
end
|
81
85
|
|
82
86
|
collection do
|
83
|
-
ActiveStorage::Blob.all.deep.left_outer_joins(:attachments)
|
87
|
+
scope = ActiveStorage::Blob.all.deep.left_outer_joins(:attachments)
|
88
|
+
|
89
|
+
if attributes[:resource_id].present? && attributes[:resource_type].present?
|
90
|
+
attachments = ActiveStorage::Attachment.where(record_id: attributes[:resource_id], record_type: attributes[:resource_type])
|
91
|
+
scope = scope.where(id: attachments.select(:blob_id))
|
92
|
+
end
|
93
|
+
|
94
|
+
scope
|
95
|
+
|
84
96
|
end
|
85
97
|
|
86
98
|
end
|