avo 4.0.14 → 4.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,9 @@ class Avo::UI::CardComponent < Avo::BaseComponent
5
5
  prop :description
6
6
  prop :class
7
7
  prop :wrapper_class
8
- prop :with_padding, default: -> { true }
8
+ # Opt-in body padding via the `.card--padded` modifier. Defaults to false so
9
+ # cards holding wide content (index tables, scrollers) stay flush to the edge.
10
+ prop :padded, default: -> { false }
9
11
  prop :variant, default: -> { :default }
10
12
  prop :options, kind: :**
11
13
  prop :data, default: -> { {}.freeze }
@@ -25,41 +27,4 @@ class Avo::UI::CardComponent < Avo::BaseComponent
25
27
  end
26
28
  end
27
29
  end
28
-
29
- private
30
-
31
- # def panel_classes
32
- # base_classes = "panel"
33
- # variant_classes = case variant
34
- # when :compact
35
- # "panel--compact"
36
- # when :full_width
37
- # "panel--full-width"
38
- # else
39
- # "panel--default"
40
- # end
41
- # padding_classes = with_padding ? "panel--with-padding" : ""
42
-
43
- # [base_classes, variant_classes, padding_classes].compact.join(" ")
44
- # end
45
-
46
- # def compact?
47
- # variant == :compact
48
- # end
49
-
50
- # def full_width?
51
- # variant == :full_width
52
- # end
53
-
54
- # def with_padding?
55
- # with_padding
56
- # end
57
-
58
- # def header_classes
59
- # "panel__header"
60
- # end
61
-
62
- # def body_classes
63
- # "panel__body"
64
- # end
65
30
  end
@@ -17,8 +17,8 @@ export default class extends Controller {
17
17
  anchor = null
18
18
 
19
19
  mouseEntered(event) {
20
- const row = event.target.closest('tr')
21
- const url = row.dataset.visitPath
20
+ const row = event.target.closest('[data-visit-path]')
21
+ const url = row?.dataset?.visitPath
22
22
 
23
23
  if (url) {
24
24
  this.anchor = this.createAnchor(url)
@@ -64,14 +64,14 @@ export default class extends Controller {
64
64
  return // Don't navigate if a link or button is clicked
65
65
  }
66
66
 
67
- const row = event.target.closest('tr')
68
- const url = row.dataset.visitPath
67
+ const row = event.target.closest('[data-visit-path]')
68
+ const url = row?.dataset?.visitPath
69
69
 
70
70
  if (!row || !url) {
71
71
  return
72
72
  }
73
73
 
74
- if (event.metaKey || event.ctrlKey) {
74
+ if (event.metaKey || event.ctrlKey || row.dataset.visitTarget === '_blank') {
75
75
  this.#visitInNewTab(url)
76
76
  } else {
77
77
  this.#visitInSameTab(url)
@@ -164,6 +164,16 @@ const TYPING_SELECTOR = 'input, textarea, select, [contenteditable]'
164
164
  // so it never reaches a document-level listener. Must be registered on each element.
165
165
  function hotkeyFireHandler(event) {
166
166
  const el = event.currentTarget
167
+
168
+ // Stale element left behind after a Turbo body replacement (e.g. clicking a
169
+ // broken resource renders Rails' error page). @github/hotkey keeps its
170
+ // reference, so without this guard pressing "p" would .click() the detached
171
+ // sidebar link and navigate. Cancel so hotkeys are inert on non-Avo pages.
172
+ if (!el.isConnected) {
173
+ event.preventDefault()
174
+ return
175
+ }
176
+
167
177
  const hotkey = el.getAttribute('data-hotkey')
168
178
 
169
179
  // Apply feedback to ALL elements sharing this hotkey (e.g. desktop + mobile sidebar).
@@ -51,6 +51,7 @@ module Avo
51
51
  attr_accessor :resource_parent_controller
52
52
  attr_accessor :default_url_options
53
53
  attr_accessor :click_row_to_view_record
54
+ attr_accessor :density
54
55
  attr_accessor :alert_dismiss_time
55
56
  attr_accessor :is_admin_method
56
57
  attr_accessor :is_developer_method
@@ -182,6 +183,7 @@ module Avo
182
183
  @default_url_options = []
183
184
  @pagination = {}
184
185
  @click_row_to_view_record = true
186
+ @density = :normal
185
187
  @alert_dismiss_time = 5000
186
188
  @is_admin_method = :is_admin?
187
189
  @is_developer_method = :is_developer?
@@ -726,7 +726,12 @@ module Avo
726
726
  end
727
727
 
728
728
  def get_external_link
729
- return unless record&.persisted?
729
+ return if record.nil?
730
+ # Skip only on the "create" form views where there's no saved record to
731
+ # link to yet. Avoid `record.persisted?` here: non-ActiveRecord records
732
+ # (e.g. API-backed resources) report `persisted? => false` and would
733
+ # never render an external link.
734
+ return if view&.new? || view&.create?
730
735
 
731
736
  Avo::ExecutionContext.new(target: external_link, resource: self, record: record).handle
732
737
  end
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "4.0.14" unless const_defined?(:VERSION)
2
+ VERSION = "4.0.16" unless const_defined?(:VERSION)
3
3
  end
@@ -118,6 +118,7 @@ Avo.configure do |config|
118
118
 
119
119
  ## == Customization ==
120
120
  config.click_row_to_view_record = true
121
+ # config.density = :normal # :tight, :normal, :relaxed
121
122
  # config.app_name = 'Avocadelicious'
122
123
  # config.timezone = 'UTC'
123
124
  # config.currency = 'USD'
metadata CHANGED
@@ -1,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avo
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.14
4
+ version: 4.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Marin
8
8
  - Mihai Marin
9
9
  - Paul Bob
10
- autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2026-07-21 00:00:00.000000000 Z
12
+ date: 1980-01-02 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: activerecord
@@ -225,6 +224,8 @@ files:
225
224
  - app/assets/builds/avo/application.css
226
225
  - app/assets/builds/avo/application.js
227
226
  - app/assets/builds/avo/application.js.map
227
+ - app/assets/builds/avo/avo.custom.js
228
+ - app/assets/builds/avo/avo.custom.js.map
228
229
  - app/assets/builds/avo/dependencies.css
229
230
  - app/assets/builds/avo/late-registration.js
230
231
  - app/assets/builds/avo/late-registration.js.map
@@ -1197,8 +1198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1197
1198
  - !ruby/object:Gem::Version
1198
1199
  version: '0'
1199
1200
  requirements: []
1200
- rubygems_version: 3.5.22
1201
- signing_key:
1201
+ rubygems_version: 3.6.9
1202
1202
  specification_version: 4
1203
1203
  summary: Admin panel framework and Content Management System for Ruby on Rails.
1204
1204
  test_files: []