1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
{{define "content"}}
{{$d := .Data}}
<div class="admin">
<nav class="adminnav" aria-label="Admin sections">
<h3>Admin</h3>
{{range $d.Sections}}<a href="/admin?s={{.Key}}"{{if eq .Key $d.Section}} class="active" aria-current="page"{{end}}>{{.Title}}</a>{{end}}
</nav>
<div class="adminmain">
{{if $d.Saved}}<p class="notice">Saved.</p>{{end}}
{{if eq $d.Section "overview"}}
<h2>Overview</h2>
{{with $d.Stats}}<div class="tiles">
<a class="tile" href="/admin?s=people"><span class="num">{{.Users}}</span><span class="what">users</span>{{if .Banned}}<span class="sub">{{.Banned}} banned</span>{{end}}</a>
<a class="tile" href="/admin?s=people"><span class="num">{{.Orgs}}</span><span class="what">organisations</span></a>
<a class="tile" href="/admin?s=projects"><span class="num">{{.Repos}}</span><span class="what">repositories</span><span class="sub">{{.Private}} private ยท {{.Unlisted}} unlisted</span></a>
<a class="tile" href="/admin?s=storage"><span class="num">{{size $d.Used}}</span><span class="what">on disk</span><span class="sub">{{if $d.Quota}}quota {{$d.QuotaText}} each{{else}}no quota{{end}}</span></a>
</div>{{end}}
<section class="panel">
<div class="panelhead"><h3>Sign up</h3><a href="/admin?s=signup">Change</a></div>
<dl class="status">
<dt>Registration</dt><dd><span class="pill {{$d.Registration}}">{{if eq $d.Registration "open"}}Open to everyone{{else if eq $d.Registration "invite"}}Invite only{{else}}Closed{{end}}</span></dd>
<dt>Email at sign up</dt><dd>{{if eq $d.SignupEmail "off"}}Not asked{{else if eq $d.SignupEmail "optional"}}Optional{{else}}Required{{end}}</dd>
<dt>Outgoing mail</dt><dd>{{if $d.Mail}}Configured{{else}}Not configured, resets go through <code>gitpocket passwd</code>{{end}}</dd>
</dl>
</section>
<section class="panel">
<div class="panelhead"><h3>Newest accounts</h3><a href="/admin?s=people">All people</a></div>
<ul class="plainlist">{{range $d.Recent}}<li><a href="/~{{.Name}}">~{{.Name}}</a>{{if .Org}} <span class="pill">org</span>{{end}}{{if .Admin}} <span class="pill">admin</span>{{end}}{{if .Banned}} <span class="pill closed">banned</span>{{end}}<span class="muted">{{ago .Created}}</span></li>{{end}}</ul>
</section>
{{end}}
{{if eq $d.Section "people"}}
<h2>People</h2>
<form method="get" action="/admin" class="filter"><input type="hidden" name="s" value="people"><input name="q" value="{{$d.Query}}" placeholder="Filter by name" aria-label="Filter by name"> <button class="btn">Filter</button>{{if $d.Query}} <a href="/admin?s=people">Clear</a>{{end}}</form>
<div class="tablewrap"><table class="admintable">
<thead><tr><th>Account</th><th>Joined</th><th class="n">Repos</th><th></th></tr></thead>
<tbody>{{range $d.Accounts}}<tr>
<td><a href="/~{{.Name}}">~{{.Name}}</a>{{if .Org}} <span class="pill">org</span>{{end}}{{if .Admin}} <span class="pill">admin</span>{{end}}{{if .Banned}} <span class="pill closed">banned</span>{{end}}</td>
<td>{{.Created.Format "2 Jan 2006"}}</td>
<td class="n">{{.Repos}}</td>
<td class="acts">{{if ne .Name $.User.Name}}<form method="post" action="/admin"><input type="hidden" name="s" value="people"><input type="hidden" name="q" value="{{$d.Query}}"><input type="hidden" name="name" value="{{.Name}}">{{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}}{{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}}</form>{{else}}<span class="muted small">you</span>{{end}}</td>
</tr>{{else}}<tr><td colspan="4" class="muted">Nobody matches.</td></tr>{{end}}</tbody>
</table></div>
{{end}}
{{if eq $d.Section "signup"}}
<h2>Sign up</h2>
<form method="post" action="/admin" class="panel">
<input type="hidden" name="action" value="signup"><input type="hidden" name="s" value="signup">
<fieldset class="choices"><legend>Who can register</legend>
<label class="choice"><input type="radio" name="mode" value="open"{{if eq $d.Registration "open"}} checked{{end}}><span><b>Open</b><small>Anyone can create an account, a few per address every few minutes</small></span></label>
<label class="choice"><input type="radio" name="mode" value="invite"{{if eq $d.Registration "invite"}} checked{{end}}><span><b>Invite only</b><small>Registration needs a single use code from below</small></span></label>
<label class="choice"><input type="radio" name="mode" value="closed"{{if eq $d.Registration "closed"}} checked{{end}}><span><b>Closed</b><small>Nobody can register, accounts come from <code>gitpocket user</code></small></span></label>
</fieldset>
<fieldset class="choices"><legend>Email address at sign up</legend>
<label class="choice"><input type="radio" name="email" value="off"{{if eq $d.SignupEmail "off"}} checked{{end}}><span><b>Don't ask</b><small>A name and password is all it takes</small></span></label>
<label class="choice"><input type="radio" name="email" value="optional"{{if eq $d.SignupEmail "optional"}} checked{{end}}><span><b>Optional</b><small>Shown on the form but can be left empty</small></span></label>
<label class="choice"><input type="radio" name="email" value="required"{{if eq $d.SignupEmail "required"}} checked{{end}}><span><b>Required</b><small>Nobody registers without one</small></span></label>
<p class="muted small">{{if $d.Mail}}Outgoing mail is configured, so given addresses get a confirmation link and can reset passwords.{{else}}Outgoing mail is not configured, so addresses are stored but never confirmed and nothing is sent.{{end}}</p>
</fieldset>
<div class="actions left"><button class="btn primary">Save</button></div>
</form>
<section class="panel">
<div class="panelhead"><h3>Invites</h3><form method="post" action="/admin"><input type="hidden" name="s" value="signup"><button class="btn" name="action" value="invite">New invite</button></form></div>
{{if $d.Invites}}<ul class="invites">{{range $d.Invites}}<li><input readonly value="https://{{$.Host}}/register?invite={{.}}" aria-label="Invite link"><form method="post" action="/admin"><input type="hidden" name="s" value="signup"><input type="hidden" name="code" value="{{.}}"><button class="btn small danger" name="action" value="revoke">Revoke</button></form></li>{{end}}</ul>{{else}}<p class="muted">No unused invites.</p>{{end}}
</section>
{{end}}
{{if eq $d.Section "projects"}}
<h2>Front page</h2>
<p class="muted">Numbered projects appear on the logged out front page in that order. Leave a project at 0 to hide it. With none chosen the most recently pushed are shown.</p>
<div class="tablewrap"><table class="admintable">
<thead><tr><th>Repository</th><th>Description</th><th>Position</th></tr></thead>
<tbody>{{range $d.Public}}{{$rank := index $d.Ranks .ID}}<tr{{if $rank}} class="featuredrow"{{end}}>
<td><a href="/{{.Path}}">{{.Path}}</a></td>
<td class="muted">{{.Description}}</td>
<td><form method="post" action="/admin" class="rankform"><input type="hidden" name="s" value="projects"><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="{{$rank}}" aria-label="Position for {{.Path}}"><button class="btn small">Set</button></form></td>
</tr>{{end}}</tbody>
</table></div>
{{end}}
{{if eq $d.Section "storage"}}
<h2>Storage</h2>
<form method="post" action="/admin" class="panel quotaform">
<input type="hidden" name="s" value="storage"><input type="hidden" name="action" value="quota">
<label>Quota per owner <input name="quota" value="{{$d.QuotaText}}" placeholder="0"></label>
<button class="btn primary">Save</button>
<p class="muted small">For example 500M or 2G, and 0 for no limit. A push that would go over it is refused before anything is written.</p>
</form>
<section class="panel">
<div class="panelhead"><h3>Usage by owner</h3></div>
<ul class="usage">{{range $d.Owners}}<li><a href="/~{{.Name}}">~{{.Name}}</a><span class="bar"><i style="width:{{.Pct}}%"></i></span><span class="muted">{{size .Used}}{{if $d.Quota}} of {{$d.QuotaText}}{{end}}</span></li>{{else}}<li class="muted">No repositories yet.</li>{{end}}</ul>
</section>
{{end}}
</div>
</div>
{{end}}
|