bug.html

 1{{define "content"}}
 2<nav aria-label="breadcrumb">
 3  <ul>
 4    <li><a href="/{{.Repo.Name}}">{{.Repo.Name}}</a></li>
 5    <li><a href="/{{.Repo.Name}}/bugs">Bugs</a></li>
 6    <li aria-current="page">{{.ID}}</li>
 7  </ul>
 8</nav>
 9
10<header>
11  <h2>
12    {{if eq .Status "open"}}
13    <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">
14      <circle cx="8" cy="8" r="6" />
15    </svg>
16    {{else if eq .Status "closed"}}
17    <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">
18      <circle cx="8" cy="8" r="6" />
19      <path d="M5 8 l2 2 l4 -4" stroke-linecap="round" stroke-linejoin="round" />
20    </svg>
21    {{end}}
22    {{.Subject}}
23  </h2>
24  {{if .Labels}}
25  <p>
26    Labels: {{range $i, $label := .Labels}}{{if $i}} {{end}}<span class="bug-label" style="--label-color: {{$label.Color}}">{{$label.Name}}</span>{{end}}
27  </p>
28  {{end}}
29</header>
30
31<section aria-labelledby="timeline-heading">
32  <h3 id="timeline-heading" class="visually-hidden">Timeline</h3>
33  
34  {{range .Timeline}}
35  {{if eq .Type "create"}}
36  <article id="{{.ID}}">
37    <header>
38      <p>{{if .AuthorAvatar}}<img src="{{.AuthorAvatar}}" alt="" class="avatar avatar-timeline" loading="lazy" referrerpolicy="no-referrer">{{end}}<strong>{{.Author}}</strong> opened <time datetime="{{.Timestamp | rfc3339}}" data-tooltip="{{.Timestamp | formatDate}}">{{.Timestamp | relativeTime}}</time>{{if $.Edited}} <em>(edited)</em>{{end}}</p>
39    </header>
40    {{if .Message}}
41    {{.Message}}
42    {{else}}
43    <em class="muted">No description provided.</em>
44    {{end}}
45  </article>
46  
47  {{else if eq .Type "comment"}}
48  <article id="{{.ID}}">
49    <header>
50      <p>{{if .AuthorAvatar}}<img src="{{.AuthorAvatar}}" alt="" class="avatar avatar-timeline" loading="lazy" referrerpolicy="no-referrer">{{end}}<strong>{{.Author}}</strong> commented <time datetime="{{.Timestamp | rfc3339}}" data-tooltip="{{.Timestamp | formatDate}}">{{.Timestamp | relativeTime}}</time>{{if .Edited}} <em>(edited)</em>{{end}}</p>
51    </header>
52    {{if .Message}}
53    {{.Message}}
54    {{else}}
55    <em class="muted">No comment provided.</em>
56    {{end}}
57  </article>
58  
59  {{else if eq .Type "title"}}
60  <article id="{{.ID}}">
61    <p>{{if .AuthorAvatar}}<img src="{{.AuthorAvatar}}" alt="" class="avatar avatar-timeline" loading="lazy" referrerpolicy="no-referrer">{{end}}<strong>{{.Author}}</strong> changed the title to <strong>{{.Title}}</strong> <time datetime="{{.Timestamp | rfc3339}}" data-tooltip="{{.Timestamp | formatDate}}">{{.Timestamp | relativeTime}}</time></p>
62  </article>
63  
64  {{else if eq .Type "status"}}
65  <article id="{{.ID}}">
66    <p>{{if .AuthorAvatar}}<img src="{{.AuthorAvatar}}" alt="" class="avatar avatar-timeline" loading="lazy" referrerpolicy="no-referrer">{{end}}<strong>{{.Author}}</strong> {{.Status}} the bug <time datetime="{{.Timestamp | rfc3339}}" data-tooltip="{{.Timestamp | formatDate}}">{{.Timestamp | relativeTime}}</time></p>
67  </article>
68  
69  {{else if eq .Type "labels"}}
70  <article id="{{.ID}}">
71    <p>
72      {{if .AuthorAvatar}}<img src="{{.AuthorAvatar}}" alt="" class="avatar avatar-timeline" loading="lazy" referrerpolicy="no-referrer">{{end}}<strong>{{.Author}}</strong>
73      {{if .AddedLabels}}
74      added label{{if gt (len .AddedLabels) 1}}s{{end}}
75      {{range $i, $label := .AddedLabels}}{{if $i}}, {{end}}<code>{{$label}}</code>{{end}}
76      {{end}}
77      {{if and .AddedLabels .RemovedLabels}} and {{end}}
78      {{if .RemovedLabels}}
79      removed label{{if gt (len .RemovedLabels) 1}}s{{end}}
80      {{range $i, $label := .RemovedLabels}}{{if $i}}, {{end}}<code>{{$label}}</code>{{end}}
81      {{end}}
82      <time datetime="{{.Timestamp | rfc3339}}" data-tooltip="{{.Timestamp | formatDate}}">{{.Timestamp | relativeTime}}</time>
83    </p>
84  </article>
85  {{end}}
86  {{end}}
87</section>
88{{end}}