bugs.html

 1{{define "content"}}
 2<section aria-labelledby="bugs-heading">
 3  <h2 id="bugs-heading">Bugs</h2>
 4
 5  <nav aria-label="Bug status filter">
 6    <ul>
 7      <li><a href="/{{.Repo.Name}}/bugs?status=open"{{if eq .Status "open"}} aria-current="page"{{end}}>Open</a></li>
 8      <li><a href="/{{.Repo.Name}}/bugs?status=closed"{{if eq .Status "closed"}} aria-current="page"{{end}}>Closed</a></li>
 9      <li><a href="/{{.Repo.Name}}/bugs?status=all"{{if eq .Status "all"}} aria-current="page"{{end}}>All</a></li>
10    </ul>
11  </nav>
12
13  {{if .Bugs}}
14  {{range .Bugs}}
15  <article aria-labelledby="bug-{{.ID}}">
16    <h3 id="bug-{{.ID}}">
17      {{if eq $.Status "all"}}
18      {{if eq .Status "open"}}
19      <svg class="bug-status-icon bug-status-icon-open" aria-label="Open bug" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke-width="2">
20        <circle cx="8" cy="8" r="6" />
21      </svg>
22      {{else if eq .Status "closed"}}
23      <svg class="bug-status-icon bug-status-icon-closed" aria-label="Closed bug" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke-width="2">
24        <circle cx="8" cy="8" r="6" />
25        <path d="M5 8 l2 2 l4 -4" stroke-linecap="round" stroke-linejoin="round" />
26      </svg>
27      {{end}}
28      {{end}}
29      <code><a href="/{{$.Repo.Name}}/bug/{{.FullID}}">{{.ID}}</a></code>
30      {{.Title}}
31      {{if .Labels}}{{range $i, $label := .Labels}}{{if $i}} {{end}}<span class="bug-label" style="--label-color: {{$label.Color}}">{{$label.Name}}</span>{{end}}{{end}}
32    </h3>
33     <footer>
34       {{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>
35       {{if gt .CommentCount 0}}
36       • {{.CommentCount}} comments
37       {{end}}
38       {{if .HasActivity}}
39       • Updated <time datetime="{{.LastActivity | rfc3339}}" data-tooltip="{{.LastActivity | formatDate}}">{{.LastActivity | relativeTime}}</time>
40       {{end}}
41     </footer>
42  </article>
43  {{end}}
44
45  {{if or .HasPrevPage .HasNextPage}}
46  <nav aria-label="Pagination">
47    <p>Page {{.Page}} of {{.TotalPages}}</p>
48    <ul>
49      {{if .HasPrevPage}}
50      <li>
51        <a href="/{{.Repo.Name}}/bugs?status={{.Status}}&page={{dec .Page}}" rel="prev"
52          >Previous page</a
53        >
54      </li>
55      {{end}}
56      {{if .HasNextPage}}
57      <li>
58        <a href="/{{.Repo.Name}}/bugs?status={{.Status}}&page={{inc .Page}}" rel="next"
59          >Next page</a
60        >
61      </li>
62      {{end}}
63    </ul>
64  </nav>
65  {{end}}
66  {{else}}
67  {{if eq .Status "all"}}
68  <p>git-bug is initialised, but this repo has no bugs.</p>
69  {{else if eq .Status "open"}}
70  <p>No open bugs.</p>
71  {{else if eq .Status "closed"}}
72  <p>No closed bugs.</p>
73  {{end}}
74  {{end}}
75</section>
76{{end}}