avo 4.0.15 → 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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/assets/builds/avo/application.css +5 -0
- data/app/assets/builds/avo/application.js +1 -1
- data/app/assets/builds/avo/application.js.map +2 -2
- data/app/assets/stylesheets/css/components/ui/card.css +10 -0
- data/app/components/avo/u_i/card_component.html.erb +1 -1
- data/app/components/avo/u_i/card_component.rb +3 -38
- data/app/javascript/js/global_hotkeys.js +10 -0
- data/lib/avo/resources/base.rb +6 -1
- data/lib/avo/version.rb +1 -1
- metadata +2 -2
|
@@ -35,6 +35,16 @@
|
|
|
35
35
|
@apply w-full;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
/* Padded variant. `.card__body` ships unpadded so wide content (tables,
|
|
39
|
+
scrollers) can sit flush to the card edge. Add `card--padded` to a card whose
|
|
40
|
+
body holds free-form content (custom tools, forms, prose) that should get the
|
|
41
|
+
standard card padding. Usage: `panel.with_card(class: "card--padded")`. */
|
|
42
|
+
.card--padded {
|
|
43
|
+
.card__body {
|
|
44
|
+
@apply p-4;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
38
48
|
/* Card wrapper */
|
|
39
49
|
.card__wrapper {
|
|
40
50
|
@apply flex flex-col items-start self-stretch w-full;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<%= tag.div class: class_names("card", @class), data: {**@data, item_index: @index} do %>
|
|
1
|
+
<%= tag.div class: class_names("card", @class, "card--padded" => @padded), data: {**@data, item_index: @index} do %>
|
|
2
2
|
<%= tag.div class: class_names("card__wrapper", @wrapper_class) do %>
|
|
3
3
|
<% if header? %>
|
|
4
4
|
<div class="card__header"><%= header %></div>
|
|
@@ -5,7 +5,9 @@ class Avo::UI::CardComponent < Avo::BaseComponent
|
|
|
5
5
|
prop :description
|
|
6
6
|
prop :class
|
|
7
7
|
prop :wrapper_class
|
|
8
|
-
|
|
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
|
|
@@ -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).
|
data/lib/avo/resources/base.rb
CHANGED
|
@@ -726,7 +726,12 @@ module Avo
|
|
|
726
726
|
end
|
|
727
727
|
|
|
728
728
|
def get_external_link
|
|
729
|
-
return
|
|
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
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: 4.0.
|
|
4
|
+
version: 4.0.16
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Adrian Marin
|
|
@@ -1198,7 +1198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
1198
1198
|
- !ruby/object:Gem::Version
|
|
1199
1199
|
version: '0'
|
|
1200
1200
|
requirements: []
|
|
1201
|
-
rubygems_version:
|
|
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: []
|