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}}<span class="separator"></span>{{.CommentCount}} {{if eq .CommentCount 1}}comment{{else}}comments{{end}}
36        {{- end}}
37        {{- if .HasActivity}}<span class="separator"></span>{{if eq .LastEventAction "closed"}}Closed{{else if eq .LastEventAction "reopened"}}Reopened{{else}}Updated{{end}} <time datetime="{{.LastActivity | rfc3339}}" data-tooltip="{{.LastActivity | formatDate}}">{{.LastActivity | relativeTime}}</time>
38        {{- end}}
39     </footer>
40  </article>
41  {{end}}
42
43  {{if or .HasPrevPage .HasNextPage}}
44  <nav aria-label="Pagination">
45    <p>Page {{.Page}} of {{.TotalPages}}</p>
46    <ul>
47      {{if .HasPrevPage}}
48      <li>
49        <a href="/{{.Repo.Name}}/bugs?status={{.Status}}&page={{dec .Page}}" rel="prev"
50          >Previous page</a
51        >
52      </li>
53      {{end}}
54      {{if .HasNextPage}}
55      <li>
56        <a href="/{{.Repo.Name}}/bugs?status={{.Status}}&page={{inc .Page}}" rel="next"
57          >Next page</a
58        >
59      </li>
60      {{end}}
61    </ul>
62  </nav>
63  {{end}}
64  {{else}}
65  {{if eq .Status "all"}}
66  <p>git-bug is initialised, but this repo has no bugs.</p>
67  {{else if eq .Status "open"}}
68  <p>No open bugs.</p>
69  {{else if eq .Status "closed"}}
70  <p>No closed bugs.</p>
71  {{end}}
72  {{end}}
73</section>
74{{end}}