internal/web/templates/issue.html

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

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