avo 3.8.0 → 3.9.0

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: 3dc081b0ba799bf6d4a6aa3a1125bb71508b3a5dc719968f6063b7ff1b643df5
4
- data.tar.gz: 5fc75809b522b6ead75eb82516ad2ab75efa56a09608bb77676d6d17f2bf703c
3
+ metadata.gz: b549ce14ee4f91492b5a4c8c51e4c1a280bc834d3c787a7018d7b9a16c30a376
4
+ data.tar.gz: 26957d4d96f81d6194bb43a1fc0ff40bcbf3f38c69624fdd2dbe81e77e2c4a2c
5
5
  SHA512:
6
- metadata.gz: bb36eb6b4f34dd8260407159f7f56d1af4ae45b73f2d46ceb2e9f53c97d91756bb0767926f5ea737b2edad51a45c586d20f270ac60482dafea5e9e394b34bd62
7
- data.tar.gz: dec621b0241d0dccb1aed0b83cedee280927148edaeb27c38cf31234ad551915b069606e11995dff36643983cd957ea7ce8485f4dd64bd16ce8f57d29168d55d
6
+ metadata.gz: 676100b03573860af0ee7e54adcf9f83ed18be336a20504a60dccb820962f28cdbe8ed17062dc766300d494afe059b86374e26df8cb50908728f1ad18af6d61e
7
+ data.tar.gz: 4a5379cabd1e163224d722d2a327f58b5be4b3a3bfc6ee652d2ef9981c4f3c24826df8ec45a3a2a95456ead995a6a020a0b7b3c8408861341bde43862b4ff9d4
data/Gemfile.lock CHANGED
@@ -114,7 +114,7 @@ GIT
114
114
  PATH
115
115
  remote: .
116
116
  specs:
117
- avo (3.8.0)
117
+ avo (3.9.0)
118
118
  actionview (>= 6.1)
119
119
  active_link_to
120
120
  activerecord (>= 6.1)
@@ -4,7 +4,7 @@ class Avo::ActionsComponent < ViewComponent::Base
4
4
  include Avo::ApplicationHelper
5
5
  attr_reader :label, :size, :as_row_control
6
6
 
7
- def initialize(actions: [], resource: nil, view: nil, exclude: [], include: [], style: :outline, color: :primary, label: nil, size: :md, as_row_control: false, icon: "heroicons/outline/arrow-down-circle")
7
+ def initialize(actions: [], resource: nil, view: nil, exclude: [], include: [], style: :outline, color: :primary, label: nil, size: :md, as_row_control: false, icon: nil)
8
8
  @actions = actions || []
9
9
  @resource = resource
10
10
  @view = view
@@ -86,15 +86,21 @@ class Avo::ActionsComponent < ViewComponent::Base
86
86
  end
87
87
 
88
88
  def render_item(action)
89
- if action.is_a?(Avo::DividerComponent)
90
- render Avo::DividerComponent.new
91
- else
89
+ case action
90
+ when Avo::Divider
91
+ render_divider(action)
92
+ when Avo::BaseAction
92
93
  render_action_link(action)
93
94
  end
94
95
  end
95
96
 
96
97
  private
97
98
 
99
+ def render_divider(action)
100
+ label = action.label.is_a?(Hash) ? action.label[:label] : nil
101
+ render Avo::DividerComponent.new(label)
102
+ end
103
+
98
104
  def render_action_link(action)
99
105
  link_to action_path(action),
100
106
  data: action_data_attributes(action),
@@ -1,5 +1,5 @@
1
1
  <div data-controller="alert"
2
- data-alert-dismiss-after-value="5000"
2
+ data-alert-dismiss-after-value="<%= Avo.configuration.alert_dismiss_time %>"
3
3
  data-alert-remove-delay-value="0"
4
4
  class="<%= classes %>"
5
5
  >
@@ -1,3 +1,7 @@
1
- <div class="relative col-span-full border-t border-gray-300 border-solid" style= "border-width: 1.75px;">
2
- <div class="absolute inset-auto -translate-y-1/2 -translate-x-1/2 ml-1/2 z-20 text-xs font-semibold uppercase leading-none text-gray-500 bg-application px-2"></div>
1
+ <div class="relative flex justify-center items-center w-full !border-b-2 border-gray-200 border-solid">
2
+ <div class="absolute inset-auto z-20 text-xs font-semibold uppercase leading-none text-gray-500 bg-white px-2">
3
+ <%if label.present?%>
4
+ <%=label%>
5
+ <%end%>
6
+ </div>
3
7
  </div>
@@ -1,6 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Avo::DividerComponent < ViewComponent::Base
4
- def initialize(**args)
4
+ attr_reader :label
5
+
6
+ def initialize(label = nil, **args)
7
+ @label = label
5
8
  end
6
9
  end
@@ -285,8 +285,8 @@ module Avo
285
285
  cards
286
286
  end
287
287
 
288
- def divider
289
- action DividerComponent
288
+ def divider(label = nil)
289
+ entity_loader(:action).use({class: Divider, label: label}.compact)
290
290
  end
291
291
 
292
292
  # def fields / def cards
@@ -49,6 +49,7 @@ module Avo
49
49
  attr_accessor :resource_parent_controller
50
50
  attr_accessor :mount_avo_engines
51
51
  attr_accessor :default_url_options
52
+ attr_accessor :alert_dismiss_time
52
53
 
53
54
  def initialize
54
55
  @root_path = "/avo"
@@ -105,6 +106,7 @@ module Avo
105
106
  @turbo = default_turbo
106
107
  @default_url_options = []
107
108
  @pagination = {}
109
+ @alert_dismiss_time = 5000
108
110
  end
109
111
 
110
112
  def current_user_method(&block)
@@ -0,0 +1,8 @@
1
+ class Avo::Divider < Avo::BaseAction
2
+ attr_reader :label, :view
3
+
4
+ def initialize(label: nil, view: nil, **kwargs)
5
+ @label = label
6
+ @view = view
7
+ end
8
+ end
@@ -2,6 +2,8 @@ module Avo
2
2
  module Resources
3
3
  module Controls
4
4
  class ActionsList < BaseControl
5
+ ACTIONS_LIST_DROPDOWN_ICON = "heroicons/outline/arrow-down-circle"
6
+
5
7
  attr_reader :color, :exclude, :include, :style, :icon
6
8
 
7
9
  def initialize(**args)
@@ -11,7 +13,7 @@ module Avo
11
13
  @exclude = args[:exclude] || []
12
14
  @include = args[:include] || []
13
15
  @style = args[:style] || :outline
14
- @icon = args[:icon]
16
+ @icon = args[:icon] || ACTIONS_LIST_DROPDOWN_ICON
15
17
  end
16
18
  end
17
19
  end
@@ -18,8 +18,9 @@ class Avo::SvgFinder
18
18
  Rails.root.join("app", "assets", "svgs", @filename).to_s,
19
19
  Rails.root.join(@filename).to_s,
20
20
  Avo::Engine.root.join("app", "assets", "svgs", @filename).to_s,
21
+ Avo::Engine.root.join("app", "assets", "svgs", "avo", @filename).to_s,
21
22
  Avo::Engine.root.join("app", "assets", "svgs", "heroicons", "outline", @filename).to_s,
22
- Avo::Engine.root.join(@filename).to_s,
23
+ Avo::Engine.root.join(@filename).to_s
23
24
  ]
24
25
 
25
26
  paths.find do |path|
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "3.8.0" unless const_defined?(:VERSION)
2
+ VERSION = "3.9.0" unless const_defined?(:VERSION)
3
3
  end
@@ -58,6 +58,9 @@ Avo.configure do |config|
58
58
  # }
59
59
  # end
60
60
 
61
+ ## == Response messages dismiss time ==
62
+ # config.alert_dismiss_time = 5000
63
+
61
64
  ## == Cache options ==
62
65
  ## Provide a lambda to customize the cache store used by Avo.
63
66
  ## We compute the cache store by default, this is NOT the default, just an example.
@@ -7354,6 +7354,10 @@ tag.tagify__tag{
7354
7354
  right:1rem
7355
7355
  }
7356
7356
 
7357
+ .right-\[0\.3rem\]{
7358
+ right:0.3rem
7359
+ }
7360
+
7357
7361
  .start-1{
7358
7362
  inset-inline-start:0.25rem
7359
7363
  }
@@ -8637,6 +8641,10 @@ tag.tagify__tag{
8637
8641
  border-width:1px
8638
8642
  }
8639
8643
 
8644
+ .\!border-b-2{
8645
+ border-bottom-width:2px !important
8646
+ }
8647
+
8640
8648
  .border-b{
8641
8649
  border-bottom-width:1px
8642
8650
  }
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.8.0
4
+ version: 3.9.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-06-04 00:00:00.000000000 Z
13
+ date: 2024-06-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
@@ -2202,6 +2202,7 @@ files:
2202
2202
  - lib/avo/configuration/branding.rb
2203
2203
  - lib/avo/configuration/resource_configuration.rb
2204
2204
  - lib/avo/current.rb
2205
+ - lib/avo/divider.rb
2205
2206
  - lib/avo/dsl/field_parser.rb
2206
2207
  - lib/avo/dynamic_router.rb
2207
2208
  - lib/avo/engine.rb