diff options
author | Marius Balteanu <marius.balteanu@zitec.com> | 2025-03-26 20:45:43 +0000 |
---|---|---|
committer | Marius Balteanu <marius.balteanu@zitec.com> | 2025-03-26 20:45:43 +0000 |
commit | f8292b56dfae14da2af7fe765f97015f1559e0fa (patch) | |
tree | fb9e823c1eaf55c4cad1bfaab25fe57b1bfa2397 | |
parent | f84ef7a6b4d27c025afcce47fc5bf10bbfd365af (diff) | |
download | redmine-f8292b56dfae14da2af7fe765f97015f1559e0fa.tar.gz redmine-f8292b56dfae14da2af7fe765f97015f1559e0fa.zip |
Replaces legacy icons in flash notices with SVG icons (#41952).
git-svn-id: https://svn.redmine.org/redmine/trunk@23562 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/assets/stylesheets/application.css | 27 | ||||
-rw-r--r-- | app/helpers/application_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/icons_helper.rb | 13 |
3 files changed, 38 insertions, 4 deletions
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 96fbb6f8f..849b5e901 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -1194,28 +1194,49 @@ input.autocomplete.ajax-loading { } div.flash {margin-top: 8px;} +div.flash:has(svg) { + padding-left: 10px; +} +div.flash svg.icon-svg { + margin-right: 4px; +} div.flash.error, #errorExplanation { - background: url(/exclamation.png) 8px 50% no-repeat; background-color: #ffe3e3; border-color: #d88; color: #880000; } +div.flash.error:not(:has(svg)), #errorExplanation { + background: url(/exclamation.png) 8px 50% no-repeat #ffe3e3; +} +div.flash.error svg.icon-svg { + stroke: #880000; +} div.flash.notice { - background: url(/true.png) 8px 5px no-repeat; background-color: #dfffdf; border-color: #9fcf9f; color: #005f00; } +div.flash.notice:not(:has(svg)) { + background: url(/true.png) 8px 50% no-repeat #dfffdf; +} +div.flash.notice svg.icon-svg { + stroke: #005f00; +} div.flash.warning, .conflict { - background: url(/warning.png) 8px 5px no-repeat; background-color: #F3EDD1; border-color: #eadbbc; color: #A6750C; text-align: left; } +div.flash.warning:not(:has(svg)) { + background: url(/warning.png) 8px 5px no-repeat #F3EDD1; +} +div.flash.warning svg.icon-svg { + stroke: #A6750C; +} .nodata, .warning { text-align: center; diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 50519c890..7991b9b43 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -518,7 +518,7 @@ module ApplicationHelper def render_flash_messages s = +'' flash.each do |k, v| - s << content_tag('div', v.html_safe, :class => "flash #{k}", :id => "flash_#{k}") + s << content_tag('div', notice_icon(k) + v.html_safe, :class => "flash #{k}", :id => "flash_#{k}") end s.html_safe end diff --git a/app/helpers/icons_helper.rb b/app/helpers/icons_helper.rb index 473f8f780..bee5c22a8 100644 --- a/app/helpers/icons_helper.rb +++ b/app/helpers/icons_helper.rb @@ -79,6 +79,19 @@ module IconsHelper sprite_icon(icon_name, name, size: 14) end + def notice_icon(type, **options) + icon_name = case type + when 'notice' + 'checked' + when 'warning' + 'warning' + when 'error' + 'warning' + end + + sprite_icon(icon_name, **options) + end + private def svg_sprite_icon(icon_name, size: DEFAULT_ICON_SIZE, sprite: DEFAULT_SPRITE, css_class: nil) |