avo 2.34.5 → 2.34.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of avo might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a18c7280a487eda50ae3c5977eb8971606de858f3d7d166041fd197dcaba7650
4
- data.tar.gz: ffe44e5efac3587842e1b41eec3dcdb74ad44de75b26b582e23b09c0ef537ca8
3
+ metadata.gz: 07a4019fae34650385f9b72af6444f8fcf582fcb9b69c64da0b9f18330db9094
4
+ data.tar.gz: 320fe93195ac2b24e97dac6361fa3ffe3456a695ca10e8a7edcc73d2c75945e3
5
5
  SHA512:
6
- metadata.gz: 62e48f3bafebed5689634122390accc26cf500ab684c739cb58c2154e8b29c81a51abaf08867aafc397115d795e74c7eacd80dbcbdef04f4ef82aec27fba5aa3
7
- data.tar.gz: 5d36a86586779c5160d48325719ee127b05e9ba733585abf91616d50a8461e95059b1dc74fc11fee4f6c8d3d64c957035f6787262e59f0bee99e132a04da2823
6
+ metadata.gz: 1840d1903d337a1977a9499cc204c5bb273e4b791aa97d702877e4d3212c19b61fde121bfb7f96c1f3c8b8551a11996cd55283e2207637856afb9167fa43f23b
7
+ data.tar.gz: 418635b25ca1e73c52f3f6f7c1426b1293c9fb1aa2d537eafb2bf3e3f9c9fc8755144fa539322fd79318da1b1189982221581f13a22632a642d524855b53a07a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (2.34.5)
4
+ avo (2.34.6)
5
5
  actionview (>= 6.0)
6
6
  active_link_to
7
7
  activerecord (>= 6.0)
@@ -421,7 +421,7 @@ GEM
421
421
  tzinfo (2.0.6)
422
422
  concurrent-ruby (~> 1.0)
423
423
  unicode-display_width (2.4.0)
424
- view_component (3.1.0)
424
+ view_component (3.2.0)
425
425
  activesupport (>= 5.2.0, < 8.0)
426
426
  concurrent-ruby (~> 1.0)
427
427
  method_source (~> 1.0)
@@ -6,10 +6,10 @@ class Avo::Fields::FileField::IndexComponent < Avo::Fields::IndexComponent
6
6
  end
7
7
 
8
8
  def has_image_tag?
9
- @field.value.attached? && @field.value.representable? && @field.is_image
9
+ field.value.present? && field.value.attached? && field.value.representable? && field.is_image
10
10
  end
11
11
 
12
12
  def has_audio_tag?
13
- @field.value.attached? && @field.is_audio
13
+ field.value.present? && field.value.attached? && field.is_audio
14
14
  end
15
15
  end
@@ -3,6 +3,7 @@
3
3
  class Avo::Fields::IndexComponent < Avo::BaseComponent
4
4
  include Avo::ResourcesHelper
5
5
 
6
+ attr_reader :field
6
7
  attr_reader :parent_resource
7
8
  attr_reader :view
8
9
 
@@ -235,8 +235,15 @@ module Avo
235
235
  end
236
236
 
237
237
  def eager_load_files(resource, query)
238
- if resource.attached_file_fields.present?
239
- resource.attached_file_fields.map do |field|
238
+ # Get the non-computed file fields and try to eager load them
239
+ attachment_fields = resource
240
+ .attachment_fields
241
+ .reject do |field|
242
+ field.computed
243
+ end
244
+
245
+ if attachment_fields.present?
246
+ attachment_fields.map do |field|
240
247
  attachment = case field.class.to_s
241
248
  when "Avo::Fields::FileField"
242
249
  "attachment"
@@ -301,7 +301,7 @@ module Avo
301
301
  view_types
302
302
  end
303
303
 
304
- def attached_file_fields
304
+ def attachment_fields
305
305
  get_field_definitions.select do |field|
306
306
  [Avo::Fields::FileField, Avo::Fields::FilesField].include? field.class
307
307
  end
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "2.34.5" unless const_defined?(:VERSION)
2
+ VERSION = "2.34.6" unless const_defined?(:VERSION)
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.34.5
4
+ version: 2.34.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Marin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-06-12 00:00:00.000000000 Z
12
+ date: 2023-06-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord