From c3b1e7372eb8d3d097ea642133f52f5305c07e1f Mon Sep 17 00:00:00 2001 From: silverwind Date: Sun, 1 Mar 2026 21:48:47 +0100 Subject: [PATCH] Add admin badge to navbar avatar (#36790) Replace the standalone site admin icon in the navbar with a Discord-style shield badge on the user avatar. image Fixes: https://github.com/go-gitea/gitea/issues/35904 --------- Co-authored-by: Claude Opus 4.6 --- templates/base/head_navbar.tmpl | 7 +++++-- templates/base/head_navbar_icons.tmpl | 5 ----- web_src/css/modules/navbar.css | 19 +++++++++++++++++-- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl index 22f1ba0b73..447f78565e 100644 --- a/templates/base/head_navbar.tmpl +++ b/templates/base/head_navbar.tmpl @@ -87,8 +87,11 @@ - {{if $data.IsSiteAdmin}} - - {{svg "octicon-server"}} - - {{end}} {{end}} diff --git a/web_src/css/modules/navbar.css b/web_src/css/modules/navbar.css index 149766a586..19a9f389d7 100644 --- a/web_src/css/modules/navbar.css +++ b/web_src/css/modules/navbar.css @@ -102,12 +102,14 @@ } #navbar a.item:hover .notification_count, -#navbar a.item:hover .header-stopwatch-dot { +#navbar a.item:hover .header-stopwatch-dot, +#navbar .item.active .navbar-admin-badge { border-color: var(--color-nav-hover-bg); } #navbar a.item .notification_count, -#navbar a.item .header-stopwatch-dot { +#navbar a.item .header-stopwatch-dot, +#navbar .item .navbar-admin-badge { color: var(--color-nav-bg); padding: 0 3.75px; font-size: 12px; @@ -127,6 +129,19 @@ z-index: 1; /* prevent menu button background from overlaying icon */ user-select: none; white-space: nowrap; + overflow: visible; +} + +.navbar-avatar { + position: relative; + display: inline-flex; +} + +#navbar .item .navbar-admin-badge { + position: absolute; + bottom: calc(100% - 29px); + left: calc(100% - 18px); + padding: 1.5px; } .secondary-nav {