| 1 | {{ define "page" -}} |
| 2 | <section class="shithub-org-team"> |
| 3 | <header class="shithub-org-profile-head"> |
| 4 | <h1>{{ .Org.DisplayName }} / {{ .Team.Slug }}</h1> |
| 5 | <p class="shithub-meta"> |
| 6 | <a href="/{{ .Org.Slug }}/teams">← teams</a> |
| 7 | {{ if eq (printf "%s" .Team.Privacy) "secret" }}<span class="shithub-pill shithub-pill-private">secret</span>{{ end }} |
| 8 | </p> |
| 9 | {{ if .Team.Description }}<p>{{ .Team.Description }}</p>{{ end }} |
| 10 | </header> |
| 11 | |
| 12 | {{ if .IsOwner }} |
| 13 | <section class="shithub-org-invite"> |
| 14 | <h2>Add member</h2> |
| 15 | <form method="POST" action="/{{ .Org.Slug }}/teams/{{ .Team.Slug }}/members"> |
| 16 | <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}"> |
| 17 | <label><span>Username</span><input type="text" name="username" required></label> |
| 18 | <label><span>Role</span> |
| 19 | <select name="role"> |
| 20 | <option value="member" selected>Member</option> |
| 21 | <option value="maintainer">Maintainer</option> |
| 22 | </select> |
| 23 | </label> |
| 24 | <button type="submit" class="shithub-button shithub-button-primary">Add</button> |
| 25 | </form> |
| 26 | |
| 27 | <h2>Grant repo access</h2> |
| 28 | <form method="POST" action="/{{ .Org.Slug }}/teams/{{ .Team.Slug }}/repos"> |
| 29 | <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}"> |
| 30 | <label><span>Repo ID</span><input type="number" name="repo_id" required min="1"></label> |
| 31 | <label><span>Role</span> |
| 32 | <select name="role"> |
| 33 | <option value="read">Read</option> |
| 34 | <option value="triage">Triage</option> |
| 35 | <option value="write" selected>Write</option> |
| 36 | <option value="maintain">Maintain</option> |
| 37 | <option value="admin">Admin</option> |
| 38 | </select> |
| 39 | </label> |
| 40 | <button type="submit" class="shithub-button shithub-button-primary">Grant</button> |
| 41 | </form> |
| 42 | </section> |
| 43 | {{ end }} |
| 44 | |
| 45 | <section class="shithub-org-members"> |
| 46 | <h2>Members ({{ len .Members }})</h2> |
| 47 | <table class="shithub-table"> |
| 48 | <thead><tr><th>User</th><th>Team role</th><th>Joined</th>{{ if .IsOwner }}<th></th>{{ end }}</tr></thead> |
| 49 | <tbody> |
| 50 | {{ range .Members }} |
| 51 | <tr> |
| 52 | <td><a href="/{{ .Username }}">@{{ .Username }}</a></td> |
| 53 | <td>{{ .Role }}</td> |
| 54 | <td>{{ relativeTime .AddedAt.Time }}</td> |
| 55 | {{ if $.IsOwner }} |
| 56 | <td> |
| 57 | <form method="POST" action="/{{ $.Org.Slug }}/teams/{{ $.Team.Slug }}/members" style="display:inline"> |
| 58 | <input type="hidden" name="csrf_token" value="{{ $.CSRFToken }}"> |
| 59 | <input type="hidden" name="username" value="{{ .Username }}"> |
| 60 | <input type="hidden" name="action" value="remove"> |
| 61 | <button type="submit" class="shithub-button">Remove</button> |
| 62 | </form> |
| 63 | </td> |
| 64 | {{ end }} |
| 65 | </tr> |
| 66 | {{ end }} |
| 67 | </tbody> |
| 68 | </table> |
| 69 | </section> |
| 70 | |
| 71 | <section class="shithub-org-members"> |
| 72 | <h2>Repo access ({{ len .Repos }})</h2> |
| 73 | {{ if .Repos }} |
| 74 | <table class="shithub-table"> |
| 75 | <thead><tr><th>Repo</th><th>Role</th>{{ if .IsOwner }}<th></th>{{ end }}</tr></thead> |
| 76 | <tbody> |
| 77 | {{ range .Repos }} |
| 78 | <tr> |
| 79 | <td><a href="/{{ $.Org.Slug }}/{{ .RepoName }}">{{ $.Org.Slug }}/{{ .RepoName }}</a> |
| 80 | {{ if eq .Visibility "private" }}<span class="shithub-pill shithub-pill-private">private</span>{{ end }} |
| 81 | </td> |
| 82 | <td>{{ .Role }}</td> |
| 83 | {{ if $.IsOwner }} |
| 84 | <td> |
| 85 | <form method="POST" action="/{{ $.Org.Slug }}/teams/{{ $.Team.Slug }}/repos" style="display:inline"> |
| 86 | <input type="hidden" name="csrf_token" value="{{ $.CSRFToken }}"> |
| 87 | <input type="hidden" name="repo_id" value="{{ .RepoID }}"> |
| 88 | <input type="hidden" name="action" value="remove"> |
| 89 | <button type="submit" class="shithub-button">Revoke</button> |
| 90 | </form> |
| 91 | </td> |
| 92 | {{ end }} |
| 93 | </tr> |
| 94 | {{ end }} |
| 95 | </tbody> |
| 96 | </table> |
| 97 | {{ else }} |
| 98 | <p class="shithub-empty">No repos granted to this team.</p> |
| 99 | {{ end }} |
| 100 | </section> |
| 101 | </section> |
| 102 | {{- end }} |