web47core 3.2.34 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a8a580a319f7241419d24577486e7e796ac0134c8151b98d2260396e0dfc5cd
4
- data.tar.gz: ef377aa5df9e45caeb2fafae5df80f52c5cbfab68240412d2a3b977e38aab9d8
3
+ metadata.gz: 507f1a54c183040f0556e3ab8bec5bffac4ffe69ad5bc5c61bc7af05e6fec2c7
4
+ data.tar.gz: 59d36d5dc86de4c074138842a81dbe3dad4c9365d872393e3f44872c62e39e46
5
5
  SHA512:
6
- metadata.gz: 51c047e2b49ffebc2a80ca6092bb5fa02bd8b973ef1c0aa831f9b9ddbbd1c25bc243a7797f3e63698e091fac1a68f935f6aec58bed87d09ee47e682144d491ba
7
- data.tar.gz: c89b1d1205608802af2af66537cc8b3a12b8b3e0e43bded3190b182e4af7badc35be7055794b50128af825377cf459d53222cb8f015f3e86e9da991d4f152b83
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-0 start-50 translate-middle-x mt-5') do
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(content_tag(:i, class: [toast_flash_icon(key), 'me-2', toast_flash_color(key)].join(' ')) {})
25
- concat(content_tag(:div, style: ['me-auto', 'fw-medium', toast_flash_color(key)].join(' ')) { key.humanize })
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.downcase
38
- when 'alert', 'error'
39
- 'text-danger'
40
- when 'warning'
41
- 'text-warning'
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
- 'ri-alert-fill'
58
+ 'alert-square-rounded'
53
59
  when 'warning'
54
- 'ri-error-warning-fill'
60
+ 'alert-triangle'
55
61
  else
56
- 'ri-information-fill'
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Web47core
4
- VERSION = '3.2.34'
4
+ VERSION = '3.2.35'
5
5
  end
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.34
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-03 00:00:00.000000000 Z
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