admin.html (4562B)
1 {{ template "head" . }} 2 <main> 3 <h1>{{ .Title }}</h1> 4 <section> 5 <form method="GET" id="add-user" action="/add-user"></form> 6 <p> 7 <form method="POST" id="demote-self" action="/demote-admin"> 8 <input type="hidden" name="userid" value="{{ .LoggedInID }}"> 9 </form> 10 <p> 11 {{ "AdminAddNewUserQuestion" | translate }} <button form="add-user" type="submit"> {{ "AdminAddNewUser" | translate }}</button>. 12 </p> 13 <p> 14 {{ "AdminStepDownExplanation" | translate }} <button form="demote-self" type="submit">{{ "AdminStepDown" | translate }}</button>. 15 </p> 16 <p> 17 {{ "AdminViewPastActions" | translate }} <a href="/moderations">{{ "ModerationLog" | translate }}</a>. 18 </p> 19 </section> 20 21 {{ if .LoggedIn }} 22 {{ $userID := .LoggedInID }} 23 <section> 24 <h2> {{ "Admins" | translate | capitalize }} </h2> 25 {{ if len .Data.Admins | eq 0 }} 26 <p> {{ "AdminNoAdmins" | translate }} </p> 27 {{ else }} 28 <table> 29 {{ range $index, $user := .Data.Admins }} 30 <tr> 31 <form method="POST" id="demote-admin-{{$user.ID}}" action="/demote-admin"> 32 <input type="hidden" name="userid" value="{{ $user.ID }}"> 33 </form> 34 <td>{{ $user.Name }} ({{ $user.ID }}) </td> 35 <td> 36 {{ if eq $userID $user.ID }} <i>({{ "AdminYou" | translate }})</i> 37 {{ else }}<button type="submit" form="demote-admin-{{$user.ID}}">{{ "AdminDemote" | translate }}</button>{{ end }} 38 </td> 39 </tr> 40 {{ end }} 41 </table> 42 {{ end }} 43 </section> 44 <section> 45 <h2> {{ "PendingProposals" | translate }} </h2> 46 <p> {{ "AdminPendingExplanation" | translate | tohtml }}</p> 47 {{ if len .Data.Proposals | eq 0}} 48 <p><i>{{ "AdminNoPendingProposals" | translate }}</i></p> 49 {{ else }} 50 <table> 51 <tr> 52 <th>{{ "Proposal" | translate }}</th> 53 <th colspan="3">{{ "AdminSelfProposalsBecomeValid" | translate }}</th> 54 </tr> 55 {{ range $index, $proposal := .Data.Proposals }} 56 <tr> 57 <form method="POST" id="confirm-{{$proposal.ID}}" action="/proposal-confirm"> 58 <input type="hidden" name="proposalid" value="{{ $proposal.ID }}"> 59 </form> 60 <form method="POST" id="veto-{{$proposal.ID}}" action="/proposal-veto"> 61 <input type="hidden" name="proposalid" value="{{ $proposal.ID }}"> 62 </form> 63 <td> {{ $proposal.Action | tohtml }} </td> 64 <td> {{ $proposal.Time | formatDateTime }} </td> 65 <td><button type="submit" form="veto-{{$proposal.ID}}">{{ "AdminVeto" | translate }}</button></td> 66 {{ $selfProposal := eq $userID $proposal.ProposerID }} 67 <td><button {{ if and $selfProposal (not $proposal.TimePassed) }} disabled title='{{ "AdminSelfConfirmationsHover" | translate}}' {{ end }} type="submit" form="confirm-{{$proposal.ID}}">{{"AdminConfirm" | translate}}</button></td> 68 </tr> 69 {{ end }} 70 </table> 71 {{ end }} 72 73 <section> 74 <h2> {{ "AdminUsers" | translate }} </h2> 75 {{ if len .Data.Users | eq 0 }} 76 <p> {{ "AdminNoUsers" | translate }} </p> 77 {{ else }} 78 <table> 79 {{ range $index, $user := .Data.Users }} 80 {{ if and (ne $user.Name "CERCA_CMD") (ne $user.Name "deleted user") }} 81 <form method="POST"> 82 <input type="hidden" name="userid" value="{{$user.ID}}"> 83 <tr> 84 <td>{{ $user.Name }} ({{ $user.ID }})</td> 85 <td> 86 <select name="admin-action" action="/admin/" id="select-{{$user.ID}}"> 87 <option selected value="reset-password">{{ "PasswordReset" | translate | capitalize }}</option> 88 <option value="remove-account">{{ "RemoveAccount" | translate | capitalize }}</option> 89 <option value="make-admin">{{ "AdminMakeAdmin" | translate }}</option> 90 </select> 91 </td> 92 <td> 93 <button type="submit">{{ "Submit" | translate }}</button> 94 </td> 95 </tr> 96 {{ end }} 97 </form> 98 {{ end }} 99 </table> 100 {{ end }} 101 </section> 102 103 {{ end }} 104 </main> 105 {{ template "footer" . }}