internal/web/templates/issue.html

20b06b791bf4bdd23b633bbfde819d5d8564751a
gitbay/internal/web/templates/issue.html history · blame · raw

91 lines · 4880 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{{if .CanEdit}}<details class="editbox"><summary>edit</summary>
14<form method="post" action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/issues/{{.Issue.Number}}/edit" class="commentform">
15<p><input type="text" name="title" aria-label="Title" value="{{.Issue.Title}}" required></p>
16<p><textarea name="body" aria-label="Description" rows="8">{{.Issue.Body}}</textarea></p>
17<p><input type="text" name="labels" aria-label="Labels" value="{{range $i, $l := .Issue.Labels}}{{if $i}} {{end}}{{$l}}{{end}}" placeholder="labels, space-separated (write access)"></p>
18<p><button type="submit">save</button></p>
19</form></details>{{end}}
20{{if .BodyHTML}}<article class="comment">
21  <header class="commenthead"><strong><a href="/{{.Issue.Author}}">{{.Issue.Author}}</a></strong> <span class="when">{{when .Issue.CreatedAt}}</span></header>
22  <div class="rendered">{{.BodyHTML}}</div>
23</article>{{end}}
24{{range .Comments}}
25{{if eq .Kind "system"}}<div class="syscomment">{{.BodyHTML}} <span class="when">{{when .CreatedAt}}</span></div>
26{{else}}<article class="comment">
27  <header class="commenthead"><strong><a href="/{{.Author}}">{{.Author}}</a></strong> <span class="when">{{when .CreatedAt}}</span></header>
28  <div class="rendered">{{.BodyHTML}}</div>
29</article>{{end}}
30{{end}}
31{{if .Viewer}}
32<form method="post" action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/issues/{{.Issue.Number}}/comment" class="commentform">
33<p><textarea name="body" aria-label="Comment" rows="4" placeholder="Comment as {{.Viewer}}"></textarea></p>
34<p><button type="submit">comment</button></p>
35</form>
36{{end}}
37</div>
38
39{{$base := printf "/%s/%s/issues/%d" .Repo.OwnerName .Repo.Name .Issue.Number}}
40<aside class="aside">
41  {{if .CanWrite}}
42  <div class="grp">
43    <h2>State</h2>
44    <form method="post" action="{{$base}}/state" class="actions">
45      {{if eq .Issue.State "open"}}<button type="submit" name="action" value="close">Close issue</button>
46      {{else}}<button type="submit" name="action" value="reopen">Reopen issue</button>{{end}}
47    </form>
48  </div>
49  {{end}}
50  <div class="grp">
51    <h2>Labels</h2>
52    {{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>
53    {{else}}<p class="none">None yet</p>{{end}}
54    {{if .CanWrite}}
55    <form method="post" action="{{$base}}/label" class="actions">
56      <input type="text" name="add" aria-label="Add labels" placeholder="add, space-separated">
57      <input type="text" name="remove" aria-label="Remove labels" placeholder="remove">
58      <button type="submit">Apply</button>
59    </form>
60    {{end}}
61  </div>
62  <div class="grp">
63    <h2>Assignees</h2>
64    {{if .Issue.Assignees}}<p class="row">{{range .Issue.Assignees}}<a href="/{{.}}">{{.}}</a> {{end}}</p>
65    {{else}}<p class="none">Nobody yet</p>{{end}}
66    {{if .CanWrite}}
67    <form method="post" action="{{$base}}/assign" class="actions">
68      <input type="text" name="add" aria-label="Add assignees" placeholder="add, space-separated">
69      <input type="text" name="remove" aria-label="Remove assignees" placeholder="remove">
70      <button type="submit">Apply</button>
71    </form>
72    {{end}}
73  </div>
74  <div class="grp">
75    <h2>Milestone</h2>
76    {{if .Issue.Milestone}}<p class="row"><a href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/milestones">{{.Issue.Milestone}}</a></p>
77    {{else}}<p class="none">None</p>{{end}}
78    {{if .CanWrite}}
79    <form method="post" action="{{$base}}/milestone" class="actions">
80      <label class="none" for="milestone">Set milestone</label>
81      <select id="milestone" name="milestone">
82        <option value="none">No milestone</option>
83        {{range .Milestones}}<option value="{{.Title}}"{{if eq .Title $.Issue.Milestone}} selected{{end}}>{{.Title}}</option>{{end}}
84      </select>
85      <button type="submit">Apply</button>
86    </form>
87    {{end}}
88  </div>
89</aside>
90</div>
91{{end}}