3 safe_join(UserRole::ALL_ROLES.filter_map { |role| role_icon(user, role) }, " ")
6 def role_icon(user, role)
7 if current_user&.administrator?
9 image = "roles/#{role}"
10 alt = t("users.show.role.revoke.#{role}")
11 title = t("users.show.role.revoke.#{role}")
12 url = revoke_role_path(:display_name => user.display_name, :role => role)
13 confirm = t("user_role.revoke.are_you_sure", :name => user.display_name, :role => role)
15 image = "roles/blank_#{role}"
16 alt = t("users.show.role.grant.#{role}")
17 title = t("users.show.role.grant.#{role}")
18 url = grant_role_path(:display_name => user.display_name, :role => role)
19 confirm = t("user_role.grant.are_you_sure", :name => user.display_name, :role => role)
21 elsif user.role?(role)
22 image = "roles/#{role}"
23 alt = t("users.show.role.#{role}")
24 title = t("users.show.role.#{role}")
28 icon = image_tag("#{image}.png", :srcset => image_path("#{image}.svg"), :size => "20x20", :border => 0, :alt => alt, :title => title)
29 icon = link_to(icon, url, :method => :post, :data => { :confirm => confirm }) if url