Commit 027a72496b
027a72496beee4257ee50fd36d104e0959193691
parent: 4df013a904
Verified · cmc
cmc <hello@cleberg.net> · 2026-08-24T17:20:03Z
web: surface archived state and topics
Repo header shows an amber archived chip and topic chips under the
description (repoPage gains Topics via ListTopics); index and owner
listings mark archived repos. Follows up the archived/topics backend
(d298215).
internal/httpd/web.go
+3
| @@ -120,6 +120,7 @@ type repoPage struct { |
| 120 | 120 | CloneURL string |
| 121 | 121 | Dir string |
| 122 | 122 | Tab string // active tab in the repo header |
| 123 | Topics []string |
| 123 | 124 | } |
| 124 | 125 | |
| 125 | 126 | // repoFor resolves the repo for a web request; false means 404 was sent. |
| @@ -148,6 +149,7 @@ func (s *Server) repoFor(w http.ResponseWriter, r *http.Request, ref string) (re |
| 148 | 149 | if ref == "" { |
| 149 | 150 | ref = repo.DefaultBranch |
| 150 | 151 | } |
| 152 | topics, _ := s.st.ListTopics(repo.ID) |
| 151 | 153 | return repoPage{ |
| 152 | 154 | Site: s.siteName(), |
| 153 | 155 | Viewer: viewer.Username, |
| @@ -156,6 +158,7 @@ func (s *Server) repoFor(w http.ResponseWriter, r *http.Request, ref string) (re |
| 156 | 158 | Ref: ref, |
| 157 | 159 | CloneURL: s.cfg.Server.SiteURL + "/" + repo.Path() + ".git", |
| 158 | 160 | Dir: control.RepoDir(s.cfg.Server.Root, repo.OwnerName, repo.Name), |
| 161 | Topics: topics, |
| 159 | 162 | }, true |
| 160 | 163 | } |
| 161 | 164 | |
internal/web/static/style.css
+2
| @@ -360,6 +360,8 @@ pre.diff .meta { color: var(--muted); } |
| 360 | 360 | .chip-neutral, .chip-source_gone { --chip: var(--neutral); } |
| 361 | 361 | .chip-stale { --chip: var(--warn); } |
| 362 | 362 | .chip.label { font-weight: 500; } |
| 363 | .chip.topic { --chip: var(--accent); } |
| 364 | .repohead .topics { margin: 0 0 var(--sp-2); } |
| 363 | 365 | .badge-verified { --chip: var(--ok); } |
| 364 | 366 | .badge-unsigned { --chip: var(--neutral); } |
| 365 | 367 | .badge-signed_unknown_key { --chip: var(--warn); } |
internal/web/templates/index.html
+1 −1
| @@ -5,7 +5,7 @@ |
| 5 | 5 | <h1>repositories</h1> |
| 6 | 6 | <ul class="repolist"> |
| 7 | 7 | {{range .Repos}}<li> |
| 8 | | <p class="reponame"><a href="/{{.OwnerName}}">{{.OwnerName}}</a>/<a href="/{{.OwnerName}}/{{.Name}}">{{.Name}}</a></p> |
| 8 | <p class="reponame"><a href="/{{.OwnerName}}">{{.OwnerName}}</a>/<a href="/{{.OwnerName}}/{{.Name}}">{{.Name}}</a>{{if .Settings.Archived}} <span class="chip chip-stale">archived</span>{{end}}</p> |
| 9 | 9 | {{if .Desc}}<p class="desc">{{.Desc}}</p>{{end}} |
| 10 | 10 | <p class="meta">{{template "branchicon"}} {{.DefaultBranch}}</p> |
| 11 | 11 | </li> |
internal/web/templates/layout.html
+2 −1
| @@ -22,8 +22,9 @@ |
| 22 | 22 | |
| 23 | 23 | {{define "repoheader"}} |
| 24 | 24 | <div class="repohead"> |
| 25 | | <h1 class="repotitle"><a class="owner" href="/{{.Repo.OwnerName}}">{{.Repo.OwnerName}}</a><span class="sep">/</span><a href="/{{.Repo.OwnerName}}/{{.Repo.Name}}">{{.Repo.Name}}</a>{{if eq .Repo.Visibility "private"}} <span class="chip chip-neutral">private</span>{{end}}</h1> |
| 25 | <h1 class="repotitle"><a class="owner" href="/{{.Repo.OwnerName}}">{{.Repo.OwnerName}}</a><span class="sep">/</span><a href="/{{.Repo.OwnerName}}/{{.Repo.Name}}">{{.Repo.Name}}</a>{{if eq .Repo.Visibility "private"}} <span class="chip chip-neutral">private</span>{{end}}{{if .Repo.Settings.Archived}} <span class="chip chip-stale">archived</span>{{end}}</h1> |
| 26 | 26 | {{if .Desc}}<p class="desc">{{.Desc}}</p>{{end}} |
| 27 | {{if .Topics}}<p class="topics">{{range .Topics}}<span class="chip topic">{{.}}</span> {{end}}</p>{{end}} |
| 27 | 28 | <nav class="tabs"> |
| 28 | 29 | <a {{if eq .Tab "files"}}class="active" {{end}}href="/{{.Repo.OwnerName}}/{{.Repo.Name}}">files</a> |
| 29 | 30 | <a {{if eq .Tab "log"}}class="active" {{end}}href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/log">log</a> |
internal/web/templates/owner.html
+1 −1
| @@ -7,7 +7,7 @@ |
| 7 | 7 | {{if .Members}}<p class="meta">members {{range .Members}}<a class="memberchip" href="/{{.Username}}">{{.Username}} <span class="role">{{.Role}}</span></a> {{end}}</p>{{end}} |
| 8 | 8 | <ul class="repolist"> |
| 9 | 9 | {{range .Repos}}<li> |
| 10 | | <p class="reponame"><a href="/{{.OwnerName}}/{{.Name}}">{{.Name}}</a>{{if eq .Visibility "private"}} <span class="chip chip-neutral">private</span>{{end}}</p> |
| 10 | <p class="reponame"><a href="/{{.OwnerName}}/{{.Name}}">{{.Name}}</a>{{if eq .Visibility "private"}} <span class="chip chip-neutral">private</span>{{end}}{{if .Settings.Archived}} <span class="chip chip-stale">archived</span>{{end}}</p> |
| 11 | 11 | {{if .Desc}}<p class="desc">{{.Desc}}</p>{{end}} |
| 12 | 12 | <p class="meta">{{template "branchicon"}} {{.DefaultBranch}}</p> |
| 13 | 13 | </li> |