internal/web/templates/issue.html

103 lines · 6934 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  <div class="grp">
 47    <div class="grp-head">
 48      <h2>Labels</h2>
 49      {{if .CanWrite}}<details class="popover"><summary class="popbtn">Edit</summary><div class="popmenu">
 50        {{with field . "AllLabels"}}<div class="picker-list">{{range .}}<form method="post" action="{{$base}}/label" class="inline">{{if hasStr $.Issue.Labels .Name}}<input type="hidden" name="remove" value="{{.Name}}"><button type="submit" class="picker-btn" aria-pressed="true">{{.Name}} ×</button>{{else}}<input type="hidden" name="add" value="{{.Name}}"><button type="submit" class="picker-btn" aria-pressed="false">{{.Name}}</button>{{end}}</form>{{end}}</div>
 51        <datalist id="repo-labels">{{range .}}<option value="{{.Name}}"></option>{{end}}</datalist>{{end}}
 52        <form method="post" action="{{$base}}/label" class="popform">
 53          <input type="text" name="add" aria-label="Add labels" list="repo-labels" autocomplete="off" spellcheck="false" placeholder="Add label…">
 54          <button type="submit" class="btn">Add</button>
 55        </form>
 56      </div></details>{{end}}
 57    </div>
 58    {{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>
 59    {{else}}<p class="none">None</p>{{end}}
 60  </div>
 61  <div class="grp">
 62    <div class="grp-head">
 63      <h2>Assignees</h2>
 64      {{if .CanWrite}}<details class="popover"><summary class="popbtn">Edit</summary><div class="popmenu">
 65        {{with field . "People"}}<div class="picker-list">{{range .}}<form method="post" action="{{$base}}/assign" class="inline">{{if hasStr $.Issue.Assignees .}}<input type="hidden" name="remove" value="{{.}}"><button type="submit" class="picker-btn" aria-pressed="true">{{.}} ×</button>{{else}}<input type="hidden" name="add" value="{{.}}"><button type="submit" class="picker-btn" aria-pressed="false">{{.}}</button>{{end}}</form>{{end}}</div>
 66        <datalist id="repo-people">{{range .}}<option value="{{.}}"></option>{{end}}</datalist>{{end}}
 67        <form method="post" action="{{$base}}/assign" class="popform">
 68          <input type="text" name="add" aria-label="Add assignees" list="repo-people" autocomplete="off" spellcheck="false" placeholder="Add username…">
 69          <button type="submit" class="btn">Add</button>
 70        </form>
 71      </div></details>{{end}}
 72    </div>
 73    {{if .Issue.Assignees}}<p class="row">{{range .Issue.Assignees}}<a href="/{{.}}">{{.}}</a> {{end}}</p>
 74    {{else}}<p class="none">Unassigned</p>{{end}}
 75  </div>
 76  <div class="grp">
 77    <div class="grp-head">
 78      <h2>Milestone</h2>
 79      {{if .CanWrite}}<details class="popover"><summary class="popbtn">Edit</summary><div class="popmenu">
 80        <form method="post" action="{{$base}}/milestone" class="popform">
 81          <label class="vh" for="milestone">Set milestone</label>
 82          <select id="milestone" name="milestone">
 83            <option value="none">No milestone</option>
 84            {{range .Milestones}}<option value="{{.Title}}"{{if eq .Title $.Issue.Milestone}} selected{{end}}>{{.Title}}</option>{{end}}
 85          </select>
 86          <button type="submit" class="btn">Save</button>
 87        </form>
 88      </div></details>{{end}}
 89    </div>
 90    {{if .Issue.Milestone}}<p class="row"><a href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/milestones">{{.Issue.Milestone}}</a></p>
 91    {{else}}<p class="none">None</p>{{end}}
 92  </div>
 93  {{if .CanEdit}}
 94  <div class="grp">
 95    <form method="post" action="{{$base}}/state" class="actions">
 96      {{if eq .Issue.State "open"}}<button type="submit" name="action" value="close" class="btn">Close issue</button>
 97      {{else}}<button type="submit" name="action" value="reopen" class="btn">Reopen issue</button>{{end}}
 98    </form>
 99  </div>
100  {{end}}
101</aside>
102</div>
103{{end}}