fix: pluralize comment count in bug listing

Amolith and Crush created

Display '1 comment' instead of '1 comments' when a bug has
exactly one comment.

Implements: bug-224db6f
Co-authored-by: Crush <crush@charm.land>

Change summary

pkg/web/templates/bugs.html | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

Detailed changes

pkg/web/templates/bugs.html 🔗

@@ -30,11 +30,11 @@
       {{.Title}}
       {{if .Labels}}{{range $i, $label := .Labels}}{{if $i}} {{end}}<span class="bug-label" style="--label-color: {{$label.Color}}">{{$label.Name}}</span>{{end}}{{end}}
     </h3>
-     <footer>
-       {{if .AuthorAvatar}}<img src="{{.AuthorAvatar}}" alt="" class="avatar" loading="lazy" referrerpolicy="no-referrer">{{end}}<strong>{{.Author}}</strong> opened <time datetime="{{.CreatedAt | rfc3339}}" data-tooltip="{{.CreatedAt | formatDate}}">{{.CreatedAt | relativeTime}}</time>
-       {{if gt .CommentCount 0}}
-       • {{.CommentCount}} comments
-       {{end}}
+      <footer>
+        {{if .AuthorAvatar}}<img src="{{.AuthorAvatar}}" alt="" class="avatar" loading="lazy" referrerpolicy="no-referrer">{{end}}<strong>{{.Author}}</strong> opened <time datetime="{{.CreatedAt | rfc3339}}" data-tooltip="{{.CreatedAt | formatDate}}">{{.CreatedAt | relativeTime}}</time>
+        {{if gt .CommentCount 0}}
+        • {{.CommentCount}} {{if eq .CommentCount 1}}comment{{else}}comments{{end}}
+        {{end}}
        {{if .HasActivity}}
        • Updated <time datetime="{{.LastActivity | rfc3339}}" data-tooltip="{{.LastActivity | formatDate}}">{{.LastActivity | relativeTime}}</time>
        {{end}}