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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 07a4019fae34650385f9b72af6444f8fcf582fcb9b69c64da0b9f18330db9094
4
- data.tar.gz: 320fe93195ac2b24e97dac6361fa3ffe3456a695ca10e8a7edcc73d2c75945e3
3
+ metadata.gz: bf01123b539f33d10323279e5162841e59402b07583e7c895d573a96339eb7c1
4
+ data.tar.gz: c2afd468f20c50b6a6f8bdfce571334315c8b217fb74cc3201cfdd45f4e77d28
5
5
  SHA512:
6
- metadata.gz: 1840d1903d337a1977a9499cc204c5bb273e4b791aa97d702877e4d3212c19b61fde121bfb7f96c1f3c8b8551a11996cd55283e2207637856afb9167fa43f23b
7
- data.tar.gz: 418635b25ca1e73c52f3f6f7c1426b1293c9fb1aa2d537eafb2bf3e3f9c9fc8755144fa539322fd79318da1b1189982221581f13a22632a642d524855b53a07a
6
+ metadata.gz: 4949887f9e1aa83ce3b8d8ea7d0645b6c00a5ee91af6ae6686069a55aa4273258c8dcbca98c90d2ee4c2b2086a340f4917c79c7b1108a4cdb70628c09271c30d
7
+ data.tar.gz: 724fb04515d3f0fbdfa1646ce45c574f0fdc5a8461af54924fe90f205441a676c5e39a549d72c81b16fdaaf4a21a9cff985d43f94dc5e0cae3ecdece73da8a47
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (2.34.6)
4
+ avo (2.34.7.pre.1)
5
5
  actionview (>= 6.0)
6
6
  active_link_to
7
7
  activerecord (>= 6.0)
@@ -10,7 +10,7 @@
10
10
  </div>
11
11
  <div class="ml-3 w-0 flex-1 pt-0.5">
12
12
  <p class="text-sm leading-5 font-semibold">
13
- <%= sanitize message %>
13
+ <%= sanitize message.to_s %>
14
14
  </p>
15
15
  </div>
16
16
  <div class="ml-4 flex-shrink-0 flex items-center">
@@ -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 flex-grow pb-2 md:pb-0 leading-tight min-h-14 #{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)}"
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.component_for_view(@view).new(field: item.hydrate(resource: @resource, view: @view, model: @resource.model), resource: @resource, index: index, form: form)
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
@@ -0,0 +1,3 @@
1
+ <div class="flex flex-col sm:flex-row min-h-14 grow shrink-0" data-component="<%= self.class %>">
2
+ <%= body %>
3
+ </div>
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Avo::RowComponent < ViewComponent::Base
4
+ attr_reader :classes
5
+
6
+ renders_one :body
7
+
8
+ def initialize(classes: nil, data: {})
9
+ @classes = classes
10
+ @data = data
11
+ end
12
+ end
data/config/master.key ADDED
@@ -0,0 +1 @@
1
+ 2aeb23d82b909d9c6b5abb62f7058c2a
@@ -26,6 +26,12 @@ module Avo
26
26
  items_holder.panel name, **args, &block
27
27
  end
28
28
 
29
+ def row(**args, &block)
30
+ ensure_items_holder_initialized
31
+
32
+ items_holder.row(**args, &block)
33
+ end
34
+
29
35
  def tabs(**args, &block)
30
36
  ensure_items_holder_initialized
31
37
 
@@ -35,6 +35,10 @@ module Avo
35
35
  def is_sidebar?
36
36
  self.class.item_type == :sidebar
37
37
  end
38
+
39
+ def is_row?
40
+ self.class.item_type == :row
41
+ end
38
42
  end
39
43
  end
40
44
  end
@@ -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
@@ -18,10 +18,6 @@ class Avo::Panel
18
18
  @items_holder = Avo::ItemsHolder.new
19
19
  end
20
20
 
21
- def add_item(item)
22
- @items << item
23
- end
24
-
25
21
  def has_items?
26
22
  @items.present?
27
23
  end
@@ -7,6 +7,7 @@ class Avo::PanelBuilder
7
7
 
8
8
  delegate :heading, to: :items_holder
9
9
  delegate :field, to: :items_holder
10
+ delegate :row, to: :items_holder
10
11
  delegate :items, to: :items_holder
11
12
 
12
13
  attr_reader :items_holder
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
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "2.34.6" unless const_defined?(:VERSION)
2
+ VERSION = "2.34.7.pre.1" unless const_defined?(:VERSION)
3
3
  end
@@ -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
- .flex-grow{
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.6
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-13 00:00:00.000000000 Z
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: '0'
1987
+ version: 1.3.1
1983
1988
  requirements: []
1984
1989
  rubygems_version: 3.3.3
1985
1990
  signing_key: