Commit cd32f252a3d9a3448f099c3b96037c1f2fc416d1
Committed by
Rodrigo Souto
1 parent
53d447a8
Exists in
master
and in
28 other branches
changes ugly code to be, what i think is, more ruby-like
Showing
1 changed file
with
3 additions
and
4 deletions
Show diff stats
app/helpers/application_helper.rb
@@ -728,12 +728,11 @@ module ApplicationHelper | @@ -728,12 +728,11 @@ module ApplicationHelper | ||
728 | 728 | ||
729 | def rolename_for(profile, resource) | 729 | def rolename_for(profile, resource) |
730 | roles = profile.role_assignments.select{ |a| a.resource_id == resource.id }.sort_by{ |s| s.role_id }.map(&:role) | 730 | roles = profile.role_assignments.select{ |a| a.resource_id == resource.id }.sort_by{ |s| s.role_id }.map(&:role) |
731 | - names = '' | 731 | + names = [] |
732 | roles.each do |role| | 732 | roles.each do |role| |
733 | - names += content_tag('span', role.name, :style => "color: #{role_color(role, resource.environment.id)}") | ||
734 | - names += ', ' | 733 | + names << content_tag('span', role.name, :style => "color: #{role_color(role, resource.environment.id)}") |
735 | end | 734 | end |
736 | - names.slice 0..-3 | 735 | + names.join(', ') |
737 | end | 736 | end |
738 | 737 | ||
739 | def role_color(role, env_id) | 738 | def role_color(role, env_id) |