feat(webui): render co-authors on branches/tags
Amolith
and
Crush
created 1 week ago
Branches and tags pages now extract and display co-authors
from commit message trailers using the attributionNames
template function. This replicates the existing commits page
behavior, showing "Author, Co1, and Co2 created time" format.
Implements: bug-f5cf6b5
Co-authored-by: Crush <crush@charm.land>
Change summary
pkg/web/templates/branches.html | 10 +++++++++-
pkg/web/templates/tags.html | 10 +++++++++-
2 files changed, 18 insertions(+), 2 deletions(-)
Detailed changes
@@ -25,7 +25,15 @@
</details>
{{end}}
<p>
- <strong>{{.Commit.Author.Name}}</strong> created
+ {{ $names := .Commit | attributionNames }}
+ {{ $nlen := len $names }}
+ {{ range $i, $n := $names }}
+ {{ if gt $i 0 }}
+ {{ if eq $nlen 2 }} and {{ else if eq $i (sub $nlen 1) }}, and {{ else }}, {{ end }}
+ {{ end }}
+ <strong>{{$n}}</strong>
+ {{ end }}
+ created
<time datetime="{{.Commit.Author.When | rfc3339}}" data-tooltip="{{.Commit.Author.When | formatDate}}">{{.Commit.Author.When | relativeTime}}</time>
</p>
{{end}}
@@ -10,7 +10,15 @@
{{end}}
{{if .Commit}}
<p>
- <strong>{{.Commit.Author.Name}}</strong> created
+ {{ $names := .Commit | attributionNames }}
+ {{ $nlen := len $names }}
+ {{ range $i, $n := $names }}
+ {{ if gt $i 0 }}
+ {{ if eq $nlen 2 }} and {{ else if eq $i (sub $nlen 1) }}, and {{ else }}, {{ end }}
+ {{ end }}
+ <strong>{{$n}}</strong>
+ {{ end }}
+ created
<time datetime="{{.TagDate | rfc3339}}" data-tooltip="{{.TagDate | formatDate}}">{{.TagDate | relativeTime}}</time>
</p>
{{end}}