web47core 3.2.3.46 → 3.2.3.47
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/controllers/status_controller.rb +0 -1
- data/app/helpers/svg_icon_helper.rb +14 -34
- data/app/views/status/index.html.haml +2 -1
- data/lib/web47core/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fac443ea8a3048e4785964d2899475fd8ac9025610a8f654250a900831228d06
|
|
4
|
+
data.tar.gz: ad2d4ae7bf3120c6ea32c065a486f0c8c7c7533b228b2cdb3c9ea1933648fad2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d8ad5891e0a99c57d3a4d507c368adf58060d2ff3b85558dbef0be63f3ef67ed0971270ec5d7bf46f46a5cef06fccd70b2b157b8a8c27293746d3be961838c09
|
|
7
|
+
data.tar.gz: e9c1e1d9ade0fb0923f42199477d47692b83564c372a900217acefc8904291c1eefefd90f02a06284cc49a89a94899f29f5444b0bc71e9e953ea8ea44ae5b12c
|
|
@@ -3,25 +3,26 @@
|
|
|
3
3
|
module SvgIconHelper
|
|
4
4
|
# @abstract Render the appropriate icon based on the name and type
|
|
5
5
|
# @return [View]
|
|
6
|
-
def svg_icon(name, size: 24, type: :outline, classes: [], color: 'currentColor', stroke_width: 2
|
|
6
|
+
def svg_icon(name, size: 24, type: :outline, classes: [], color: 'currentColor', stroke_width: 2)
|
|
7
7
|
return if name.blank?
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
return fetch_svg_icon(name, size: size, type: type, classes: classes, color: color, stroke_width: stroke_width,
|
|
11
|
-
cached: false)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
key = ['svg_icon', name, size.to_s, type.to_s, classes.to_s, color, stroke_width.to_s].join(':')
|
|
15
|
-
Rails.cache.fetch(key, expires_in: 15.minutes) do
|
|
16
|
-
fetch_svg_icon(name, size: size, type: type, classes: classes, color: color, stroke_width: stroke_width)
|
|
17
|
-
end
|
|
9
|
+
fetch_svg_icon(name, size: size, type: type, classes: classes, color: color, stroke_width: stroke_width)
|
|
18
10
|
end
|
|
19
11
|
|
|
20
|
-
def fetch_svg_icon(name, size: 24, type: :outline, classes: [], color: 'currentColor', stroke_width: 2
|
|
12
|
+
def fetch_svg_icon(name, size: 24, type: :outline, classes: [], color: 'currentColor', stroke_width: 2)
|
|
21
13
|
return if name.blank?
|
|
22
14
|
|
|
23
15
|
classes = classes.compact.flatten.join(' ')
|
|
24
|
-
|
|
16
|
+
preferred_path = if I18n.exists?("nav.icons.#{name}")
|
|
17
|
+
"icons/#{I18n.t("nav.icons.#{name}")}"
|
|
18
|
+
else
|
|
19
|
+
"icons/#{type}/#{name}"
|
|
20
|
+
end
|
|
21
|
+
outline_path = "icons/outline/#{name}"
|
|
22
|
+
filled_path = "icons/filled/#{name}"
|
|
23
|
+
(partial, stroke) = [preferred_path, outline_path, filled_path].collect do |path|
|
|
24
|
+
[preferred_path, color] if lookup_context.exists?(path, [], true)
|
|
25
|
+
end.compact.first
|
|
25
26
|
if partial.blank?
|
|
26
27
|
partial = 'icons/outline/bug'
|
|
27
28
|
stroke = 'red'
|
|
@@ -34,15 +35,13 @@ module SvgIconHelper
|
|
|
34
35
|
class: classes,
|
|
35
36
|
fill: 'none',
|
|
36
37
|
stroke: stroke,
|
|
37
|
-
style: "color: #{stroke}",
|
|
38
38
|
'stroke-width': stroke_width,
|
|
39
39
|
'stroke-linecap': 'round',
|
|
40
40
|
'stroke-linejoin': 'round',
|
|
41
41
|
title: name) do
|
|
42
42
|
render partial
|
|
43
43
|
end
|
|
44
|
-
rescue StandardError
|
|
45
|
-
puts "Error: #{error}"
|
|
44
|
+
rescue StandardError
|
|
46
45
|
tag.svg(xmlns: 'http://www.w3.org/2000/svg',
|
|
47
46
|
viewBox: '0 0 24 24',
|
|
48
47
|
width: size,
|
|
@@ -58,23 +57,4 @@ module SvgIconHelper
|
|
|
58
57
|
render 'icons/outline/bug'
|
|
59
58
|
end
|
|
60
59
|
end
|
|
61
|
-
|
|
62
|
-
def icon_partial(name, type, color, cached:)
|
|
63
|
-
lookup = lambda do
|
|
64
|
-
preferred_path = if I18n.exists?("nav.icons.#{name}")
|
|
65
|
-
"icons/#{I18n.t("nav.icons.#{name}")}"
|
|
66
|
-
else
|
|
67
|
-
"icons/#{type}/#{name}"
|
|
68
|
-
end
|
|
69
|
-
outline_path = "icons/outline/#{name}"
|
|
70
|
-
filled_path = "icons/filled/#{name}"
|
|
71
|
-
|
|
72
|
-
[preferred_path, outline_path, filled_path].collect do |path|
|
|
73
|
-
[preferred_path, color] if lookup_context.exists?(path, [], true)
|
|
74
|
-
end.compact.first
|
|
75
|
-
end
|
|
76
|
-
return lookup.call unless cached
|
|
77
|
-
|
|
78
|
-
Rails.cache.fetch("icon_partial_path:#{name}:#{type}", expires_in: 15.minutes, &lookup)
|
|
79
|
-
end
|
|
80
60
|
end
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
%td
|
|
32
32
|
%h4.flow-text=key.to_s.titleize
|
|
33
33
|
%td.center
|
|
34
|
-
|
|
34
|
+
%svg{xmlns: 'http://www.w3.org/2000/svg', viewBox: '0 0 24 24', width: 32, height: 32, fill: 'none', stroke: value[:icon_color].to_s, style: "color: #{value[:icon_color]}", 'stroke-width': 2, 'stroke-linecap': 'round', 'stroke-linejoin': 'round', title: value[:icon_name]}
|
|
35
|
+
= render "icons/outline/#{value[:icon_name]}"
|
|
35
36
|
%td.center.hide-on-small-only
|
|
36
37
|
%h4.flow-text.large=value[:message]
|
data/lib/web47core/version.rb
CHANGED