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    </h3>
32     <footer>
33       Opened <time datetime="{{.CreatedAt | rfc3339}}" data-tooltip="{{.CreatedAt | formatDate}}">{{.CreatedAt | relativeTime}}</time> by {{if .AuthorAvatar}}<img src="{{.AuthorAvatar}}" alt="" class="avatar" loading="lazy" referrerpolicy="no-referrer">{{end}}<strong>{{.Author}}</strong>
34       {{if gt .CommentCount 0}}
35       • {{.CommentCount}} comments
36       {{end}}
37       {{if .HasActivity}}
38       • Updated <time datetime="{{.LastActivity | rfc3339}}" data-tooltip="{{.LastActivity | formatDate}}">{{.LastActivity | relativeTime}}</time>
39       {{end}}
40     </footer>
41  </article>
42  {{end}}
43
44  {{if or .HasPrevPage .HasNextPage}}
45  <nav aria-label="Pagination">
46    <p>Page {{.Page}} of {{.TotalPages}}</p>
47    <ul>
48      {{if .HasPrevPage}}
49      <li>
50        <a href="/{{.Repo.Name}}/bugs?status={{.Status}}&page={{dec .Page}}" rel="prev"
51          >Previous page</a
52        >
53      </li>
54      {{end}}
55      {{if .HasNextPage}}
56      <li>
57        <a href="/{{.Repo.Name}}/bugs?status={{.Status}}&page={{inc .Page}}" rel="next"
58          >Next page</a
59        >
60      </li>
61      {{end}}
62    </ul>
63  </nav>
64  {{end}}
65  {{else}}
66  {{if eq .Status "all"}}
67  <p>git-bug is initialised, but this repo has no bugs.</p>
68  {{else if eq .Status "open"}}
69  <p>No open bugs.</p>
70  {{else if eq .Status "closed"}}
71  <p>No closed bugs.</p>
72  {{end}}
73  {{end}}
74</section>
75{{end}}