avo 2.34.6 → 2.34.7.pre.1
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 +4 -4
- data/Gemfile.lock +1 -1
- data/app/components/avo/alert_component.html.erb +1 -1
- data/app/components/avo/field_wrapper_component.rb +1 -1
- data/app/components/avo/item_switcher_component.html.erb +9 -4
- data/app/components/avo/item_switcher_component.rb +2 -1
- data/app/components/avo/row_component.html.erb +3 -0
- data/app/components/avo/row_component.rb +12 -0
- data/config/master.key +1 -0
- data/lib/avo/concerns/has_fields.rb +6 -0
- data/lib/avo/concerns/is_resource_item.rb +4 -0
- data/lib/avo/items_holder.rb +4 -0
- data/lib/avo/panel.rb +0 -4
- data/lib/avo/panel_builder.rb +1 -0
- data/lib/avo/row.rb +26 -0
- data/lib/avo/row_builder.rb +24 -0
- data/lib/avo/version.rb +1 -1
- data/public/avo-assets/avo.base.css +5 -1
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf01123b539f33d10323279e5162841e59402b07583e7c895d573a96339eb7c1
|
4
|
+
data.tar.gz: c2afd468f20c50b6a6f8bdfce571334315c8b217fb74cc3201cfdd45f4e77d28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4949887f9e1aa83ce3b8d8ea7d0645b6c00a5ee91af6ae6686069a55aa4273258c8dcbca98c90d2ee4c2b2086a340f4917c79c7b1108a4cdb70628c09271c30d
|
7
|
+
data.tar.gz: 724fb04515d3f0fbdfa1646ce45c574f0fdc5a8461af54924fe90f205441a676c5e39a549d72c81b16fdaaf4a21a9cff985d43f94dc5e0cae3ecdece73da8a47
|
data/Gemfile.lock
CHANGED
@@ -41,7 +41,7 @@ class Avo::FieldWrapperComponent < ViewComponent::Base
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def classes(extra_classes = "")
|
44
|
-
"field-wrapper relative flex flex-col
|
44
|
+
"field-wrapper relative flex flex-col grow pb-2 md:pb-0 leading-tight min-h-14 h-full #{stacked? ? "field-wrapper-layout-stacked" : "field-wrapper-layout-inline md:flex-row md:items-center"} #{compact? ? "field-wrapper-size-compact" : "field-wrapper-size-regular"} #{full_width? ? "field-width-full" : "field-width-regular"} #{@classes || ""} #{extra_classes || ""} #{@field.get_html(:classes, view: view, element: :wrapper)}"
|
45
45
|
end
|
46
46
|
|
47
47
|
def style
|
@@ -7,10 +7,7 @@
|
|
7
7
|
<% c.with_body do %>
|
8
8
|
<div class="divide-y">
|
9
9
|
<% item.visible_items.each_with_index do |field, index| %>
|
10
|
-
<%= render field
|
11
|
-
.hydrate(resource: @resource, model: @resource.model, user: resource.user, view: view)
|
12
|
-
.component_for_view(view)
|
13
|
-
.new(field: field, resource: @resource, index: index, form: form) %>
|
10
|
+
<%= render Avo::ItemSwitcherComponent.new resource: @resource, item: field, index: index, view: @view, form: form %>
|
14
11
|
<% end %>
|
15
12
|
</div>
|
16
13
|
<% end %>
|
@@ -19,4 +16,12 @@
|
|
19
16
|
<%= render tab_group_component %>
|
20
17
|
<% elsif item.is_field? %>
|
21
18
|
<%= render field_component %>
|
19
|
+
<% elsif item.is_row? %>
|
20
|
+
<%= render Avo::RowComponent.new do |c| %>
|
21
|
+
<% c.with_body do %>
|
22
|
+
<% item.visible_items.each_with_index do |field, index| %>
|
23
|
+
<%= render Avo::ItemSwitcherComponent.new resource: @resource, item: field, index: index, view: @view, form: form %>
|
24
|
+
<% end %>
|
25
|
+
<% end %>
|
26
|
+
<% end %>
|
22
27
|
<% end %>
|
@@ -42,6 +42,7 @@ class Avo::ItemSwitcherComponent < Avo::BaseComponent
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def field_component
|
45
|
-
item.
|
45
|
+
final_item = item.dup.hydrate(resource: @resource, model: @resource.model, user: resource.user, view: view)
|
46
|
+
final_item.component_for_view(@view).new(field: final_item, resource: @resource, index: index, form: form)
|
46
47
|
end
|
47
48
|
end
|
data/config/master.key
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2aeb23d82b909d9c6b5abb62f7058c2a
|
data/lib/avo/items_holder.rb
CHANGED
@@ -38,6 +38,10 @@ module Avo
|
|
38
38
|
add_item Avo::TabBuilder.parse_block(name: name, **args, &block)
|
39
39
|
end
|
40
40
|
|
41
|
+
def row(**args, &block)
|
42
|
+
add_item Avo::RowBuilder.parse_block(**args, &block)
|
43
|
+
end
|
44
|
+
|
41
45
|
def tool(klass, **args)
|
42
46
|
instance = klass.new(**args)
|
43
47
|
add_item instance
|
data/lib/avo/panel.rb
CHANGED
data/lib/avo/panel_builder.rb
CHANGED
data/lib/avo/row.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
class Avo::Row
|
2
|
+
include Avo::Concerns::IsResourceItem
|
3
|
+
include Avo::Concerns::VisibleItems
|
4
|
+
|
5
|
+
class_attribute :item_type, default: :row
|
6
|
+
|
7
|
+
attr_reader :view
|
8
|
+
attr_accessor :items_holder
|
9
|
+
|
10
|
+
delegate :items, :add_item, to: :items_holder
|
11
|
+
|
12
|
+
def initialize(view: nil)
|
13
|
+
@view = view
|
14
|
+
@items_holder = Avo::ItemsHolder.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def hydrate(view: nil, **args)
|
18
|
+
@view = view
|
19
|
+
|
20
|
+
self
|
21
|
+
end
|
22
|
+
|
23
|
+
def has_items?
|
24
|
+
@items.present?
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class Avo::RowBuilder
|
2
|
+
class << self
|
3
|
+
def parse_block(**args, &block)
|
4
|
+
Docile.dsl_eval(new(**args), &block).build
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
attr_reader :items_holder
|
9
|
+
|
10
|
+
delegate :field, to: :items_holder
|
11
|
+
delegate :tool, to: :items_holder
|
12
|
+
delegate :items, to: :items_holder
|
13
|
+
|
14
|
+
def initialize(**args)
|
15
|
+
@row = Avo::Row.new(**args)
|
16
|
+
@items_holder = Avo::ItemsHolder.new
|
17
|
+
end
|
18
|
+
|
19
|
+
# Fetch the tab
|
20
|
+
def build
|
21
|
+
@row.items_holder = @items_holder
|
22
|
+
@row
|
23
|
+
end
|
24
|
+
end
|
data/lib/avo/version.rb
CHANGED
@@ -6988,11 +6988,15 @@ trix-toolbar .trix-button-group:not(:first-child){
|
|
6988
6988
|
flex-shrink:0
|
6989
6989
|
}
|
6990
6990
|
|
6991
|
+
.shrink-0{
|
6992
|
+
flex-shrink:0
|
6993
|
+
}
|
6994
|
+
|
6991
6995
|
.flex-grow-0{
|
6992
6996
|
flex-grow:0
|
6993
6997
|
}
|
6994
6998
|
|
6995
|
-
.
|
6999
|
+
.grow{
|
6996
7000
|
flex-grow:1
|
6997
7001
|
}
|
6998
7002
|
|
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.
|
4
|
+
version: 2.34.7.pre.1
|
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
|
+
date: 2023-06-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -1565,6 +1565,8 @@ files:
|
|
1565
1565
|
- app/components/avo/resource_component.rb
|
1566
1566
|
- app/components/avo/resource_sidebar_component.html.erb
|
1567
1567
|
- app/components/avo/resource_sidebar_component.rb
|
1568
|
+
- app/components/avo/row_component.html.erb
|
1569
|
+
- app/components/avo/row_component.rb
|
1568
1570
|
- app/components/avo/sidebar/base_item_component.rb
|
1569
1571
|
- app/components/avo/sidebar/group_component.html.erb
|
1570
1572
|
- app/components/avo/sidebar/group_component.rb
|
@@ -1714,6 +1716,7 @@ files:
|
|
1714
1716
|
- config/credentials.yml.enc
|
1715
1717
|
- config/i18n-tasks.yml
|
1716
1718
|
- config/initializers/pagy.rb
|
1719
|
+
- config/master.key
|
1717
1720
|
- config/routes.rb
|
1718
1721
|
- config/spring.rb
|
1719
1722
|
- db/factories.rb
|
@@ -1849,6 +1852,8 @@ files:
|
|
1849
1852
|
- lib/avo/resources/controls/execution_context.rb
|
1850
1853
|
- lib/avo/resources/controls/items_holder.rb
|
1851
1854
|
- lib/avo/resources/controls/link_to.rb
|
1855
|
+
- lib/avo/row.rb
|
1856
|
+
- lib/avo/row_builder.rb
|
1852
1857
|
- lib/avo/services/authorization_clients/nil_client.rb
|
1853
1858
|
- lib/avo/services/authorization_clients/pundit_client.rb
|
1854
1859
|
- lib/avo/services/authorization_service.rb
|
@@ -1977,9 +1982,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
1977
1982
|
version: 2.6.0
|
1978
1983
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1979
1984
|
requirements:
|
1980
|
-
- - "
|
1985
|
+
- - ">"
|
1981
1986
|
- !ruby/object:Gem::Version
|
1982
|
-
version:
|
1987
|
+
version: 1.3.1
|
1983
1988
|
requirements: []
|
1984
1989
|
rubygems_version: 3.3.3
|
1985
1990
|
signing_key:
|