internal/web/templates/labels.html
37 lines · 2186 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><th scope="col">colour</th><th scope="col">issues</th><th scope="col"></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 <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>
14 <td>{{.Issues}}</td>
15 <td class="act">{{if and $.CanWrite (not .Org)}}<form method="post" action="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/labels" class="inline">
16 <input type="hidden" name="action" value="remove">
17 <input type="hidden" name="name" value="{{.Name}}">
18 {{template "confirmfield" .Name}}
19 <button type="submit" class="linklike">Remove</button>
20 </form>{{else if .Org}}<a href="/{{$.Repo.OwnerName}}/-/labels">org</a>{{end}}</td>
21</tr>
22{{end}}</table></div>
23{{else}}<p class="none">No labels yet.</p>{{end}}
24{{if .CanWrite}}
25<details class="editbox">
26 <summary>New label</summary>
27 <form method="post" action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/labels" class="setform stack">
28 <label for="labelname">Name</label>
29 <input type="text" id="labelname" name="name" maxlength="50" required>
30 <label for="labelcolor">Colour</label>
31 <input type="text" id="labelcolor" name="color" placeholder="rrggbb, or blank for one picked from the name">
32 <button type="submit">Create label</button>
33 </form>
34</details>
35<p class="meta">Removing a label takes it off every issue that carries it.</p>
36{{end}}
37{{end}}