web47core 3.2.34 → 3.2.36
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/app/helpers/core_flash_toast_helper.rb +22 -16
- data/app/helpers/svg_icon_helper.rb +51 -0
- data/app/views/icons/_check.html.erb +1 -0
- data/lib/web47core/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51addb55203d5e9bca94ca014394dc522b41ef51c1dabb32e2b1fa294f1aa1b8
|
4
|
+
data.tar.gz: 341d01b151ce0c08ee6409c434a37f292dd424c8bcea2647f0434bf7e52cdb3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3278e6e57ed98a3e54910cb10676844554e8e418397a991193342b09c5500a6bc6915cae2f11a5d616f4699ceeb18f35c0bbfba0400342a577cbb23d5dbd035
|
7
|
+
data.tar.gz: 73694c5acd82fbd7879289fe536be74cef0024073ae3f182333ec97323907dc0c040f44b1df16eea53c5908473cae84ada2cc10af6fc97b6a12ef76d2bfc1e49
|
@@ -2,18 +2,28 @@
|
|
2
2
|
|
3
3
|
# Helper methods for rendering the flash information received from the server and displaying it as toast messages
|
4
4
|
module CoreFlashToastHelper
|
5
|
+
def flash_color(key)
|
6
|
+
case key.to_sym
|
7
|
+
when :notice then 'text-success'
|
8
|
+
when :alert then 'text-danger'
|
9
|
+
when :error then 'text-danger'
|
10
|
+
when :warning then 'text-warning'
|
11
|
+
else 'text-info'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
5
15
|
# @abstract render the whole toast container if there are toast messages to render
|
6
16
|
# @return HTML - To render in the page
|
7
17
|
def toast_container
|
8
18
|
return if flash.blank?
|
9
19
|
|
10
|
-
content_tag(:div, class: 'toast-container position-fixed top-
|
20
|
+
content_tag(:div, class: 'toast-container position-fixed top-25 start-50 translate-middle-x mt-5') do
|
11
21
|
flash.each { |key, value| concat(toast_flash_message(key, value)) unless 'timedout'.eql?(key) }
|
12
22
|
end
|
13
23
|
end
|
14
24
|
|
15
25
|
def toast_flash_message(key, value)
|
16
|
-
content_tag(:div, class: 'toast', role: :alert, aria: { live: :assertive, atomic: true }) do
|
26
|
+
content_tag(:div, class: 'toast hide', role: :alert, aria: { live: :assertive, atomic: true }) do
|
17
27
|
concat(toast_flash_header(key))
|
18
28
|
concat(content_tag(:div, class: 'toast-body') { value })
|
19
29
|
end
|
@@ -21,8 +31,8 @@ module CoreFlashToastHelper
|
|
21
31
|
|
22
32
|
def toast_flash_header(key)
|
23
33
|
content_tag(:div, class: 'toast-header') do
|
24
|
-
concat(
|
25
|
-
concat(content_tag(:div,
|
34
|
+
concat(svg_icon(toast_flash_icon(key), classes: [toast_flash_color(key), 'me-2'].join(' '), size: 24))
|
35
|
+
concat(content_tag(:div, class: ['me-auto', 'fw-medium', toast_flash_color(key)].join(' ')) { key.humanize })
|
26
36
|
concat(tag(:button,
|
27
37
|
class: 'btn-close',
|
28
38
|
type: :button,
|
@@ -31,16 +41,12 @@ module CoreFlashToastHelper
|
|
31
41
|
end
|
32
42
|
end
|
33
43
|
|
34
|
-
# @abstract map the flash key to an icon
|
35
|
-
# @return String - name of the icon to render
|
36
44
|
def toast_flash_color(key)
|
37
|
-
case key.
|
38
|
-
when
|
39
|
-
|
40
|
-
when 'warning'
|
41
|
-
|
42
|
-
else
|
43
|
-
'text-info'
|
45
|
+
case key.to_sym
|
46
|
+
when :notice then 'text-success'
|
47
|
+
when :alert, :error then 'text-danger'
|
48
|
+
when :warning then 'text-warning'
|
49
|
+
else 'text-info'
|
44
50
|
end
|
45
51
|
end
|
46
52
|
|
@@ -49,11 +55,11 @@ module CoreFlashToastHelper
|
|
49
55
|
def toast_flash_icon(key)
|
50
56
|
case key
|
51
57
|
when 'alert', 'error'
|
52
|
-
'
|
58
|
+
'alert-square-rounded'
|
53
59
|
when 'warning'
|
54
|
-
'
|
60
|
+
'alert-triangle'
|
55
61
|
else
|
56
|
-
'
|
62
|
+
'info-circle'
|
57
63
|
end
|
58
64
|
end
|
59
65
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# app/helpers/svg_icon_helper.rb
|
2
|
+
module SvgIconHelper
|
3
|
+
# @abstract Render the appropriate icon based on the name and type
|
4
|
+
# @return [View]
|
5
|
+
def svg_icon(name, size: 24, type: :outline, classes: [], color: 'currentColor')
|
6
|
+
classes = ['icon', classes].compact.flatten.join(' ')
|
7
|
+
key = "icon_partial_path:#{name}:#{type}"
|
8
|
+
(partial, stroke) = Rails.cache.fetch(key, expires_in: 1.hour) do
|
9
|
+
path_with_type = "icons/#{name}-#{type}"
|
10
|
+
path_without_type = "icons/#{name}"
|
11
|
+
|
12
|
+
if I18n.exists?("nav.icons.#{name}")
|
13
|
+
[['icons', I18n.t("nav.icons.#{name}")].join('/'), color]
|
14
|
+
elsif lookup_context.exists?(path_with_type, [], true)
|
15
|
+
[path_with_type, color]
|
16
|
+
elsif lookup_context.exists?(path_without_type, [], true)
|
17
|
+
[path_without_type, color]
|
18
|
+
else
|
19
|
+
%w(icons/bug-outline red)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
tag.svg(xmlns: "http://www.w3.org/2000/svg",
|
24
|
+
viewBox: "0 0 24 24",
|
25
|
+
width: size,
|
26
|
+
height: size,
|
27
|
+
class: classes,
|
28
|
+
fill: 'none',
|
29
|
+
stroke: stroke,
|
30
|
+
stroke_width: 1,
|
31
|
+
stroke_linecap: 'round',
|
32
|
+
stroke_linejoin: 'round') do
|
33
|
+
render partial
|
34
|
+
end
|
35
|
+
rescue StandardError
|
36
|
+
tag.svg(xmlns: "http://www.w3.org/2000/svg",
|
37
|
+
viewBox: "0 0 24 24",
|
38
|
+
width: size,
|
39
|
+
height: size,
|
40
|
+
class: classes,
|
41
|
+
fill: 'none',
|
42
|
+
stroke: 'red',
|
43
|
+
stroke_width: 1,
|
44
|
+
stroke_linecap: 'round',
|
45
|
+
stroke_linejoin: 'round',
|
46
|
+
data: { bs_toggle: :tooltip },
|
47
|
+
title: "#{name}-#{type}") do
|
48
|
+
render 'icons/bug-outline'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<path d="M5 12l5 5l10 -10" />
|
data/lib/web47core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web47core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.36
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Schroeder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-08-
|
11
|
+
date: 2025-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -541,6 +541,7 @@ files:
|
|
541
541
|
- app/helpers/core_sso_servers_helper.rb
|
542
542
|
- app/helpers/core_table_helper.rb
|
543
543
|
- app/helpers/model_modal_helper.rb
|
544
|
+
- app/helpers/svg_icon_helper.rb
|
544
545
|
- app/views/common/_create_actions.html.haml
|
545
546
|
- app/views/common/_flash.html.haml
|
546
547
|
- app/views/common/_form_actions.html.haml
|
@@ -552,6 +553,7 @@ files:
|
|
552
553
|
- app/views/delayed_job_workers/index.html.haml
|
553
554
|
- app/views/delayed_jobs/index.html.haml
|
554
555
|
- app/views/delayed_jobs/show.html.haml
|
556
|
+
- app/views/icons/_check.html.erb
|
555
557
|
- app/views/status/index.html.haml
|
556
558
|
- app/views/system_configurations/edit.html.haml
|
557
559
|
- app/views/system_configurations/show.html.haml
|