Draw one menu on every page
Each page wrote its own nav: the same links in a different order, some missing, the current page sometimes listed and sometimes not. A shared "nav" template now draws it everywhere — Cluster, People, Quotas, Usage, Mirror for an administrator, then Chat, Your keys and Sign out — with the current page marked by aria-current. Pages rendered outside the account pages (the dashboard, node logs) get it through the request context their admin wrapper sets. The admin listener's own page keeps its metrics/pprof/api links. The chat and key pages said "project proj-3kq7…"; they now show the project's path, and the key page no longer repeats the email. A test renders several admin pages and requires the same menu on each. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
c22c3a309b
commit
c9cd25efc2
23 files changed
+209
-44
No files matched your search
@@ -21,6 +21,7 @@ type ChatModel struct {
|
||||
}
|
||||
|
||||
type chatData struct {
|
||||
Nav Nav
|
||||
User store.User
|
||||
Models []ChatModel
|
||||
CSRF string
|
||||
@@ -33,6 +34,7 @@ func Chat(user store.User, models []ChatModel, version string) http.HandlerFunc
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
noStore(w)
|
||||
render(w, "chat", chatData{
|
||||
Nav: navFrom(r, "chat"),
|
||||
User: user, Models: models, CSRF: csrfFor(r),
|
||||
Version: version, Now: time.Now().UTC().Format(time.RFC3339),
|
||||
})
|
||||
@@ -73,6 +75,6 @@ func (p *AccountPages) Guard(
|
||||
return
|
||||
}
|
||||
}
|
||||
next(w, r, user)
|
||||
next(w, p.withNav(r, user), user)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user