web47core 3.2.33 → 3.2.35
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/lib/web47core/version.rb +1 -1
- metadata +3 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 507f1a54c183040f0556e3ab8bec5bffac4ffe69ad5bc5c61bc7af05e6fec2c7
|
4
|
+
data.tar.gz: 59d36d5dc86de4c074138842a81dbe3dad4c9365d872393e3f44872c62e39e46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df0c33fc82e216700b19c47a52541c2d51c257ca9f59d59cf9870bfd55882bd31d2480a0a2f77b9ba58bd07bb1a9479d0096335cedc31e54ca7cef17dbf9e9be
|
7
|
+
data.tar.gz: 5f0f90d0b998d31e3b47a4a817eb896caf00a8e5286f36470ca51dd5fa7315eaaeabd958a25d0387252aae4ec412b609a3ee21e000400438e43158726c5613ad
|
@@ -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
|
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.35
|
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
|
@@ -136,20 +136,6 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: materialize-sass
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - ">="
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
146
|
-
type: :runtime
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - ">="
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
153
139
|
- !ruby/object:Gem::Dependency
|
154
140
|
name: mongoid
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -192,20 +178,6 @@ dependencies:
|
|
192
178
|
- - ">="
|
193
179
|
- !ruby/object:Gem::Version
|
194
180
|
version: '0'
|
195
|
-
- !ruby/object:Gem::Dependency
|
196
|
-
name: sass
|
197
|
-
requirement: !ruby/object:Gem::Requirement
|
198
|
-
requirements:
|
199
|
-
- - ">="
|
200
|
-
- !ruby/object:Gem::Version
|
201
|
-
version: '0'
|
202
|
-
type: :runtime
|
203
|
-
prerelease: false
|
204
|
-
version_requirements: !ruby/object:Gem::Requirement
|
205
|
-
requirements:
|
206
|
-
- - ">="
|
207
|
-
- !ruby/object:Gem::Version
|
208
|
-
version: '0'
|
209
181
|
- !ruby/object:Gem::Dependency
|
210
182
|
name: twilio-ruby
|
211
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -430,20 +402,6 @@ dependencies:
|
|
430
402
|
- - ">="
|
431
403
|
- !ruby/object:Gem::Version
|
432
404
|
version: '0'
|
433
|
-
- !ruby/object:Gem::Dependency
|
434
|
-
name: sass-rails
|
435
|
-
requirement: !ruby/object:Gem::Requirement
|
436
|
-
requirements:
|
437
|
-
- - ">="
|
438
|
-
- !ruby/object:Gem::Version
|
439
|
-
version: '0'
|
440
|
-
type: :development
|
441
|
-
prerelease: false
|
442
|
-
version_requirements: !ruby/object:Gem::Requirement
|
443
|
-
requirements:
|
444
|
-
- - ">="
|
445
|
-
- !ruby/object:Gem::Version
|
446
|
-
version: '0'
|
447
405
|
- !ruby/object:Gem::Dependency
|
448
406
|
name: shoulda
|
449
407
|
requirement: !ruby/object:Gem::Requirement
|
@@ -583,6 +541,7 @@ files:
|
|
583
541
|
- app/helpers/core_sso_servers_helper.rb
|
584
542
|
- app/helpers/core_table_helper.rb
|
585
543
|
- app/helpers/model_modal_helper.rb
|
544
|
+
- app/helpers/svg_icon_helper.rb
|
586
545
|
- app/views/common/_create_actions.html.haml
|
587
546
|
- app/views/common/_flash.html.haml
|
588
547
|
- app/views/common/_form_actions.html.haml
|