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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5cb60aaf9b363d9d95a53e02cd2875e60b79f26344d64e08f6ba2ab8dce88e28
4
- data.tar.gz: 383b9f556359a6578d06ea3b319c0382016e6638d2c914da04684d34a7c9d933
3
+ metadata.gz: fac443ea8a3048e4785964d2899475fd8ac9025610a8f654250a900831228d06
4
+ data.tar.gz: ad2d4ae7bf3120c6ea32c065a486f0c8c7c7533b228b2cdb3c9ea1933648fad2
5
5
  SHA512:
6
- metadata.gz: 670ea6d949445923fe1a9ec0f0a9b27d48a9ad6a73ac5dd3050088e1adc13fc9393f7d67991826db3587a864319b112700c8bfd2fa761bcf47437c17c63810ff
7
- data.tar.gz: 4565290e61d30d10a39be0584e7b6fe200fe76edfbf769f42e6e0c4af3544218a4be89b7049d6fe4d66237cca637f09e27511b184ef1827baa00d6abfa0fd5e7
6
+ metadata.gz: d8ad5891e0a99c57d3a4d507c368adf58060d2ff3b85558dbef0be63f3ef67ed0971270ec5d7bf46f46a5cef06fccd70b2b157b8a8c27293746d3be961838c09
7
+ data.tar.gz: e9c1e1d9ade0fb0923f42199477d47692b83564c372a900217acefc8904291c1eefefd90f02a06284cc49a89a94899f29f5444b0bc71e9e953ea8ea44ae5b12c
@@ -4,7 +4,6 @@
4
4
  # Return the status of the server
5
5
  #
6
6
  class StatusController < ActionController::Base
7
- helper SvgIconHelper
8
7
  protect_from_forgery with: :exception
9
8
  #
10
9
  # Main (and only) page
@@ -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, cached: true)
6
+ def svg_icon(name, size: 24, type: :outline, classes: [], color: 'currentColor', stroke_width: 2)
7
7
  return if name.blank?
8
8
 
9
- unless cached
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, cached: true)
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
- partial, stroke = icon_partial(name, type, color, cached: cached)
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 => error
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
- = svg_icon(value[:icon_name], size: 32, color: value[:icon_color], cached: false)
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]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Web47core
4
- VERSION = '3.2.3.46'
4
+ VERSION = '3.2.3.47'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web47core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.3.46
4
+ version: 3.2.3.47
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Schroeder