]> git.openstreetmap.org Git - rails.git/blob - app/helpers/user_roles_helper.rb
Replaces role_icons helper with template code
[rails.git] / app / helpers / user_roles_helper.rb
1 module UserRolesHelper
2   def role_icon_svg_tag(role, blank, title, **options)
3     role_colors = {
4       "administrator" => "#f69e42",
5       "moderator" => "#447eff",
6       "importer" => "#38e13a"
7     }
8     color = role_colors[role] || "currentColor"
9
10     path_data = "M 10,2 8.125,8 2,8 6.96875,11.71875 5,18 10,14 15,18 13.03125,11.71875 18,8 11.875,8 10,2 z"
11     tag.svg(:width => 20, :height => 20, **options) do
12       concat tag.title(title)
13       concat tag.path(:d => path_data,
14                       :fill => blank ? "none" : color,
15                       :stroke => color,
16                       "stroke-width" => blank ? 1.5 : 2,
17                       "stroke-linejoin" => "round")
18     end
19   end
20 end