effective_storage 0.4.3 → 0.4.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9230c3cd21cf195cdf1b24f42bf4221c8a7a2619a78b2ba3cc4ef7d132906e4d
4
- data.tar.gz: 7121042e8928e76541e60f595f93461ed767563e62d5e3f2251dda5f9b6239da
3
+ metadata.gz: 3fd5855eb03beb973377deab121f3a632fe8afc28999b802717ab8300c1bfb60
4
+ data.tar.gz: b519d27a7ad134900899897874b40bf6a10cf36b34c64a3836507731880a8ba0
5
5
  SHA512:
6
- metadata.gz: 8798dd36a2b61b525416d8eb27a4c4d291d8380df42690c088f17ec76ddd1ebef5e995a0a97293fa105a19b00bb44b12cb325073345a975a245aeaf25dfcd3b2
7
- data.tar.gz: ab3c5af1ae73962ada0a37cfdb2edda28a81ff8bd3b081b62e5e90eb5a1ee4335eda7247c34af16982ca79adf4fdff11e0a7eb27150d98a47e8d1f2bce8dea40
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
@@ -1,3 +1,3 @@
1
1
  module EffectiveStorage
2
- VERSION = '0.4.3'.freeze
2
+ VERSION = '0.4.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_storage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect