avo 3.8.1 → 3.9.1

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: '019aaa47e84e641365ed6c8521f69d08a0622ef63b3002561969b87f82cf111b'
4
- data.tar.gz: 7f0da623f9123dcf90da0642beb1e38c6929ec922aedc1e0da1be0269ab184db
3
+ metadata.gz: d4c5cd48def43883f580f6f706ebbbe8e95cf0359fdae63d993cd5826db00f63
4
+ data.tar.gz: 1507d01056a46a72dbefccdc28411f22128c10fba79eb8bea4e1e2d135c0e1c6
5
5
  SHA512:
6
- metadata.gz: bd6683d2defbd373095a57e7691877cdd9ae8e641e4fd69c537055d3b17d05c3f93dd20439b615744766697851a6d4690de22c5ef5e97e619009fd5e97085194
7
- data.tar.gz: 0a59601b79844826c0fc68ddb01ff6c239f0d34af049fbeffbcd0e8a76962ae0fd37bd10176903deac5f22d2b6db10c25b71e8ba7e1e6bf6d03fe4f2fa4c965a
6
+ metadata.gz: f44f3fd3c26fd02831d71f338f2b5ba31965e9668757b05e59f767e961e50b205d6f350db539167b148ed80654a5dc2d80fd730352322a91df903eb0fe497f55
7
+ data.tar.gz: 6ab04f251889f41f121d111a1569586ca0b841c6b055f2879bf4e326d39850b69ccbe1e9c5a48cbd16899ed3d14d69ec07ea6b9d7065d205cfdee038240d2af6
data/Gemfile.lock CHANGED
@@ -114,7 +114,7 @@ GIT
114
114
  PATH
115
115
  remote: .
116
116
  specs:
117
- avo (3.8.1)
117
+ avo (3.9.1)
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
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "3.8.1" unless const_defined?(:VERSION)
2
+ VERSION = "3.9.1" 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.
@@ -8637,6 +8637,10 @@ tag.tagify__tag{
8637
8637
  border-width:1px
8638
8638
  }
8639
8639
 
8640
+ .\!border-b-2{
8641
+ border-bottom-width:2px !important
8642
+ }
8643
+
8640
8644
  .border-b{
8641
8645
  border-bottom-width:1px
8642
8646
  }
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.1
4
+ version: 3.9.1
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