internal/web/templates/labels.html

545ba0bcdea3b534903bd78c918c0c025a97eda7
gitbay/internal/web/templates/labels.html

46 lines · 2887 bytes

 1{{define "title"}}labels · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}}
 2{{define "content"}}
 3<div class="pagehead">
 4  <h1>Labels <span class="chip">{{len .Labels}}</span></h1>
 5  <span class="grow"></span>
 6  {{if .Labels}}<input type="search" class="tablefilter" placeholder="Filter labels…" aria-label="Filter labels" data-filter-table="labels-table">{{end}}
 7</div>
 8{{if .Notice}}<p class="error" role="alert">{{.Notice}}</p>{{end}}
 9<section class="setcard">
10{{if .Labels}}<div class="tablewrap"><table class="keys" id="labels-table">
11<thead><tr class="cols"><th scope="col">label</th>{{if or $.CanWrite $.AnyColor}}<th scope="col">colour</th>{{end}}<th scope="col">issues</th><th scope="col">merge requests</th><th scope="col"><span class="vh">actions</span></th></tr></thead>
12<tbody>{{range .Labels}}<tr>
13  <td><a class="chip label" style="{{index $.LabelColors .Name}}" href="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/issues?label={{.Name}}">{{.Name}}</a>{{if .Org}} <span class="chip chip-neutral">org</span>{{end}}</td>
14  {{if or $.CanWrite $.AnyColor}}<td>{{if and $.CanWrite (not .Org)}}<form method="post" action="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/labels" class="inline">
15    <input type="hidden" name="name" value="{{.Name}}">
16    <input type="text" name="color" value="{{.Color}}" aria-label="Colour for {{.Name}}" placeholder="rrggbb" size="8">
17    <button type="submit" class="btn">Save</button>
18  </form>{{else}}<span class="mono">{{if .Color}}{{.Color}}{{else}}—{{end}}</span>{{end}}</td>{{end}}
19  <td>{{.Issues}}</td>
20  <td>{{.MRs}}</td>
21  <td class="act">{{if and $.CanWrite (not .Org)}}<details class="popover"><summary class="popbtn popbtn-danger">Remove</summary><div class="popmenu">
22    <form method="post" action="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/labels" class="popform popform-stack">
23      <input type="hidden" name="action" value="remove">
24      <input type="hidden" name="name" value="{{.Name}}">
25      {{template "confirmfield" .Name}}
26      <button type="submit" class="danger">Remove</button>
27    </form>
28  </div></details>{{else if .Org}}<a href="/{{$.Repo.OwnerName}}/-/labels">org</a>{{end}}</td>
29</tr>
30{{end}}</tbody></table></div>
31{{else}}<p class="none">No labels yet.</p>{{end}}
32{{if .CanWrite}}
33<details class="editbox">
34  <summary>New label</summary>
35  <form method="post" action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/labels" class="setform stack">
36    <label for="labelname">Name</label>
37    <input type="text" id="labelname" name="name" maxlength="50" required>
38    <label for="labelcolor">Colour</label>
39    <input type="text" id="labelcolor" name="color" placeholder="rrggbb, or blank for one picked from the name">
40    <span class="btngroup"><button type="submit">Create label</button></span>
41  </form>
42</details>
43<p class="meta">Removing a label takes it off every issue and merge request that carries it.</p>
44{{end}}
45</section>
46{{end}}