From dfbb1b68566a1dbafb7af905d8f9a037ed28c1ff Mon Sep 17 00:00:00 2001 From: Marius Balteanu Date: Sun, 29 Sep 2024 19:16:15 +0000 Subject: [PATCH] Merges fav and fav-off icons in only one icon and fill the collor from CSS (#23980). git-svn-id: https://svn.redmine.org/redmine/trunk@23089 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/assets/images/icons.svg | 3 --- app/assets/stylesheets/application.css | 5 +++++ app/helpers/watchers_helper.rb | 5 ++--- test/helpers/watchers_helper_test.rb | 6 +++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/assets/images/icons.svg b/app/assets/images/icons.svg index 6a2b46adc..938ca792f 100644 --- a/app/assets/images/icons.svg +++ b/app/assets/images/icons.svg @@ -166,9 +166,6 @@ - - - diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 008ab05c6..ddf8043d2 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -1689,6 +1689,11 @@ svg.icon-ok { display: none; } +.icon-fav svg.icon-svg { + fill: #ffc400; + stroke: #ffc400; +} + svg { &.icon-svg { stroke: #169; diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index c800e4c96..286eaa8e6 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -25,8 +25,7 @@ module WatchersHelper return '' unless objects.any? watched = Watcher.any_watched?(objects, user) - icon = watched ? 'fav' : 'fav-off' - css = [watcher_css(objects), 'icon', "icon-#{icon}"].join(' ') + css = [watcher_css(objects), watched ? 'icon icon-fav' : 'icon icon-fav-off'].join(' ') text = watched ? l(:button_unwatch) : l(:button_watch) url = watch_path( :object_type => objects.first.class.to_s.underscore, @@ -34,7 +33,7 @@ module WatchersHelper ) method = watched ? 'delete' : 'post' - link_to icon_with_label(icon, text), url, :remote => true, :method => method, :class => css + link_to icon_with_label('fav', text), url, :remote => true, :method => method, :class => css end # Returns the css class used to identify watch links for a given +object+ diff --git a/test/helpers/watchers_helper_test.rb b/test/helpers/watchers_helper_test.rb index 42016ec01..7d1f39795 100644 --- a/test/helpers/watchers_helper_test.rb +++ b/test/helpers/watchers_helper_test.rb @@ -28,7 +28,7 @@ class WatchersHelperTest < Redmine::HelperTest test '#watcher_link with a non-watched object' do expected = link_to( - icon_with_label("fav-off", "Watch"), + icon_with_label("fav", "Watch"), "/watchers/watch?object_id=1&object_type=issue", :remote => true, :method => 'post', :class => "issue-1-watcher icon icon-fav-off" ) @@ -37,7 +37,7 @@ class WatchersHelperTest < Redmine::HelperTest test '#watcher_link with a single object array' do expected = link_to( - icon_with_label("fav-off", "Watch"), + icon_with_label("fav", "Watch"), "/watchers/watch?object_id=1&object_type=issue", :remote => true, :method => 'post', :class => "issue-1-watcher icon icon-fav-off" ) @@ -46,7 +46,7 @@ class WatchersHelperTest < Redmine::HelperTest test '#watcher_link with a multiple objects array' do expected = link_to( - icon_with_label("fav-off", "Watch"), + icon_with_label("fav", "Watch"), "/watchers/watch?object_id%5B%5D=1&object_id%5B%5D=3&object_type=issue", :remote => true, :method => 'post', :class => "issue-bulk-watcher icon icon-fav-off" ) -- 2.39.5