internal/web/templates/issue.html
94 lines · 5408 bytes
1{{define "title"}}#{{.Issue.Number}} · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}}
2{{define "content"}}
3<h1 class="issuetitle">{{.Issue.Title}} <span class="issuenumber">#{{.Issue.Number}}</span></h1>
4<p class="issuemeta"><span class="chip {{if eq .Issue.State "open"}}chip-open{{else}}chip-done{{end}}">{{.Issue.State}}</span>
5<a href="/{{.Issue.Author}}">{{.Issue.Author}}</a> opened this on {{when .Issue.CreatedAt}}
6{{if .Issue.Labels}} · {{range .Issue.Labels}}<a class="chip label" style="{{index $.LabelColors .}}" href="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/issues?label={{.}}">{{.}}</a> {{end}}{{end}}
7{{if .Issue.Assignees}} · assigned to {{range .Issue.Assignees}}{{.}} {{end}}{{end}}
8{{if .Issue.Milestone}} · milestone <a href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/milestones">{{.Issue.Milestone}}</a>{{end}}</p>
9{{if .Notice}}<p class="error" role="alert">{{.Notice}}</p>{{end}}
10
11<div class="withaside">
12<div class="mainside">
13<h2>Discussion</h2>
14{{if .CanEdit}}<details class="editbox"{{if .Draft.Is "edit"}} open{{end}}><summary>edit</summary>
15{{if .Draft.Is "edit"}}{{template "previewblock" .Draft.HTML}}{{end}}
16<form method="post" action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/issues/{{.Issue.Number}}/edit" class="commentform">
17<p><input type="text" name="title" aria-label="Title" value="{{.Draft.Or "edit" "title" .Issue.Title}}" required></p>
18<p><textarea name="body" aria-label="Description" rows="8">{{.Draft.Or "edit" "body" .Issue.Body}}</textarea></p>
19<p><input type="text" name="labels" aria-label="Labels" value="{{$.Draft.Or "edit" "labels" (join .Issue.Labels " ")}}" placeholder="labels, space-separated (write access)"></p>
20<p><button type="submit" class="btn">Save</button> {{template "previewbtn"}}</p>
21</form></details>{{end}}
22{{if .BodyHTML}}<article class="comment">
23 <header class="commenthead"><strong><a href="/{{.Issue.Author}}">{{.Issue.Author}}</a></strong> <span class="when">{{when .Issue.CreatedAt}}</span></header>
24 <div class="rendered">{{.BodyHTML}}</div>
25</article>{{end}}
26{{range .Comments}}
27{{if eq .Kind "system"}}<div class="syscomment">{{.BodyHTML}} <span class="when">{{when .CreatedAt}}</span></div>
28{{else}}<article class="comment">
29 <header class="commenthead"><strong><a href="/{{.Author}}">{{.Author}}</a></strong> <span class="when">{{when .CreatedAt}}</span></header>
30 <div class="rendered">{{.BodyHTML}}</div>
31</article>{{end}}
32{{end}}
33{{if .Viewer}}
34{{if .Draft.Is "comment"}}{{template "previewblock" .Draft.HTML}}{{end}}
35<form method="post" action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/issues/{{.Issue.Number}}/comment" class="commentform">
36<p><textarea name="body" aria-label="Comment" rows="4" placeholder="Comment as {{.Viewer}}">{{.Draft.Or "comment" "body" ""}}</textarea></p>
37<p><button type="submit">Comment</button> {{template "previewbtn"}}</p>
38</form>
39{{end}}
40</div>
41
42{{$base := printf "/%s/%s/issues/%d" .Repo.OwnerName .Repo.Name .Issue.Number}}
43<aside class="aside">
44 {{if .CanWrite}}
45 <div class="grp">
46 <h2>State</h2>
47 <form method="post" action="{{$base}}/state" class="actions">
48 {{if eq .Issue.State "open"}}<button type="submit" name="action" value="close">Close issue</button>
49 {{else}}<button type="submit" name="action" value="reopen">Reopen issue</button>{{end}}
50 </form>
51 </div>
52 {{end}}
53 <div class="grp">
54 <h2>Labels</h2>
55 {{if .Issue.Labels}}<p class="row">{{range .Issue.Labels}}<a class="chip label" style="{{index $.LabelColors .}}" href="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/issues?label={{.}}">{{.}}</a> {{end}}</p>
56 {{else}}<p class="none">none yet</p>{{end}}
57 {{if .CanWrite}}
58 <form method="post" action="{{$base}}/label" class="actions">
59 <input type="text" name="add" aria-label="Add labels" autocomplete="off" spellcheck="false" placeholder="add, space-separated">
60 <input type="text" name="remove" aria-label="Remove labels" autocomplete="off" spellcheck="false" placeholder="remove">
61 <button type="submit" class="btn">Apply</button>
62 </form>
63 {{end}}
64 </div>
65 <div class="grp">
66 <h2>Assignees</h2>
67 {{if .Issue.Assignees}}<p class="row">{{range .Issue.Assignees}}<a href="/{{.}}">{{.}}</a> {{end}}</p>
68 {{else}}<p class="none">nobody yet</p>{{end}}
69 {{if .CanWrite}}
70 <form method="post" action="{{$base}}/assign" class="actions">
71 <input type="text" name="add" aria-label="Add assignees" autocomplete="off" spellcheck="false" placeholder="add, space-separated">
72 <input type="text" name="remove" aria-label="Remove assignees" autocomplete="off" spellcheck="false" placeholder="remove">
73 <button type="submit" class="btn">Apply</button>
74 </form>
75 {{end}}
76 </div>
77 <div class="grp">
78 <h2>Milestone</h2>
79 {{if .Issue.Milestone}}<p class="row"><a href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/milestones">{{.Issue.Milestone}}</a></p>
80 {{else}}<p class="none">none yet</p>{{end}}
81 {{if .CanWrite}}
82 <form method="post" action="{{$base}}/milestone" class="actions">
83 <label class="none" for="milestone">Set milestone</label>
84 <select id="milestone" name="milestone">
85 <option value="none">No milestone</option>
86 {{range .Milestones}}<option value="{{.Title}}"{{if eq .Title $.Issue.Milestone}} selected{{end}}>{{.Title}}</option>{{end}}
87 </select>
88 <button type="submit" class="btn">Apply</button>
89 </form>
90 {{end}}
91 </div>
92</aside>
93</div>
94{{end}}