From: Anton Khorev Date: Tue, 7 May 2024 12:23:38 +0000 (+0300) Subject: Use inline svgs for moderator scope icons X-Git-Tag: live~591^2~1 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/12d797b3513bba475a8939eda9fa202f28bc5306?hp=d9e650fde103e923890372df0ffa93ee117eb228 Use inline svgs for moderator scope icons --- diff --git a/app/helpers/authorization_helper.rb b/app/helpers/authorization_helper.rb index 11c8c298f..3a95d54ea 100644 --- a/app/helpers/authorization_helper.rb +++ b/app/helpers/authorization_helper.rb @@ -6,7 +6,7 @@ module AuthorizationHelper html << t("oauth.scopes.#{scope}") if Oauth::MODERATOR_SCOPES.include? scope html << " " - html << image_tag("roles/moderator.png", :srcset => image_path("roles/moderator.svg", :class => "align-text-bottom"), :size => "20x20") + html << role_icon_svg_tag("moderator", false, t("oauth.for_roles.moderator"), :class => "align-text-bottom") end safe_join(html) end diff --git a/app/helpers/user_roles_helper.rb b/app/helpers/user_roles_helper.rb index 1308cdfa7..4634cb015 100644 --- a/app/helpers/user_roles_helper.rb +++ b/app/helpers/user_roles_helper.rb @@ -21,7 +21,7 @@ module UserRolesHelper end end - def role_icon_svg_tag(role, blank, title) + def role_icon_svg_tag(role, blank, title, **options) role_colors = { "administrator" => "#f69e42", "moderator" => "#0606ff", @@ -30,7 +30,7 @@ module UserRolesHelper color = role_colors[role] || "currentColor" 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" - tag.svg(:width => 20, :height => 20) do + tag.svg(:width => 20, :height => 20, **options) do concat tag.title(title) concat tag.path(:d => path_data, :fill => color, :stroke => color, "stroke-width" => 2, "stroke-linejoin" => "round") concat tag.path(:d => path_data, :fill => "#fff") if blank diff --git a/config/locales/en.yml b/config/locales/en.yml index 4570183d0..45c44765d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2637,6 +2637,8 @@ en: write_redactions: Redact map data read_email: Read user email address skip_authorization: Auto approve application + for_roles: + moderator: This permission is for actions available only to moderators oauth_clients: new: title: "Register a new application"