avo 3.6.2 → 3.6.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: 18021c215725ef9b00b8a4377ed723200fb85fce9ae8b1237940c2947df2ecad
4
- data.tar.gz: 1f2d1c937a848c8aef1bbb48794f3f1f560fc5809f806d779780b94ff0a6e974
3
+ metadata.gz: 1686cd42a28d62d2877e3db2582df2ad34a6e30d27002151c1f3cc3b92490ac7
4
+ data.tar.gz: 319d4b0e6ad38d87e88379cef31c8ec650961643c5268d86b20e5579bb693b35
5
5
  SHA512:
6
- metadata.gz: ce92074952caba25bf58406248f6f2b8b17d26bf693d822cf02d194507a804bd415c2b5f804f7f67b78c5b79beb942d0b61337fbd10e3b7c6e3f3d3548a107a2
7
- data.tar.gz: 2275e379c8f80e2682deb51909d7152a9506411df1979f277fad78d265051f322152a700ad817688b00313a75a501a22ec4b09fd8c6c905d91ee15a9ba57d324
6
+ metadata.gz: 6bb3637bf610b0ee8b78642685661015e26371d44e9dd7c31bf3e0796b89c9698f4e026a37f0378c4457e933a381f63040e66cd3dc55f155e7ba74e746b7b743
7
+ data.tar.gz: '081b731423609d9f8f53dd1fa1866b37674aacf3374f7911d582b426a533ee1caf3d390563c7d2807db52a58db916c6ced8099ec1d703ffc2c13c1d31882b950'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (3.6.2)
4
+ avo (3.6.4)
5
5
  actionview (>= 6.1)
6
6
  active_link_to
7
7
  activerecord (>= 6.1)
@@ -7252,11 +7252,6 @@ tag.tagify__tag{
7252
7252
  margin-right:1.5rem
7253
7253
  }
7254
7254
 
7255
- .mx-auto{
7256
- margin-left:auto;
7257
- margin-right:auto
7258
- }
7259
-
7260
7255
  .my-0{
7261
7256
  margin-top:0px;
7262
7257
  margin-bottom:0px
@@ -7796,10 +7791,6 @@ tag.tagify__tag{
7796
7791
  max-width:32rem
7797
7792
  }
7798
7793
 
7799
- .max-w-screen-xl{
7800
- max-width:1280px
7801
- }
7802
-
7803
7794
  .max-w-xs{
7804
7795
  max-width:20rem
7805
7796
  }
@@ -11091,17 +11082,6 @@ trix-editor {
11091
11082
  }
11092
11083
  }
11093
11084
 
11094
- .rtl\:space-x-reverse:where([dir="rtl"], [dir="rtl"] *) > :not([hidden]) ~ :not([hidden]){
11095
- --tw-space-x-reverse:1
11096
- }
11097
-
11098
- @media (prefers-color-scheme: dark){
11099
- .dark\:bg-gray-900{
11100
- --tw-bg-opacity:1;
11101
- background-color:rgb(23 25 28 / var(--tw-bg-opacity))
11102
- }
11103
- }
11104
-
11105
11085
  @media print{
11106
11086
  .print\:hidden{
11107
11087
  display:none
@@ -4,6 +4,10 @@ class Avo::Index::ResourceTableComponent < Avo::BaseComponent
4
4
  include Avo::ApplicationHelper
5
5
  attr_reader :pagy, :query
6
6
 
7
+ def before_render
8
+ @header_fields, @table_row_components = cache_table_rows
9
+ end
10
+
7
11
  def initialize(resources: nil, resource: nil, reflection: nil, parent_record: nil, parent_resource: nil, pagy: nil, query: nil, actions: nil)
8
12
  @resources = resources
9
13
  @resource = resource
@@ -13,7 +17,6 @@ class Avo::Index::ResourceTableComponent < Avo::BaseComponent
13
17
  @pagy = pagy
14
18
  @query = query
15
19
  @actions = actions
16
- cache_table_rows
17
20
  end
18
21
 
19
22
  def encrypted_query
@@ -44,33 +47,33 @@ class Avo::Index::ResourceTableComponent < Avo::BaseComponent
44
47
  def cache_table_rows
45
48
  # Cache the execution of the following block if caching is enabled in Avo configuration
46
49
  cache_if Avo.configuration.cache_resources_on_index_view, @resource.cache_hash(@parent_record), expires_in: 1.day do
47
- # Initialize arrays to hold header fields and table row components
48
- @header_fields = []
49
- @table_row_components = []
50
-
51
- generate_table_row_components
52
-
53
- # Remove duplicate header fields based on table_header_label
54
- @header_fields.uniq!(&:table_header_label)
50
+ header_fields, table_row_components = generate_table_row_components
55
51
 
56
52
  # Create an array of header field labels used for each row to render values on the right column
57
- @header_fields_ids = @header_fields.map(&:table_header_label)
53
+ header_fields_ids = header_fields.map(&:table_header_label)
58
54
 
59
55
  # Assign header field IDs to each TableRowComponent
60
56
  # We assign it here because only complete header fields array after last table row.
61
- @table_row_components.map { |table_row_component| table_row_component.header_fields = @header_fields_ids }
57
+ table_row_components.map { |table_row_component| table_row_component.header_fields = header_fields_ids }
58
+
59
+ # Return header fields and table row components
60
+ return [header_fields, table_row_components]
62
61
  end
63
62
  end
64
63
 
65
64
  def generate_table_row_components
65
+ # Initialize arrays to hold header fields and table row components
66
+ header_fields = []
67
+ table_row_components = []
68
+
66
69
  # Loop through each resource in @resources
67
70
  @resources.each do |resource|
68
71
  # Get fields for the current resource and concat them to the @header_fields
69
72
  row_fields = resource.get_fields(reflection: @reflection, only_root: true)
70
- @header_fields.concat row_fields
73
+ header_fields.concat row_fields
71
74
 
72
75
  # Create a TableRowComponent instance for the resource and add it to @table_row_components
73
- @table_row_components << Avo::Index::TableRowComponent.new(
76
+ table_row_components << Avo::Index::TableRowComponent.new(
74
77
  resource: resource,
75
78
  fields: row_fields,
76
79
  reflection: @reflection,
@@ -79,5 +82,10 @@ class Avo::Index::ResourceTableComponent < Avo::BaseComponent
79
82
  actions: @actions
80
83
  )
81
84
  end
85
+
86
+ # Remove duplicate header fields based on table_header_label
87
+ header_fields.uniq!(&:table_header_label)
88
+
89
+ [header_fields, table_row_components]
82
90
  end
83
91
  end
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "3.6.2" unless const_defined?(:VERSION)
2
+ VERSION = "3.6.4" 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: 3.6.2
4
+ version: 3.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Marin