avo 2.34.6 → 2.35.0
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/lib/avo/base_resource.rb +1 -1
- 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 +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5589a9a6b15cb0d2c1eb9371516e20cbbe381f2a200229ddbcaa5403bcae5df
|
4
|
+
data.tar.gz: 9eea597e445b850adcbb069f36582550c8de44394d6cd203ad63fe95ac1bcf12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f958930dd25efc24c12b04aa9f7986418ea4c230e6e545adce927b664d5861ef97ee3f1cb20a703db0b6e4fa0497d4edd4407aade748b30c345df82f9d1f490e
|
7
|
+
data.tar.gz: bb18b8e42aaac748f63da9a53ce2f7a42f65b4254aea02f7c56e9ad4ff5919c9a9340b9cadd798bd99d7f41c780cdf2c51d734b1e4f18109825d2314391fc9cc
|
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/lib/avo/base_resource.rb
CHANGED
@@ -218,7 +218,7 @@ module Avo
|
|
218
218
|
# get the model class off of the static property
|
219
219
|
return self.class.model_class if self.class.model_class.present?
|
220
220
|
|
221
|
-
# get the model class off of the model
|
221
|
+
# get the model class off of the model for STI models
|
222
222
|
return @model.base_class if @model.present?
|
223
223
|
|
224
224
|
# generate a model class
|
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.
|
4
|
+
version: 2.35.0
|
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-20 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
|
@@ -1849,6 +1851,8 @@ files:
|
|
1849
1851
|
- lib/avo/resources/controls/execution_context.rb
|
1850
1852
|
- lib/avo/resources/controls/items_holder.rb
|
1851
1853
|
- lib/avo/resources/controls/link_to.rb
|
1854
|
+
- lib/avo/row.rb
|
1855
|
+
- lib/avo/row_builder.rb
|
1852
1856
|
- lib/avo/services/authorization_clients/nil_client.rb
|
1853
1857
|
- lib/avo/services/authorization_clients/pundit_client.rb
|
1854
1858
|
- lib/avo/services/authorization_service.rb
|