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
This commit is contained in:
Marius Balteanu
2024-12-10 23:31:14 +00:00
parent 4a74fcccae
commit 910842a157
7 changed files with 23 additions and 12 deletions

View File

@@ -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;}

View File

@@ -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}"

View File

@@ -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))

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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