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 id="bug-heading">
12    [{{.ID}}] {{.Title}}
13    <span class="badge badge-{{.Status}}">{{.Status}}</span>
14  </h2>
15  <p>
16    <strong>{{.Author}}</strong> opened this bug on
17    <time datetime="{{.CreatedAt | rfc3339}}">{{.CreatedAt | formatDate}}</time>
18    {{if .Edited}}<em>(edited)</em>{{end}}
19  </p>
20  {{if .Labels}}
21  <div aria-label="Labels">
22    {{range .Labels}}
23    <span class="label" style="background-color: {{.Color}}; color: white; padding: 0.25rem 0.5rem; border-radius: 0.25rem; display: inline-block; margin: 0.25rem;">{{.Name}}</span>
24    {{end}}
25  </div>
26  {{end}}
27</header>
28
29<section aria-labelledby="timeline-heading">
30  <h3 id="timeline-heading" class="visually-hidden">Timeline</h3>
31  
32  {{range .Timeline}}
33  <article id="{{.ID}}" aria-labelledby="timeline-item-{{.ID}}">
34    {{if eq .Type "create"}}
35    <h4 id="timeline-item-{{.ID}}" class="visually-hidden">Initial description</h4>
36    {{if .Message}}
37    <div class="bug-message">
38      {{.Message}}
39    </div>
40    {{else}}
41    <p><em class="muted">No description provided.</em></p>
42    {{end}}
43    
44    {{else if eq .Type "comment"}}
45    <h4 id="timeline-item-{{.ID}}">
46      <strong>{{.Author}}</strong> commented on
47      <time datetime="{{.Timestamp | rfc3339}}">{{.Timestamp | formatDate}}</time>
48      {{if .Edited}}<em>(edited)</em>{{end}}
49    </h4>
50    {{if .Message}}
51    <div class="bug-message">
52      {{.Message}}
53    </div>
54    {{else}}
55    <p><em class="muted">No comment provided.</em></p>
56    {{end}}
57    
58    {{else if eq .Type "title"}}
59    <p id="timeline-item-{{.ID}}">
60      <strong>{{.Author}}</strong> changed the title to <strong>{{.Title}}</strong> on
61      <time datetime="{{.Timestamp | rfc3339}}">{{.Timestamp | formatDate}}</time>
62    </p>
63    
64    {{else if eq .Type "status"}}
65    <p id="timeline-item-{{.ID}}">
66      <strong>{{.Author}}</strong> {{.Status}} the bug on
67      <time datetime="{{.Timestamp | rfc3339}}">{{.Timestamp | formatDate}}</time>
68    </p>
69    
70    {{else if eq .Type "labels"}}
71    <p id="timeline-item-{{.ID}}">
72      <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      on <time datetime="{{.Timestamp | rfc3339}}">{{.Timestamp | formatDate}}</time>
83    </p>
84    {{end}}
85  </article>
86  {{end}}
87</section>
88{{end}}