avo 2.40.0 → 2.41.0
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/components/avo/fields/common/badge_viewer_component.html.erb +1 -25
- data/app/components/avo/fields/common/badge_viewer_component.rb +24 -0
- data/app/controllers/avo/search_controller.rb +2 -2
- data/lib/avo/fields/badge_field.rb +1 -1
- data/lib/avo/version.rb +1 -1
- data/public/avo-assets/avo.base.css +0 -14
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 51cdcebc4079db0bc531fbec4a0e9d3872a7270bd7f2e0f1b5e88111af6b9700
|
|
4
|
+
data.tar.gz: e0520aa64343da6381a016b0b08b471a6b37389e42a8d01f7676f237d37b7525
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a1b077a1cac9372943eec04cc718c6f7a0eabbdd457cf38c5355cbefd3ea3d9908a4713322ad9d24c1ea5a6bcfab509647a3b7f979d3de000ce6dd24e2427f21
|
|
7
|
+
data.tar.gz: 73aae293a9b3e50178e15fe9e4a2d131928704e64c70822183ac974eefd5efc8209a5862ec61d33d08e76e0f56c7d29f8e16d5376730ba3a819352b72e165455
|
data/Gemfile.lock
CHANGED
|
@@ -1,25 +1 @@
|
|
|
1
|
-
|
|
2
|
-
backgrounds = {
|
|
3
|
-
info: 'bg-blue-500',
|
|
4
|
-
success: 'bg-green-500',
|
|
5
|
-
danger: 'bg-red-500',
|
|
6
|
-
warning: 'bg-yellow-500',
|
|
7
|
-
secondary: 'bg-gray-500',
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
label = @value
|
|
11
|
-
background = :info
|
|
12
|
-
|
|
13
|
-
@options.invert.each do |values, type|
|
|
14
|
-
if [values].flatten.map { |value| value }.include? @value
|
|
15
|
-
label = @value
|
|
16
|
-
background = type.to_sym
|
|
17
|
-
next
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
classes = 'whitespace-nowrap rounded-md uppercase px-2 py-1 text-xs font-bold block text-center truncate '
|
|
22
|
-
|
|
23
|
-
classes += "#{backgrounds[background]} text-white" if backgrounds[background].present?
|
|
24
|
-
%>
|
|
25
|
-
<span class="<%= classes %>" style="max-width: 120px;"><%= label %></span>
|
|
1
|
+
<span class="<%= classes %>" style="max-width: 120px;"><%= @value %></span>
|
|
@@ -4,5 +4,29 @@ class Avo::Fields::Common::BadgeViewerComponent < ViewComponent::Base
|
|
|
4
4
|
def initialize(value:, options:)
|
|
5
5
|
@value = value
|
|
6
6
|
@options = options
|
|
7
|
+
@backgrounds = {
|
|
8
|
+
info: "bg-blue-500",
|
|
9
|
+
success: "bg-green-500",
|
|
10
|
+
danger: "bg-red-500",
|
|
11
|
+
warning: "bg-yellow-500",
|
|
12
|
+
neutral: "bg-gray-500"
|
|
13
|
+
}
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def classes
|
|
17
|
+
background = :info
|
|
18
|
+
|
|
19
|
+
@options.invert.each do |values, type|
|
|
20
|
+
if [values].flatten.map { |value| value }.include? @value
|
|
21
|
+
background = type.to_sym
|
|
22
|
+
next
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
classes = "whitespace-nowrap rounded-md uppercase px-2 py-1 text-xs font-bold block text-center truncate "
|
|
27
|
+
|
|
28
|
+
classes += "#{@backgrounds[background]} text-white" if @backgrounds[background].present?
|
|
29
|
+
|
|
30
|
+
classes
|
|
7
31
|
end
|
|
8
32
|
end
|
|
@@ -51,14 +51,14 @@ module Avo
|
|
|
51
51
|
scope: resource.class.scope
|
|
52
52
|
).handle
|
|
53
53
|
|
|
54
|
+
query = apply_scope(query) if should_apply_any_scope?
|
|
55
|
+
|
|
54
56
|
# Get the count
|
|
55
57
|
results_count = query.reselect(resource.model_class.primary_key).count
|
|
56
58
|
|
|
57
59
|
# Get the results
|
|
58
60
|
query = query.limit(8)
|
|
59
61
|
|
|
60
|
-
query = apply_scope(query) if should_apply_any_scope?
|
|
61
|
-
|
|
62
62
|
results = apply_search_metadata(query, resource)
|
|
63
63
|
|
|
64
64
|
header = resource.plural_name
|
|
@@ -8,7 +8,7 @@ module Avo
|
|
|
8
8
|
|
|
9
9
|
hide_on [:edit, :new]
|
|
10
10
|
|
|
11
|
-
default_options = {info: :info, success: :success, danger: :danger, warning: :warning,
|
|
11
|
+
default_options = {info: :info, success: :success, danger: :danger, warning: :warning, neutral: :neutral}
|
|
12
12
|
@options = args[:options].present? ? default_options.merge(args[:options]) : default_options
|
|
13
13
|
end
|
|
14
14
|
end
|
data/lib/avo/version.rb
CHANGED
|
@@ -7997,10 +7997,6 @@ trix-toolbar .trix-button-group:not(:first-child){
|
|
|
7997
7997
|
text-transform:capitalize
|
|
7998
7998
|
}
|
|
7999
7999
|
|
|
8000
|
-
.italic{
|
|
8001
|
-
font-style:italic
|
|
8002
|
-
}
|
|
8003
|
-
|
|
8004
8000
|
.leading-6{
|
|
8005
8001
|
line-height:1.5rem
|
|
8006
8002
|
}
|
|
@@ -8199,16 +8195,6 @@ trix-toolbar .trix-button-group:not(:first-child){
|
|
|
8199
8195
|
color:rgb(22 163 74 / var(--tw-text-opacity))
|
|
8200
8196
|
}
|
|
8201
8197
|
|
|
8202
|
-
.\!text-pink-600{
|
|
8203
|
-
--tw-text-opacity:1 !important;
|
|
8204
|
-
color:rgb(219 39 119 / var(--tw-text-opacity)) !important
|
|
8205
|
-
}
|
|
8206
|
-
|
|
8207
|
-
.underline{
|
|
8208
|
-
-webkit-text-decoration-line:underline;
|
|
8209
|
-
text-decoration-line:underline
|
|
8210
|
-
}
|
|
8211
|
-
|
|
8212
8198
|
.no-underline{
|
|
8213
8199
|
-webkit-text-decoration-line:none;
|
|
8214
8200
|
text-decoration-line:none
|
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.
|
|
4
|
+
version: 2.41.0
|
|
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-
|
|
12
|
+
date: 2023-09-12 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activerecord
|