internal/web/templates/issue.html
96 lines · 5554 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 {{template "reactions" index .Reactions 0}}
26</article>{{else}}{{template "reactions" index .Reactions 0}}{{end}}
27{{range .Comments}}
28{{if eq .Kind "system"}}<div class="syscomment">{{.BodyHTML}} <span class="when">{{when .CreatedAt}}</span></div>
29{{else}}<article class="comment">
30 <header class="commenthead"><strong><a href="/{{.Author}}">{{.Author}}</a></strong> <span class="when">{{when .CreatedAt}}</span></header>
31 <div class="rendered">{{.BodyHTML}}</div>
32 {{template "reactions" index $.Reactions .ID}}
33</article>{{end}}
34{{end}}
35{{if .Viewer}}
36{{if .Draft.Is "comment"}}{{template "previewblock" .Draft.HTML}}{{end}}
37<form method="post" action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/issues/{{.Issue.Number}}/comment" class="commentform">
38<p><textarea name="body" aria-label="Comment" rows="4" placeholder="Comment as {{.Viewer}}">{{.Draft.Or "comment" "body" ""}}</textarea></p>
39<p><button type="submit">Comment</button> {{template "previewbtn"}}</p>
40</form>
41{{end}}
42</div>
43
44{{$base := printf "/%s/%s/issues/%d" .Repo.OwnerName .Repo.Name .Issue.Number}}
45<aside class="aside">
46 {{if .CanWrite}}
47 <div class="grp">
48 <h2>State</h2>
49 <form method="post" action="{{$base}}/state" class="actions">
50 {{if eq .Issue.State "open"}}<button type="submit" name="action" value="close">Close issue</button>
51 {{else}}<button type="submit" name="action" value="reopen">Reopen issue</button>{{end}}
52 </form>
53 </div>
54 {{end}}
55 <div class="grp">
56 <h2>Labels</h2>
57 {{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>
58 {{else}}<p class="none">none yet</p>{{end}}
59 {{if .CanWrite}}
60 <form method="post" action="{{$base}}/label" class="actions">
61 <input type="text" name="add" aria-label="Add labels" autocomplete="off" spellcheck="false" placeholder="add, space-separated">
62 <input type="text" name="remove" aria-label="Remove labels" autocomplete="off" spellcheck="false" placeholder="remove">
63 <button type="submit" class="btn">Apply</button>
64 </form>
65 {{end}}
66 </div>
67 <div class="grp">
68 <h2>Assignees</h2>
69 {{if .Issue.Assignees}}<p class="row">{{range .Issue.Assignees}}<a href="/{{.}}">{{.}}</a> {{end}}</p>
70 {{else}}<p class="none">nobody yet</p>{{end}}
71 {{if .CanWrite}}
72 <form method="post" action="{{$base}}/assign" class="actions">
73 <input type="text" name="add" aria-label="Add assignees" autocomplete="off" spellcheck="false" placeholder="add, space-separated">
74 <input type="text" name="remove" aria-label="Remove assignees" autocomplete="off" spellcheck="false" placeholder="remove">
75 <button type="submit" class="btn">Apply</button>
76 </form>
77 {{end}}
78 </div>
79 <div class="grp">
80 <h2>Milestone</h2>
81 {{if .Issue.Milestone}}<p class="row"><a href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/milestones">{{.Issue.Milestone}}</a></p>
82 {{else}}<p class="none">none yet</p>{{end}}
83 {{if .CanWrite}}
84 <form method="post" action="{{$base}}/milestone" class="actions">
85 <label class="none" for="milestone">Set milestone</label>
86 <select id="milestone" name="milestone">
87 <option value="none">No milestone</option>
88 {{range .Milestones}}<option value="{{.Title}}"{{if eq .Title $.Issue.Milestone}} selected{{end}}>{{.Title}}</option>{{end}}
89 </select>
90 <button type="submit" class="btn">Apply</button>
91 </form>
92 {{end}}
93 </div>
94</aside>
95</div>
96{{end}}