]> git.openstreetmap.org Git - rails.git/blobdiff - app/helpers/user_roles_helper.rb
Use boolean instead of string for hiding labels
[rails.git] / app / helpers / user_roles_helper.rb
index b9430535ea3fa8702b5cbee8b3e77a7acb624c14..79e7cc012ad1e2c32e25a1f9df21c20bb983c4dc 100644 (file)
@@ -1,8 +1,6 @@
 module UserRolesHelper
   def role_icons(user)
-    UserRole::ALL_ROLES.reduce("".html_safe) do |acc, elem|
-      acc + " " + role_icon(user, elem)
-    end
+    safe_join(UserRole::ALL_ROLES.collect { |role| role_icon(user, role) }.compact, " ")
   end
 
   def role_icon(user, role)
@@ -29,7 +27,7 @@ module UserRolesHelper
     if image
       svg_icon = tag("source", :srcset => image_path("#{image}.svg"), :type => "image/svg+xml")
       png_icon = image_tag("#{image}.png", :srcset => image_path("#{image}.svg"), :size => "20x20", :border => 0, :alt => alt, :title => title)
-      icon = content_tag("picture", svg_icon + png_icon)
+      icon = tag.picture(svg_icon + png_icon)
       icon = link_to(icon, url, :method => :post, :confirm => confirm) if url
     end