internal/web/templates/labels.html

8dcfa45a8ac03a5ff9c36828274d05acadcf846c
gitbay/internal/web/templates/labels.html history · blame · raw

38 lines · 2376 bytes

 1{{define "title"}}labels · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}}
 2{{define "content"}}
 3<h1>Labels</h1>
 4{{if .Notice}}<p class="error" role="alert">{{.Notice}}</p>{{end}}
 5{{if .Labels}}<div class="tablewrap"><table class="keys">
 6<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>
 7{{range .Labels}}<tr>
 8  <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>
 9  {{if or $.CanWrite $.AnyColor}}<td>{{if and $.CanWrite (not .Org)}}<form method="post" action="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/labels" class="inline">
10    <input type="hidden" name="name" value="{{.Name}}">
11    <input type="text" name="color" value="{{.Color}}" aria-label="Colour for {{.Name}}" placeholder="rrggbb" size="8">
12    <button type="submit" class="btn">Save</button>
13  </form>{{else}}<span class="mono">{{if .Color}}{{.Color}}{{else}}—{{end}}</span>{{end}}</td>{{end}}
14  <td>{{.Issues}}</td>
15  <td>{{.MRs}}</td>
16  <td class="act">{{if and $.CanWrite (not .Org)}}<form method="post" action="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/labels" class="inline">
17    <input type="hidden" name="action" value="remove">
18    <input type="hidden" name="name" value="{{.Name}}">
19    {{template "confirmfield" .Name}}
20    <button type="submit" class="danger">Remove</button>
21  </form>{{else if .Org}}<a href="/{{$.Repo.OwnerName}}/-/labels">org</a>{{end}}</td>
22</tr>
23{{end}}</table></div>
24{{else}}<p class="none">No labels yet.</p>{{end}}
25{{if .CanWrite}}
26<details class="editbox">
27  <summary>New label</summary>
28  <form method="post" action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/labels" class="setform stack">
29    <label for="labelname">Name</label>
30    <input type="text" id="labelname" name="name" maxlength="50" required>
31    <label for="labelcolor">Colour</label>
32    <input type="text" id="labelcolor" name="color" placeholder="rrggbb, or blank for one picked from the name">
33    <button type="submit" class="btn">Create label</button>
34  </form>
35</details>
36<p class="meta">Removing a label takes it off every issue and merge request that carries it.</p>
37{{end}}
38{{end}}