mirror of
https://github.com/redmine/redmine.git
synced 2025-11-12 16:26:03 +01:00
Fixes that group icons in Watchers box have both the old and the new icon style (#41853).
git-svn-id: https://svn.redmine.org/redmine/trunk@23328 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -433,6 +433,8 @@ tr.version td.date, tr.version td.status, tr.version td.sharing { text-align: ce
|
||||
|
||||
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 img.gravatar {margin-right: 4px;}
|
||||
#principals_for_new_member span.icon:empty { display: none; }
|
||||
|
||||
tr.user td {width:13%;white-space: nowrap;}
|
||||
td.username, td.firstname, td.lastname, td.email {text-align:left !important;}
|
||||
@@ -537,7 +539,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.icon-svg {padding-bottom: 2px; margin-right: 2px;}
|
||||
#users_for_watcher span.icon:empty { display: none; }
|
||||
|
||||
span#watchers_inputs {overflow:auto; display:block;}
|
||||
span.search_for_watchers {display:block;}
|
||||
|
||||
@@ -651,17 +651,12 @@ module ApplicationHelper
|
||||
def principals_check_box_tags(name, principals)
|
||||
s = +''
|
||||
principals.each do |principal|
|
||||
s <<
|
||||
content_tag(
|
||||
'label',
|
||||
check_box_tag(name, principal.id, false, :id => nil) +
|
||||
(avatar(principal, :size => 16).presence ||
|
||||
content_tag(
|
||||
'span', principal_icon(principal),
|
||||
:class => "name icon icon-#{principal.class.name.downcase}"
|
||||
)
|
||||
) + principal.to_s
|
||||
)
|
||||
principal_check_box = +''
|
||||
principal_check_box << check_box_tag(name, principal.id, false, :id => nil)
|
||||
principal_check_box << avatar(principal, :size => 16).to_s if principal.is_a?(User)
|
||||
principal_check_box << content_tag('span', principal_icon(principal), :class => "name icon icon-#{principal.class.to_s.downcase}")
|
||||
principal_check_box << principal.to_s
|
||||
s << content_tag('label', principal_check_box.html_safe)
|
||||
end
|
||||
s.html_safe
|
||||
end
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -2008,18 +2008,31 @@ class ApplicationHelperTest < Redmine::HelperTest
|
||||
end
|
||||
|
||||
def test_principals_check_box_tag_with_avatar
|
||||
principals = [User.find(1), Group.find(10)]
|
||||
principals = [User.find(1), User.find(2)]
|
||||
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
|
||||
assert_include content_tag('span', nil, :class => "name icon icon-#{principal.class.name.downcase}"), tags
|
||||
assert_include principal.to_s, tags
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_principals_check_box_tag_without_avatar
|
||||
principals = [User.find(1), Group.find(10)]
|
||||
def test_principals_check_box_tag_without_avatar_when_principal_is_group
|
||||
principals = [Group.find(10), Group.find(11)]
|
||||
with_settings :gravatar_enabled => '1' do
|
||||
tags = principals_check_box_tags("watcher[user_ids][]", principals)
|
||||
principals.each do |principal|
|
||||
assert_not_include avatar(principal, :size => 16), tags
|
||||
assert_include content_tag('span', principal_icon(principal), :class => "name icon icon-#{principal.class.name.downcase}"), tags
|
||||
assert_include principal.to_s, tags
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_principals_check_box_tag_without_avatar_when_gravatar_disabled
|
||||
principals = [User.find(1), User.find(2)]
|
||||
Setting.gravatar_enabled = '1'
|
||||
avatar_tags = principals.collect{|p| avatar(p, :size => 16)}
|
||||
|
||||
@@ -2027,7 +2040,8 @@ class ApplicationHelperTest < Redmine::HelperTest
|
||||
tags = principals_check_box_tags(name, principals)
|
||||
principals.each_with_index do |principal, i|
|
||||
assert_not_include avatar_tags[i], tags
|
||||
assert_include content_tag('span', principal_icon(principal), :class => "name icon icon-#{principal.class.name.downcase}"), tags
|
||||
assert_include content_tag('span', nil, :class => "name icon icon-#{principal.class.name.downcase}"), tags
|
||||
assert_include principal.to_s, tags
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -94,4 +94,34 @@ class WatchersHelperTest < Redmine::HelperTest
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_watchers_list_should_include_avatar_and_user_name
|
||||
issue = Issue.find(1)
|
||||
Watcher.create!(:watchable => issue, :user => User.find(1))
|
||||
|
||||
with_settings :gravatar_enabled => '1' do
|
||||
result = watchers_list(issue)
|
||||
assert_select_in result, 'ul.watchers' do
|
||||
assert_select 'li', 1
|
||||
assert_select 'li:nth-of-type(1)>img.gravatar', 1
|
||||
assert_select 'li:nth-of-type(1)>a[href=?]', '/users/1', text: 'Redmine Admin'
|
||||
assert_select 'li:nth-of-type(1)>a.group>svg.icon-svg', 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_watchers_list_should_include_svg_icon_and_group_name
|
||||
issue = Issue.find(1)
|
||||
Watcher.create!(:watchable => issue, :user => Group.find(10))
|
||||
|
||||
with_settings :gravatar_enabled => '1' do
|
||||
result = watchers_list(issue)
|
||||
assert_select_in result, 'ul.watchers' do
|
||||
assert_select 'li', 1
|
||||
assert_select 'li:nth-of-type(1)>a.group>svg.icon-svg', 1
|
||||
assert_select 'li:nth-of-type(1)>a[href=?]', '/groups/10', text: 'A Team'
|
||||
assert_select 'li:nth-of-type(1)>img.gravatar', 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user