| @@ -1,98 +1,76 @@ |
| 1 | 1 | {{define "content"}} |
| 2 | 2 | {{$d := .Data}} |
| 3 | | -<div class="admin"> |
| 4 | | -<nav class="adminnav" aria-label="Admin sections"> |
| 5 | | -<h3>Admin</h3> |
| 6 | | -{{range $d.Sections}}<a href="/admin?s={{.Key}}"{{if eq .Key $d.Section}} class="active" aria-current="page"{{end}}>{{.Title}}</a>{{end}} |
| 7 | | -</nav> |
| 8 | | -<div class="adminmain"> |
| 3 | +<nav class="tabs small admintabs">{{range $d.Sections}}<a href="/admin?s={{.Key}}"{{if eq .Key $d.Section}} class="active"{{end}}>{{.Title}}</a>{{end}}</nav> |
| 9 | 4 | {{if $d.Saved}}<p class="notice">Saved.</p>{{end}} |
| 10 | 5 | |
| 11 | 6 | {{if eq $d.Section "overview"}} |
| 12 | | -<h2>Overview</h2> |
| 13 | | -{{with $d.Stats}}<div class="tiles"> |
| 14 | | -<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> |
| 15 | | -<a class="tile" href="/admin?s=people"><span class="num">{{.Orgs}}</span><span class="what">organisations</span></a> |
| 16 | | -<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> |
| 17 | | -<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> |
| 18 | | -</div>{{end}} |
| 19 | | -<section class="panel"> |
| 20 | | -<div class="panelhead"><h3>Sign up</h3><a href="/admin?s=signup">Change</a></div> |
| 21 | | -<dl class="status"> |
| 22 | | -<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> |
| 23 | | -<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> |
| 24 | | -<dt>Outgoing mail</dt><dd>{{if $d.Mail}}Configured{{else}}Not configured, resets go through <code>gitpocket passwd</code>{{end}}</dd> |
| 25 | | -</dl> |
| 26 | | -</section> |
| 27 | | -<section class="panel"> |
| 28 | | -<div class="panelhead"><h3>Newest accounts</h3><a href="/admin?s=people">All people</a></div> |
| 29 | | -<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> |
| 30 | | -</section> |
| 7 | +{{with $d.Stats}}<h3 class="rule">Site</h3> |
| 8 | +<table class="keys"> |
| 9 | +<tr><td>Users</td><td>{{.Users}}{{if .Banned}} <span class="muted">({{.Banned}} banned)</span>{{end}}</td></tr> |
| 10 | +<tr><td>Organisations</td><td>{{.Orgs}}</td></tr> |
| 11 | +<tr><td>Repositories</td><td>{{.Repos}} <span class="muted">({{.Private}} private, {{.Unlisted}} unlisted)</span></td></tr> |
| 12 | +<tr><td>Disk usage</td><td>{{size $d.Used}}{{if $d.Quota}} <span class="muted">(quota {{$d.QuotaText}} per owner)</span>{{end}}</td></tr> |
| 13 | +<tr><td>Registration</td><td>{{if eq $d.Registration "open"}}open to everyone{{else if eq $d.Registration "invite"}}invite only{{else}}closed{{end}}, email {{if eq $d.SignupEmail "off"}}not asked{{else}}{{$d.SignupEmail}}{{end}} <a class="muted" href="/admin?s=signup">change</a></td></tr> |
| 14 | +<tr><td>Mail</td><td>{{if $d.Mail}}configured{{else}}not configured, resets go through <code>gitpocket passwd</code>{{end}}</td></tr> |
| 15 | +</table>{{end}} |
| 16 | +<h3 class="rule">Newest accounts</h3> |
| 17 | +<table class="keys">{{range $d.Recent}}<tr><td><a href="/~{{.Name}}">~{{.Name}}</a></td><td class="muted">{{if .Org}}organisation{{else if .Admin}}admin{{end}}{{if .Banned}} banned{{end}}</td><td class="when">{{ago .Created}}</td></tr>{{end}}</table> |
| 31 | 18 | {{end}} |
| 32 | 19 | |
| 33 | 20 | {{if eq $d.Section "people"}} |
| 34 | | -<h2>People</h2> |
| 35 | | -<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> |
| 36 | | -<div class="tablewrap"><table class="admintable"> |
| 37 | | -<thead><tr><th>Account</th><th>Joined</th><th class="n">Repos</th><th></th></tr></thead> |
| 38 | | -<tbody>{{range $d.Accounts}}<tr> |
| 39 | | -<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> |
| 40 | | -<td>{{.Created.Format "2 Jan 2006"}}</td> |
| 41 | | -<td class="n">{{.Repos}}</td> |
| 42 | | -<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> |
| 43 | | -</tr>{{else}}<tr><td colspan="4" class="muted">Nobody matches.</td></tr>{{end}}</tbody> |
| 44 | | -</table></div> |
| 21 | +<h3 class="rule">People</h3> |
| 22 | +<form method="get" action="/admin" class="inline"><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> |
| 23 | +<table class="keys">{{range $d.Accounts}}<tr> |
| 24 | +<td><a href="/~{{.Name}}">~{{.Name}}</a></td> |
| 25 | +<td class="muted">{{if .Org}}organisation{{else if .Admin}}admin{{end}}{{if .Banned}} banned{{end}}</td> |
| 26 | +<td class="muted">{{.Repos}} repos</td> |
| 27 | +<td class="when">joined {{.Created.Format "2 Jan 2006"}}</td> |
| 28 | +<td>{{if ne .Name $.User.Name}}<form method="post" action="/admin" class="inline"><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>{{end}}</td> |
| 29 | +</tr>{{else}}<tr><td class="muted">Nobody matches.</td></tr>{{end}}</table> |
| 45 | 30 | {{end}} |
| 46 | 31 | |
| 47 | 32 | {{if eq $d.Section "signup"}} |
| 48 | | -<h2>Sign up</h2> |
| 49 | | -<form method="post" action="/admin" class="panel"> |
| 33 | +<h3 class="rule">Registration</h3> |
| 34 | +<form method="post" action="/admin" class="stack"> |
| 50 | 35 | <input type="hidden" name="action" value="signup"><input type="hidden" name="s" value="signup"> |
| 51 | | -<fieldset class="choices"><legend>Who can register</legend> |
| 52 | | -<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> |
| 53 | | -<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> |
| 54 | | -<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> |
| 55 | | -</fieldset> |
| 56 | | -<fieldset class="choices"><legend>Email address at sign up</legend> |
| 57 | | -<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> |
| 58 | | -<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> |
| 59 | | -<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> |
| 60 | | -<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> |
| 61 | | -</fieldset> |
| 62 | | -<div class="actions left"><button class="btn primary">Save</button></div> |
| 36 | +<label class="check"><input type="radio" name="mode" value="open"{{if eq $d.Registration "open"}} checked{{end}}> Open to everyone</label> |
| 37 | +<label class="check"><input type="radio" name="mode" value="invite"{{if eq $d.Registration "invite"}} checked{{end}}> Invite only</label> |
| 38 | +<label class="check"><input type="radio" name="mode" value="closed"{{if eq $d.Registration "closed"}} checked{{end}}> Closed, accounts only come from <code>gitpocket user</code></label> |
| 39 | +<div class="actions left"><button class="btn primary">Save ▸</button></div> |
| 63 | 40 | </form> |
| 64 | | -<section class="panel"> |
| 65 | | -<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> |
| 66 | | -{{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}} |
| 67 | | -</section> |
| 41 | +<h3 class="rule">Email on sign up</h3> |
| 42 | +<form method="post" action="/admin" class="stack"> |
| 43 | +<input type="hidden" name="action" value="signup"><input type="hidden" name="s" value="signup"> |
| 44 | +<label class="check"><input type="radio" name="email" value="required"{{if eq $d.SignupEmail "required"}} checked{{end}}> Required</label> |
| 45 | +<label class="check"><input type="radio" name="email" value="optional"{{if eq $d.SignupEmail "optional"}} checked{{end}}> Optional</label> |
| 46 | +<label class="check"><input type="radio" name="email" value="off"{{if eq $d.SignupEmail "off"}} checked{{end}}> Not asked</label> |
| 47 | +<small>Addresses are not verified at sign up.{{if $d.Mail}} People can confirm theirs later from settings.{{end}}</small> |
| 48 | +<div class="actions left"><button class="btn primary">Save ▸</button></div> |
| 49 | +</form> |
| 50 | +<h3 class="rule">Invites</h3> |
| 51 | +{{if $d.Invites}}<table class="keys">{{range $d.Invites}}<tr><td><code>https://{{$.Host}}/register?invite={{.}}</code></td><td><form method="post" action="/admin" class="inline"><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></td></tr>{{end}}</table>{{else}}<p class="muted">No unused invites.</p>{{end}} |
| 52 | +<form method="post" action="/admin" class="inline"><input type="hidden" name="s" value="signup"><button class="btn" name="action" value="invite">New invite ▸</button></form> |
| 68 | 53 | {{end}} |
| 69 | 54 | |
| 70 | 55 | {{if eq $d.Section "projects"}} |
| 71 | | -<h2>Front page</h2> |
| 72 | | -<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> |
| 73 | | -<div class="tablewrap"><table class="admintable"> |
| 74 | | -<thead><tr><th>Repository</th><th>Description</th><th>Position</th></tr></thead> |
| 75 | | -<tbody>{{range $d.Public}}{{$rank := index $d.Ranks .ID}}<tr{{if $rank}} class="featuredrow"{{end}}> |
| 56 | +<h3 class="rule">Front page</h3> |
| 57 | +<p class="muted small">Numbered projects appear on the logged out front page in that order, 0 hides one. With none chosen the most recently pushed are shown.</p> |
| 58 | +<table class="keys">{{range $d.Public}}{{$rank := index $d.Ranks .ID}}<tr> |
| 76 | 59 | <td><a href="/{{.Path}}">{{.Path}}</a></td> |
| 77 | 60 | <td class="muted">{{.Description}}</td> |
| 78 | | -<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> |
| 79 | | -</tr>{{end}}</tbody> |
| 80 | | -</table></div> |
| 61 | +<td><form method="post" action="/admin" class="inline"><input type="hidden" name="s" value="projects"><input type="hidden" name="action" value="feature"><input type="hidden" name="name" value="{{.Owner.Name}}/{{.Name}}"><input class="rank" name="rank" type="number" min="0" max="99" value="{{$rank}}" aria-label="Position for {{.Path}}"><button class="btn small">Set</button></form></td> |
| 62 | +</tr>{{end}}</table> |
| 81 | 63 | {{end}} |
| 82 | 64 | |
| 83 | 65 | {{if eq $d.Section "storage"}} |
| 84 | | -<h2>Storage</h2> |
| 85 | | -<form method="post" action="/admin" class="panel quotaform"> |
| 66 | +<h3 class="rule">Quota</h3> |
| 67 | +<form method="post" action="/admin" class="stack"> |
| 86 | 68 | <input type="hidden" name="s" value="storage"><input type="hidden" name="action" value="quota"> |
| 87 | | -<label>Quota per owner <input name="quota" value="{{$d.QuotaText}}" placeholder="0"></label> |
| 88 | | -<button class="btn primary">Save</button> |
| 89 | | -<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> |
| 69 | +<label>Per owner <input name="quota" value="{{$d.QuotaText}}" placeholder="0"></label> |
| 70 | +<small>For example 500M or 2G, 0 for no limit. A push that would go over it is refused before anything is written.</small> |
| 71 | +<div class="actions left"><button class="btn primary">Save ▸</button></div> |
| 90 | 72 | </form> |
| 91 | | -<section class="panel"> |
| 92 | | -<div class="panelhead"><h3>Usage by owner</h3></div> |
| 93 | | -<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> |
| 94 | | -</section> |
| 73 | +<h3 class="rule">Usage</h3> |
| 74 | +<table class="keys">{{range $d.Owners}}<tr><td><a href="/~{{.Name}}">~{{.Name}}</a></td><td>{{size .Used}}</td><td class="muted">{{if $d.Quota}}{{.Pct}}% of {{$d.QuotaText}}{{end}}</td></tr>{{else}}<tr><td class="muted">No repositories yet.</td></tr>{{end}}</table> |
| 95 | 75 | {{end}} |
| 96 | | -</div> |
| 97 | | -</div> |
| 98 | 76 | {{end}} |