Skip to content

Commit 00e79a9

Browse files
silverwindclaude
andcommitted
Add admin badge to navbar avatar
Replace the standalone site admin icon in the navbar with a Discord-style shield badge on the user avatar. The badge uses a green background with the cutout border technique from the notification count. The "Site Administration" link in the dropdown menu remains unchanged. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e3cf360 commit 00e79a9

3 files changed

Lines changed: 27 additions & 10 deletions

File tree

templates/base/head_navbar.tmpl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@
8888

8989
<div class="ui dropdown jump item" data-tooltip-content="{{ctx.Locale.Tr "user_profile_and_more"}}">
9090
<span class="text">
91-
{{ctx.AvatarUtils.Avatar .SignedUser 24 "tw-mr-1"}}
91+
<span class="navbar-avatar tw-mr-1">
92+
{{ctx.AvatarUtils.Avatar .SignedUser 24}}
93+
{{if .IsAdmin}}{{svg "octicon-shield-check" 16 "navbar-admin-badge"}}{{end}}
94+
</span>
9295
<span class="only-mobile">{{.SignedUser.Name}}</span>
9396
<span class="not-mobile">{{svg "octicon-triangle-down"}}</span>
9497
</span>

templates/base/head_navbar_icons.tmpl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,4 @@
1717
<span class="notification_count{{if not $notificationUnreadCount}} tw-hidden{{end}}">{{$notificationUnreadCount}}</span>
1818
</div>
1919
</a>
20-
{{if $data.IsSiteAdmin}}
21-
<a class="item {{$itemExtraClass}}" href="{{AppSubUrl}}/-/admin" data-tooltip-content="{{ctx.Locale.Tr "admin_panel"}}">
22-
{{svg "octicon-server"}}
23-
</a>
24-
{{end}}
2520
{{end}}

web_src/css/modules/navbar.css

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@
101101
}
102102
}
103103

104-
#navbar a.item:hover .notification_count,
105-
#navbar a.item:hover .header-stopwatch-dot {
104+
#navbar .item:hover .notification_count,
105+
#navbar .item:hover .header-stopwatch-dot {
106106
border-color: var(--color-nav-hover-bg);
107107
}
108108

109-
#navbar a.item .notification_count,
110-
#navbar a.item .header-stopwatch-dot {
109+
#navbar .notification_count,
110+
#navbar .header-stopwatch-dot {
111111
color: var(--color-nav-bg);
112112
padding: 0 3.75px;
113113
font-size: 12px;
@@ -129,6 +129,25 @@
129129
white-space: nowrap;
130130
}
131131

132+
.navbar-avatar {
133+
position: relative;
134+
display: inline-flex;
135+
vertical-align: top;
136+
margin-top: -0.25rem;
137+
margin-bottom: -0.25rem;
138+
}
139+
140+
.navbar-admin-badge {
141+
position: absolute;
142+
bottom: -4px;
143+
right: -6px;
144+
padding: 1px;
145+
color: var(--color-black);
146+
background: var(--color-success-text);
147+
border: 2px solid var(--color-nav-bg);
148+
border-radius: 10px; /* (height + 2 * borderThickness) / 2 */
149+
}
150+
132151
.secondary-nav {
133152
background: var(--color-secondary-nav-bg) !important; /* important because of .ui.secondary.menu */
134153
}

0 commit comments

Comments
 (0)