Use inline svgs for moderator scope icons

This commit is contained in:
Anton Khorev 2024-05-07 15:23:38 +03:00
parent d9e650fde1
commit 12d797b351
3 changed files with 5 additions and 3 deletions

View file

@ -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

View file

@ -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

View file

@ -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"