summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2024-12-10 23:31:14 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2024-12-10 23:31:14 +0000
commit910842a157a9fa663b13ddc6eb95359fd60482a1 (patch)
tree815a3db17a7cda823537f3ce040a48782ff85bcb
parent4a74fcccae8099c17950340a6cfdbd54930cf495 (diff)
downloadredmine-910842a157a9fa663b13ddc6eb95359fd60482a1.tar.gz
redmine-910842a157a9fa663b13ddc6eb95359fd60482a1.zip
Fixes group icons not displayed only using the SVG icon (#41853).
git-svn-id: https://svn.redmine.org/redmine/trunk@23379 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/assets/stylesheets/application.css5
-rw-r--r--app/helpers/application_helper.rb2
-rw-r--r--app/helpers/watchers_helper.rb2
-rw-r--r--test/functional/issues_controller_test.rb3
-rw-r--r--test/functional/messages_controller_test.rb3
-rw-r--r--test/functional/wiki_controller_test.rb3
-rw-r--r--test/helpers/application_helper_test.rb17
7 files changed, 23 insertions, 12 deletions
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
index b442da7e3..1707bc172 100644
--- a/app/assets/stylesheets/application.css
+++ b/app/assets/stylesheets/application.css
@@ -435,7 +435,7 @@ tr.version:not(.shared) td.name { padding-left: 20px; }
tr.version td.date, tr.version td.status, tr.version td.sharing { text-align: center; white-space:nowrap; }
tr.member td.icon-user, #principals_for_new_member .icon-user {background:transparent;}
-#principals_for_new_member svg {margin-right: 4px;}
+#principals_for_new_member svg, #principals_for_new_member img {margin-right: 4px;}
tr.user td {width:13%;white-space: nowrap;}
td.username, td.firstname, td.lastname, td.email {text-align:left !important;}
@@ -540,7 +540,10 @@ td.center {text-align:center;}
#watchers select {width: 95%; display: block;}
#watchers img.gravatar {margin: 0 4px 2px 0;}
+#watchers svg.icon-svg {margin: 0 2px 2px 0;}
#users_for_watcher img.gravatar {padding-bottom: 2px; margin-right: 4px;}
+#users_for_watcher svg {margin-right: 4px;}
+#users_for_watcher span.icon-user {display: inline;}
span#watchers_inputs {overflow:auto; display:block;}
span.search_for_watchers {display:block;}
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index d708019c9..2db6ce7ee 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -655,7 +655,7 @@ module ApplicationHelper
content_tag(
'label',
check_box_tag(name, principal.id, false, :id => nil) +
- (avatar(principal, :size => 16).presence ||
+ ((avatar(principal, :size => 16).presence if principal.is_a?(User)) ||
content_tag(
'span', principal_icon(principal),
:class => "name icon icon-#{principal.class.name.downcase}"
diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb
index f7763e41b..00afd30ae 100644
--- a/app/helpers/watchers_helper.rb
+++ b/app/helpers/watchers_helper.rb
@@ -49,7 +49,7 @@ module WatchersHelper
content = ''.html_safe
lis = object.watcher_users.sorted.collect do |user|
s = ''.html_safe
- s << avatar(user, :size => "16").to_s
+ s << avatar(user, :size => "16").to_s if user.is_a?(User)
s << link_to_principal(user, class: user.class.to_s.downcase)
if object.respond_to?(:visible?) && user.is_a?(User) && !object.visible?(user)
s << content_tag('span', l(:notice_invalid_watcher), class: 'icon-only icon-warning', title: l(:notice_invalid_watcher))
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 3b7521d40..fbe512122 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -2827,7 +2827,8 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_select 'a[class*=delete]'
end
assert_select "li.user-10" do
- assert_select 'img.gravatar[title=?]', 'A Team'
+ assert_select 'a.group', :text => 'A Team'
+ assert_select 'svg'
assert_select 'a[href="/groups/10"]'
assert_select 'a[class*=delete]'
end
diff --git a/test/functional/messages_controller_test.rb b/test/functional/messages_controller_test.rb
index c0723643b..494628b8c 100644
--- a/test/functional/messages_controller_test.rb
+++ b/test/functional/messages_controller_test.rb
@@ -106,7 +106,8 @@ class MessagesControllerTest < Redmine::ControllerTest
assert_select 'a[class*=delete]'
end
assert_select "li.user-10" do
- assert_select 'img.gravatar[title=?]', 'A Team', is_display_gravatar
+ assert_select 'a.group', :text => 'A Team'
+ assert_select 'svg'
assert_select 'a[href="/users/10"]', false
assert_select 'a[class*=delete]'
end
diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb
index fdfaaf805..9d94f5c20 100644
--- a/test/functional/wiki_controller_test.rb
+++ b/test/functional/wiki_controller_test.rb
@@ -142,7 +142,8 @@ class WikiControllerTest < Redmine::ControllerTest
assert_select 'a[class*=delete]'
end
assert_select 'li.user-10' do
- assert_select 'img.gravatar[title=?]', 'A Team', is_display_gravatar
+ assert_select 'a.group', :text => 'A Team'
+ assert_select 'svg'
assert_select 'a[href="/users/10"]', false
assert_select 'a[class*=delete]'
end
diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb
index fabaa31ed..3d3861f66 100644
--- a/test/helpers/application_helper_test.rb
+++ b/test/helpers/application_helper_test.rb
@@ -2008,13 +2008,18 @@ class ApplicationHelperTest < Redmine::HelperTest
end
def test_principals_check_box_tag_with_avatar
- principals = [User.find(1), Group.find(10)]
+ user = User.find(1)
+ group = Group.find(10)
with_settings :gravatar_enabled => '1' do
- tags = principals_check_box_tags("watcher[user_ids][]", principals)
- principals.each do |principal|
- assert_include avatar(principal, :size => 16), tags
- assert_not_include content_tag('span', nil, :class => "name icon icon-#{principal.class.name.downcase}"), tags
- end
+ tags = principals_check_box_tags("watcher[user_ids][]", [user, group])
+
+ # User should have avatar
+ assert_include avatar(user, :size => 16), tags
+ assert_not_include content_tag('span', nil, :class => "name icon icon-#{user.class.name.downcase}"), tags
+
+ # Group should have group icon
+ assert_not_include avatar(group, :size => 16), tags
+ assert_include content_tag('span', principal_icon(group), :class => "name icon icon-#{group.class.name.downcase}"), tags
end
end