From 33c491d5c506acf43f331636f0a84a222947c27d Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Sat, 21 Oct 2023 20:39:55 +0300 Subject: [PATCH] Highlight write_blocks permission when showing authorizations --- app/helpers/authorization_helper.rb | 13 +++++++++++++ app/views/oauth2_applications/_application.html.erb | 2 +- app/views/oauth2_authorizations/new.html.erb | 2 +- .../_application.html.erb | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 app/helpers/authorization_helper.rb diff --git a/app/helpers/authorization_helper.rb b/app/helpers/authorization_helper.rb new file mode 100644 index 0000000000..adc9e6daa4 --- /dev/null +++ b/app/helpers/authorization_helper.rb @@ -0,0 +1,13 @@ +module AuthorizationHelper + include ActionView::Helpers::TranslationHelper + + def authorization_scope(scope) + html = [] + if scope == "write_blocks" + html << image_tag("roles/moderator.png", :srcset => image_path("roles/moderator.svg", :class => "align-text-bottom"), :size => "20x20") + html << " " + end + html << t("oauth.scopes.#{scope}") + safe_join(html) + end +end diff --git a/app/views/oauth2_applications/_application.html.erb b/app/views/oauth2_applications/_application.html.erb index 564fa81ebf..57e8521829 100644 --- a/app/views/oauth2_applications/_application.html.erb +++ b/app/views/oauth2_applications/_application.html.erb @@ -10,7 +10,7 @@ diff --git a/app/views/oauth2_authorizations/new.html.erb b/app/views/oauth2_authorizations/new.html.erb index ac9c7c6c59..8720bf05a6 100644 --- a/app/views/oauth2_authorizations/new.html.erb +++ b/app/views/oauth2_authorizations/new.html.erb @@ -6,7 +6,7 @@ diff --git a/app/views/oauth2_authorized_applications/_application.html.erb b/app/views/oauth2_authorized_applications/_application.html.erb index 8abbb26ed8..28d048c4a0 100644 --- a/app/views/oauth2_authorized_applications/_application.html.erb +++ b/app/views/oauth2_authorized_applications/_application.html.erb @@ -5,7 +5,7 @@