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
<div class="members box">
<h3 class="icon icon-group"><%=l(:label_member_plural)%></h3>
<% @principals_by_role.keys.sort.each do |role| %>
- <p><span class="label"><%= role %>:</span> <%= @principals_by_role[role].sort.collect{|p| link_to_principal p}.join(", ").html_safe %></p>
+ <p><span class="label"><%= role %>:</span> <%= @principals_by_role[role].sort.collect{|p| link_to_principal(p, :class => p.is_a?(Group) ? 'icon icon-group' : nil)}.join(", ").html_safe %></p>
<% end %>
</div>
<% end %>
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