| 1 | {{ define "page" -}} |
| 2 | <section class="shithub-repo-page"> |
| 3 | {{ template "repo-header" . }} |
| 4 | <section class="shithub-labels"> |
| 5 | <header class="shithub-issues-head"> |
| 6 | <h1> |
| 7 | Labels |
| 8 | </h1> |
| 9 | </header> |
| 10 | |
| 11 | {{ if .CanManageIssue }} |
| 12 | <details class="shithub-label-create"> |
| 13 | <summary class="shithub-button shithub-button-primary">New label</summary> |
| 14 | <form method="post" action="/{{ .Owner }}/{{ .Repo.Name }}/labels" class="shithub-label-form"> |
| 15 | <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}"> |
| 16 | <input type="text" name="name" placeholder="name" maxlength="50" required> |
| 17 | <input type="text" name="color" placeholder="color (6 hex)" maxlength="7" value="d0d7de"> |
| 18 | <input type="text" name="description" placeholder="description (optional)"> |
| 19 | <button type="submit" class="shithub-button">Create</button> |
| 20 | </form> |
| 21 | </details> |
| 22 | {{ end }} |
| 23 | |
| 24 | <ul class="shithub-labels-list"> |
| 25 | {{ range .Labels }} |
| 26 | <li class="shithub-labels-row"> |
| 27 | <span class="shithub-label" style="background-color: #{{ .Color }}">{{ .Name }}</span> |
| 28 | {{ if .Description }}<span class="shithub-muted">{{ .Description }}</span>{{ end }} |
| 29 | {{ if $.CanManageIssue }} |
| 30 | <details class="shithub-label-edit"> |
| 31 | <summary class="shithub-button">Edit</summary> |
| 32 | <form method="post" action="/{{ $.Owner }}/{{ $.Repo.Name }}/labels/{{ .ID }}/update" class="shithub-label-form"> |
| 33 | <input type="hidden" name="csrf_token" value="{{ $.CSRFToken }}"> |
| 34 | <input type="text" name="name" value="{{ .Name }}" required> |
| 35 | <input type="text" name="color" value="{{ .Color }}" required> |
| 36 | <input type="text" name="description" value="{{ .Description }}"> |
| 37 | <button type="submit" class="shithub-button">Save</button> |
| 38 | </form> |
| 39 | <form method="post" action="/{{ $.Owner }}/{{ $.Repo.Name }}/labels/{{ .ID }}/delete"> |
| 40 | <input type="hidden" name="csrf_token" value="{{ $.CSRFToken }}"> |
| 41 | <button type="submit" class="shithub-button shithub-button-danger">Delete</button> |
| 42 | </form> |
| 43 | </details> |
| 44 | {{ end }} |
| 45 | </li> |
| 46 | {{ end }} |
| 47 | </ul> |
| 48 | </section> |
| 49 | </section> |
| 50 | {{- end }} |