avo 3.6.3 → 3.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/assets/builds/avo.base.css +20 -0
- data/app/components/avo/index/resource_controls_component.html.erb +2 -2
- data/app/components/avo/index/resource_table_component.rb +20 -13
- data/app/components/avo/views/resource_index_component.html.erb +1 -0
- data/lib/avo/fields/trix_field.rb +1 -1
- data/lib/avo/version.rb +1 -1
- data/public/avo-assets/avo.base.css +4 -0
- data/tailwind.preset.js +3 -1
- 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: 0eccb23370cf981398626b999f8f330adb6574025cf3ebc5280db1e003d5be84
|
4
|
+
data.tar.gz: 51b8e80d74267ad7a7c4d4207b0290c45a439c96d184e0489b3870ca8d74d809
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5aa905525606ec8fac630fec53aa11ab66cf1e1a6dadb47064bc9cb3083fb0804f7eef1e3335a5960500dcbbd33fd63474b8ca9294b2d18baa8133ced753804
|
7
|
+
data.tar.gz: 0cccbeb4c71c3ebab915444b06bb9c6faf8e0bd057eea028c21b4067e0d2a475b5bb0cf5297ffcf9f558b5fb3cdcda4034806581f16b0f0d6a00f1eb4bfd3dd3
|
data/Gemfile.lock
CHANGED
@@ -7252,6 +7252,11 @@ 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
|
+
|
7255
7260
|
.my-0{
|
7256
7261
|
margin-top:0px;
|
7257
7262
|
margin-bottom:0px
|
@@ -7791,6 +7796,10 @@ tag.tagify__tag{
|
|
7791
7796
|
max-width:32rem
|
7792
7797
|
}
|
7793
7798
|
|
7799
|
+
.max-w-screen-xl{
|
7800
|
+
max-width:1280px
|
7801
|
+
}
|
7802
|
+
|
7794
7803
|
.max-w-xs{
|
7795
7804
|
max-width:20rem
|
7796
7805
|
}
|
@@ -11082,6 +11091,17 @@ trix-editor {
|
|
11082
11091
|
}
|
11083
11092
|
}
|
11084
11093
|
|
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
|
+
|
11085
11105
|
@media print{
|
11086
11106
|
.print\:hidden{
|
11087
11107
|
display:none
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
1
|
+
<%= content_tag :div, class: "space-x-2 flex flex-row justify-between ml-2 has-record-selector:ml-0" do %>
|
2
2
|
<% @resource.render_row_controls(item: singular_resource_name).each do |control| %>
|
3
3
|
<%= render_control control %>
|
4
4
|
<% end %>
|
5
|
-
|
5
|
+
<% end %>
|
@@ -4,7 +4,9 @@ class Avo::Index::ResourceTableComponent < Avo::BaseComponent
|
|
4
4
|
include Avo::ApplicationHelper
|
5
5
|
attr_reader :pagy, :query
|
6
6
|
|
7
|
-
def before_render
|
7
|
+
def before_render
|
8
|
+
@header_fields, @table_row_components = cache_table_rows
|
9
|
+
end
|
8
10
|
|
9
11
|
def initialize(resources: nil, resource: nil, reflection: nil, parent_record: nil, parent_resource: nil, pagy: nil, query: nil, actions: nil)
|
10
12
|
@resources = resources
|
@@ -45,33 +47,33 @@ class Avo::Index::ResourceTableComponent < Avo::BaseComponent
|
|
45
47
|
def cache_table_rows
|
46
48
|
# Cache the execution of the following block if caching is enabled in Avo configuration
|
47
49
|
cache_if Avo.configuration.cache_resources_on_index_view, @resource.cache_hash(@parent_record), expires_in: 1.day do
|
48
|
-
|
49
|
-
@header_fields = []
|
50
|
-
@table_row_components = []
|
51
|
-
|
52
|
-
generate_table_row_components
|
53
|
-
|
54
|
-
# Remove duplicate header fields based on table_header_label
|
55
|
-
@header_fields.uniq!(&:table_header_label)
|
50
|
+
header_fields, table_row_components = generate_table_row_components
|
56
51
|
|
57
52
|
# Create an array of header field labels used for each row to render values on the right column
|
58
|
-
|
53
|
+
header_fields_ids = header_fields.map(&:table_header_label)
|
59
54
|
|
60
55
|
# Assign header field IDs to each TableRowComponent
|
61
56
|
# We assign it here because only complete header fields array after last table row.
|
62
|
-
|
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]
|
63
61
|
end
|
64
62
|
end
|
65
63
|
|
66
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
|
+
|
67
69
|
# Loop through each resource in @resources
|
68
70
|
@resources.each do |resource|
|
69
71
|
# Get fields for the current resource and concat them to the @header_fields
|
70
72
|
row_fields = resource.get_fields(reflection: @reflection, only_root: true)
|
71
|
-
|
73
|
+
header_fields.concat row_fields
|
72
74
|
|
73
75
|
# Create a TableRowComponent instance for the resource and add it to @table_row_components
|
74
|
-
|
76
|
+
table_row_components << Avo::Index::TableRowComponent.new(
|
75
77
|
resource: resource,
|
76
78
|
fields: row_fields,
|
77
79
|
reflection: @reflection,
|
@@ -80,5 +82,10 @@ class Avo::Index::ResourceTableComponent < Avo::BaseComponent
|
|
80
82
|
actions: @actions
|
81
83
|
)
|
82
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]
|
83
90
|
end
|
84
91
|
end
|
@@ -23,7 +23,7 @@ module Avo
|
|
23
23
|
|
24
24
|
# Identify if field is bonded to a rich text model attribute
|
25
25
|
def is_action_text?
|
26
|
-
return false if record.nil? || !record.respond_to?(id)
|
26
|
+
return false if !defined?(ActionText::RichText) || record.nil? || !record.respond_to?(id)
|
27
27
|
|
28
28
|
record.send(id).is_a?(ActionText::RichText)
|
29
29
|
end
|
data/lib/avo/version.rb
CHANGED
@@ -10733,6 +10733,10 @@ trix-editor {
|
|
10733
10733
|
width:100%
|
10734
10734
|
}
|
10735
10735
|
|
10736
|
+
.has-record-selector .has-record-selector\:ml-0{
|
10737
|
+
margin-left:0px
|
10738
|
+
}
|
10739
|
+
|
10736
10740
|
@media (min-width: 495px){
|
10737
10741
|
.xs\:grid-cols-2{
|
10738
10742
|
grid-template-columns:repeat(2, minmax(0, 1fr))
|
data/tailwind.preset.js
CHANGED
@@ -147,9 +147,11 @@ module.exports = {
|
|
147
147
|
},
|
148
148
|
}
|
149
149
|
|
150
|
+
addUtilities(newUtilities, ['group-hover'])
|
151
|
+
|
150
152
|
// Add has-sidebar variant to make it easier to target fields in panels and use the full-width
|
151
153
|
addVariant('has-sidebar', '.has-sidebar & ')
|
152
|
-
|
154
|
+
addVariant('has-record-selector', '.has-record-selector & ')
|
153
155
|
}),
|
154
156
|
],
|
155
157
|
}
|
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.
|
4
|
+
version: 3.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Marin
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-05-
|
13
|
+
date: 2024-05-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|