~gitpocket/gitpocket

gitpocket/templates/admin.html -rw-r--r--3.3 KiB ViewLogBlameView rawPermalink c7656bd906 feat(admin): add registration modes, admin page, user created organisations and repo redirects an hour ago
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
{{define "content"}}
{{$d := .Data}}
<h3 class="rule">Registration</h3>
<form method="post" action="/admin" class="stack wide modes">
<input type="hidden" name="action" value="registration">
<label class="radio"><input type="radio" name="mode" value="open"{{if eq $d.Registration "open"}} checked{{end}}> Open<small>Anyone can create an account, a few per address every few minutes</small></label>
<label class="radio"><input type="radio" name="mode" value="invite"{{if eq $d.Registration "invite"}} checked{{end}}> Invite only<small>Registration needs a single use code from the list below</small></label>
<label class="radio"><input type="radio" name="mode" value="closed"{{if eq $d.Registration "closed"}} checked{{end}}> Closed<small>Nobody can register; accounts are created with <code>gitpocket user</code></small></label>
<div class="actions left"><button class="btn primary">Save ▸</button></div>
</form>
<h3 class="rule" id="invites">Invites</h3>
<form method="post" action="/admin" class="inline"><input type="hidden" name="action" value="invite"><button class="btn">Create invite ▸</button></form>
{{if $d.Invites}}<ul class="codes">{{range $d.Invites}}<li><code>https://{{$.Host}}/register?invite={{.}}</code></li>{{end}}</ul>{{else}}<p class="muted small">No unused invites.</p>{{end}}
<h3 class="rule">Disk quota</h3>
<form method="post" action="/admin" class="inline"><input type="hidden" name="action" value="quota"><input name="quota" value="{{$d.Quota}}" aria-label="Quota per owner"> <button class="btn">Set ▸</button></form>
<p class="muted small">Per owner, for example 500M or 2G. Zero disables the quota. Pushes beyond it are refused before any data is written.</p>
<h3 class="rule" id="featured">Featured projects</h3>
<table class="admintable"><tbody>{{range $d.Public}}<tr><td><a href="/{{.Path}}">{{.Path}}</a></td><td><form method="post" action="/admin" class="inline"><input type="hidden" name="action" value="feature"><input type="hidden" name="name" value="{{.Owner.Name}}/{{.Name}}"><input name="rank" type="number" min="0" max="99" value="{{index $d.Ranks .ID}}" aria-label="Position"> <button class="btn small">Set</button></form></td></tr>{{end}}</tbody></table>
<p class="muted small">Position 1 comes first on the front page and 0 removes a project. With none chosen the most recently pushed are shown.</p>
<h3 class="rule" id="accounts">Accounts</h3>
<table class="admintable"><thead><tr><th>Name</th><th>Joined</th><th>Repos</th><th></th></tr></thead><tbody>{{range $d.Accounts}}<tr><td><a href="/~{{.Name}}">~{{.Name}}</a>{{if .Org}} <span class="muted">org</span>{{end}}{{if .Admin}} <span class="muted">admin</span>{{end}}{{if .Banned}} <span class="muted">banned</span>{{end}}</td><td>{{.Created.Format "2006-01-02"}}</td><td>{{.Repos}}</td><td class="acts">{{if ne .Name $.User.Name}}<form method="post" action="/admin" class="inline"><input type="hidden" name="name" value="{{.Name}}">{{if .Banned}}<button class="btn small" name="action" value="unban">Unban</button>{{else}}<button class="btn small danger" name="action" value="ban">Ban</button>{{end}}{{if not .Org}}{{if .Admin}}<button class="btn small" name="action" value="unadmin">Revoke admin</button>{{else}}<button class="btn small" name="action" value="admin">Make admin</button>{{end}}{{end}}</form>{{end}}</td></tr>{{end}}</tbody></table>
{{end}}