-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathadmin.html
131 lines (129 loc) · 5.71 KB
/
admin.html
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
{{ template "head" . }}
<main>
<h1>{{ .Title }}</h1>
<section>
<form method="GET" id="add-user" action="/add-user"></form>
<form method="GET" id="visit-invites" action="/invites"></form>
<form method="POST" id="demote-self" action="/demote-admin">
<input type="hidden" name="userid" value="{{ .LoggedInID }}">
</form>
<p>
Do you want to view or create invites? <button form="visit-invites" type="submit">View invites</button>.
</p>
<p>
{{ "AdminAddNewUserQuestion" | translate }} <button form="add-user" type="submit"> {{ "AdminAddNewUser" | translate }}</button>.
</p>
<p>
{{ "AdminStepDownExplanation" | translate }} <button form="demote-self" type="submit">{{ "AdminStepDown" | translate }}</button>.
</p>
<p>
{{ "AdminViewPastActions" | translate }} <a href="/moderations">{{ "ModerationLog" | translate }}</a>.
</p>
</section>
{{ if .LoggedIn }}
{{ $userID := .LoggedInID }}
<section>
<h2> {{ "Admins" | translate | capitalize }} </h2>
{{ if len .Data.Admins | eq 0 }}
<p> {{ "AdminNoAdmins" | translate }} </p>
{{ else }}
<table>
{{ range $index, $user := .Data.Admins }}
<tr>
<form method="POST" id="demote-admin-{{$user.ID}}" action="/demote-admin">
<input type="hidden" name="userid" value="{{ $user.ID }}">
</form>
<td>{{ $user.Name }} ({{ $user.ID }}) </td>
<td>
{{ if eq $userID $user.ID }} <i>({{ "AdminYou" | translate }})</i>
{{ else }}<button type="submit" form="demote-admin-{{$user.ID}}">{{ "AdminDemote" | translate }}</button>{{ end }}
</td>
</tr>
{{ end }}
</table>
{{ end }}
</section>
<section>
<h2> {{ "PendingProposals" | translate }} </h2>
<p> {{ "AdminPendingExplanation" | translate | tohtml }}</p>
{{ if len .Data.Proposals | eq 0}}
<p><i>{{ "AdminNoPendingProposals" | translate }}</i></p>
{{ else }}
<table>
<tr>
<th>{{ "Proposal" | translate }}</th>
<th colspan="3">{{ "AdminSelfProposalsBecomeValid" | translate }}</th>
</tr>
{{ range $index, $proposal := .Data.Proposals }}
<tr>
<form method="POST" id="confirm-{{$proposal.ID}}" action="/proposal-confirm">
<input type="hidden" name="proposalid" value="{{ $proposal.ID }}">
</form>
<form method="POST" id="veto-{{$proposal.ID}}" action="/proposal-veto">
<input type="hidden" name="proposalid" value="{{ $proposal.ID }}">
</form>
<td> {{ $proposal.Action | tohtml }} </td>
<td> {{ $proposal.Time | formatDateTime }} </td>
<td><button type="submit" form="veto-{{$proposal.ID}}">{{ "AdminVeto" | translate }}</button></td>
{{ $selfProposal := eq $userID $proposal.ProposerID }}
<td><button {{ if and $selfProposal (not $proposal.TimePassed) }} disabled title='{{ "AdminSelfConfirmationsHover" | translate}}' {{ end }} type="submit" form="confirm-{{$proposal.ID}}">{{"AdminConfirm" | translate}}</button></td>
</tr>
{{ end }}
</table>
{{ end }}
<section>
<h2>Registered invites</h2>
<p>Tallied invites based on the invite batch. Useful to see how invites are being claimed for different
batches.</p>
{{ if len .Data.Registrations| eq 0 }}
<p><i>No invites have been redeemed yet.</i></p>
{{ else }}
<table>
<tr>
<th>Label</th>
<th>Uses</th>
<th>ID</th>
</tr>
{{ range $index, $reggedInvite := .Data.Registrations }}
<tr>
<td>{{ if len $reggedInvite.Label | eq 0 }} Unlabeled batch {{ else }} {{ $reggedInvite.Label }} {{ end }}</td>
<td style="text-align: center">{{ $reggedInvite.Count }}</td>
<td><details><summary style="margin: 0;">Batch ID</summary>{{ $reggedInvite.BatchID }}</details></td>
</tr>
{{ end }}
</table>
{{ end }}
</section>
<section>
<h2> {{ "AdminUsers" | translate }} </h2>
{{ if len .Data.Users | eq 0 }}
<p> {{ "AdminNoUsers" | translate }} </p>
{{ else }}
<table>
{{ range $index, $user := .Data.Users }}
{{ if and (ne $user.Name "CERCA_CMD") (ne $user.Name "deleted user") }}
<form method="POST">
<input type="hidden" name="userid" value="{{$user.ID}}">
<tr>
<td>{{ $user.Name }} ({{ $user.ID }})</td>
<td>
<select name="admin-action" action="/admin/" id="select-{{$user.ID}}">
<option selected value="reset-password">{{ "PasswordReset" | translate | capitalize }}</option>
<option value="remove-account">{{ "RemoveAccount" | translate | capitalize }}</option>
<option value="make-admin">{{ "AdminMakeAdmin" | translate }}</option>
</select>
</td>
<td><details><summary style="margin: 0;">invite/register info</summary>{{ $user.RegistrationOrigin }}</details></td>
<td>
<button type="submit">{{ "Submit" | translate }}</button>
</td>
</tr>
{{ end }}
</form>
{{ end }}
</table>
{{ end }}
</section>
{{ end }}
</main>
{{ template "footer" . }}