From 6d25578ec9f34807b024f08750a5b4eca4ec63db Mon Sep 17 00:00:00 2001 From: Marwin Hochfelsner <50826859+hlfan@users.noreply.github.com> Date: Wed, 5 Nov 2025 04:23:03 +0100 Subject: [PATCH] Replace role icon --- app/assets/images/icons/role-star.svg | 3 --- app/assets/stylesheets/colors.scss | 12 ++++-------- app/helpers/authorization_helper.rb | 10 ++++++++-- app/views/users/show.html.erb | 9 +++------ 4 files changed, 15 insertions(+), 19 deletions(-) delete mode 100644 app/assets/images/icons/role-star.svg diff --git a/app/assets/images/icons/role-star.svg b/app/assets/images/icons/role-star.svg deleted file mode 100644 index 27cefb7e4..000000000 --- a/app/assets/images/icons/role-star.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/app/assets/stylesheets/colors.scss b/app/assets/stylesheets/colors.scss index 5116522d6..bace844c9 100644 --- a/app/assets/stylesheets/colors.scss +++ b/app/assets/stylesheets/colors.scss @@ -4,18 +4,14 @@ --marker-blue: #0b8ef1; } -svg.role-icon { - fill: currentColor; - &.inactive { - fill: var(--bs-body-bg, transparent); - } - &.administrator { +i.bi { + &.role-administrator { color: #f69e42; } - &.moderator { + &.role-moderator { color: #447eff; } - &.importer { + &.role-importer { color: #38e13a; } } diff --git a/app/helpers/authorization_helper.rb b/app/helpers/authorization_helper.rb index 9138c8222..16b78074f 100644 --- a/app/helpers/authorization_helper.rb +++ b/app/helpers/authorization_helper.rb @@ -8,9 +8,15 @@ module AuthorizationHelper html << t("oauth.scopes.#{scope}") if Oauth::MODERATOR_SCOPES.include? scope html << " " - html << inline_svg_tag("icons/role-star.svg", :class => "role-icon moderator align-text-bottom", - :title => t("oauth.for_roles.moderator")) + html << role_icon(:classes => "bi-star-fill role-moderator", :title => t("oauth.for_roles.moderator")) end safe_join(html) end + + def role_icon(classes: "", title: "") + safe_join([ + tag.i(:class => ["bi fs-5 align-middle", classes], :title => title, :aria => { :hidden => "true" }), + tag.span(title, :class => "visually-hidden") + ]) + end end diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index ccdb04d01..6836c99f5 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -18,21 +18,18 @@ <% UserRole::ALL_ROLES.each do |role| %> <% if current_user&.administrator? %> <% if @user.role?(role) %> - <%= link_to inline_svg_tag("icons/role-star.svg", :class => "role-icon #{role}", - :title => t(".revoke.#{role}")), + <%= link_to role_icon(:classes => "bi-star-fill role-#{role}", :title => t(".revoke.#{role}")), user_role_path(@user, role), :method => :delete, :data => { :confirm => t(".revoke.are_you_sure", :name => @user.display_name, :role => role) } %> <% else %> - <%= link_to inline_svg_tag("icons/role-star.svg", :class => "role-icon #{role} inactive", - :title => t(".grant.#{role}")), + <%= link_to role_icon(:classes => "bi-star role-#{role}", :title => t(".grant.#{role}")), user_role_path(@user, role), :method => :post, :data => { :confirm => t(".grant.are_you_sure", :name => @user.display_name, :role => role) } %> <% end %> <% elsif @user.role?(role) %> - <%= inline_svg_tag "icons/role-star.svg", :class => "role-icon #{role}", - :title => t(".title.#{role}") %> + <%= role_icon(:classes => "bi-star-fill role-#{role}", :title => t(".title.#{role}")) %> <% end %> <% end %> -- 2.39.5