From 605dadd37465398e0317ca855741e6582cdd0170 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Tue, 20 Jul 2021 21:35:06 +0000 Subject: [PATCH] Set "icon icon-group" CSS classes in _members_box.html.erb instead of ApplicationHeler (#12795). git-svn-id: http://svn.redmine.org/redmine/trunk@21074 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/application_helper.rb | 3 ++- app/views/projects/_members_box.html.erb | 2 +- test/helpers/application_helper_test.rb | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ae0094872..be3f40a94 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -67,11 +67,12 @@ module ApplicationHelper when Group name = h(principal.to_s) url = group_url(principal, :only_path => only_path) - css_classes = "group icon icon-#{principal.class.name.downcase}" + css_classes = 'group' else name = h(principal.to_s) end + css_classes += " #{options[:class]}" if options[:class].present? url ? link_to(name, url, :class => css_classes) : name end diff --git a/app/views/projects/_members_box.html.erb b/app/views/projects/_members_box.html.erb index ff7170e48..b5bb46e3a 100644 --- a/app/views/projects/_members_box.html.erb +++ b/app/views/projects/_members_box.html.erb @@ -2,7 +2,7 @@

<%=l(:label_member_plural)%>

<% @principals_by_role.keys.sort.each do |role| %> -

<%= role %>: <%= @principals_by_role[role].sort.collect{|p| link_to_principal p}.join(", ").html_safe %>

+

<%= role %>: <%= @principals_by_role[role].sort.collect{|p| link_to_principal(p, :class => p.is_a?(Group) ? 'icon icon-group' : nil)}.join(", ").html_safe %>

<% end %>
<% end %> diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb index 384b7a383..2a11575d6 100644 --- a/test/helpers/application_helper_test.rb +++ b/test/helpers/application_helper_test.rb @@ -1715,7 +1715,7 @@ class ApplicationHelperTest < Redmine::HelperTest def test_link_to_principal_should_link_to_group group = Group.find(10) - result = link_to('A Team', '/groups/10', :class => 'group icon icon-group') + result = link_to('A Team', '/groups/10', :class => 'group') assert_equal result, link_to_principal(group) end -- 2.39.5