Slightly nicer admin panel in user_profile

This commit is contained in:
Asaf Gartner 2024-07-03 10:14:36 +03:00
parent 280ccb3bcd
commit a9918cc2fb
1 changed files with 12 additions and 13 deletions

View File

@ -93,7 +93,7 @@
</div> </div>
{{ if .User }} {{ if .User }}
{{ if .User.IsStaff }} {{ if .User.IsStaff }}
<div class="mt3 mt0-ns mt3-l ml3-ns ml0-l flex flex-column items-start bg3 pa2 br2 admin"> <div class="hmn-form mt3 mt0-ns mt3-l ml3-ns ml0-l flex flex-column g2 items-start bg1 pa2 admin">
<div class="flex flex-row w-100 items-center"> <div class="flex flex-row w-100 items-center">
<b class="flex-grow-1">Admin actions</b> <b class="flex-grow-1">Admin actions</b>
<div class="led yellow" style="height: 12px; margin: 3px;"></div> <div class="led yellow" style="height: 12px; margin: 3px;"></div>
@ -101,35 +101,34 @@
</div> </div>
<div class="relative w-100"> <div class="relative w-100">
<div class="bg3 cover absolute w-100 h-100 br2"></div> <div class="bg3 cover absolute w-100 h-100 br2"></div>
<form id="admin_set_options_form" method="POST" action="{{ .AdminSetOptionsUrl }}"> <form id="admin_set_options_form" class="flex flex-column g3" method="POST" action="{{ .AdminSetOptionsUrl }}">
{{ csrftoken .Session }} {{ csrftoken .Session }}
<input type="hidden" name="user_id" value="{{ .ProfileUser.ID }}" /> <input type="hidden" name="user_id" value="{{ .ProfileUser.ID }}" />
<input type="hidden" name="username" value="{{ .ProfileUser.Username }}" /> <input type="hidden" name="username" value="{{ .ProfileUser.Username }}" />
<div class="mt3"> <div class="input-group">
<div>User status:</div> <label for="user_status">User status:</label>
<select name="status"> <select id="user_status" name="status">
<option value="inactive" {{ if eq .ProfileUser.Status 1 }}selected{{ end }}>Brand new</option> <option value="inactive" {{ if eq .ProfileUser.Status 1 }}selected{{ end }}>Brand new</option>
<option value="confirmed" {{ if eq .ProfileUser.Status 2 }}selected{{ end }}>Email confirmed</option> <option value="confirmed" {{ if eq .ProfileUser.Status 2 }}selected{{ end }}>Email confirmed</option>
<option value="approved" {{ if eq .ProfileUser.Status 3 }}selected{{ end }}>Admin approved</option> <option value="approved" {{ if eq .ProfileUser.Status 3 }}selected{{ end }}>Admin approved</option>
<option value="banned" {{ if eq .ProfileUser.Status 4 }}selected{{ end }}>Banned</option> <option value="banned" {{ if eq .ProfileUser.Status 4 }}selected{{ end }}>Banned</option>
</select> </select>
<div class="c--dim f7">Only sets status. Doesn't delete anything.</div> <div class="c--dim f7">Only sets status. Doesn't delete anything.</div>
</div> </div>
<div class="mt3"> <div class="input-group">
<div>Education role:</div> <label for="edu_role">Education role:</label>
<select name="edu_role"> <select id="edu_role" name="edu_role">
<option value="none" {{ if not .ProfileUser.IsEduTester }}selected{{ end }}>None</option> <option value="none" {{ if not .ProfileUser.IsEduTester }}selected{{ end }}>None</option>
<option value="beta" {{ if and .ProfileUser.IsEduTester (not .ProfileUser.IsEduAuthor) }}selected{{ end }}>Beta Tester</option> <option value="beta" {{ if and .ProfileUser.IsEduTester (not .ProfileUser.IsEduAuthor) }}selected{{ end }}>Beta Tester</option>
<option value="author" {{ if .ProfileUser.IsEduAuthor }}selected{{ end }}>Author</option> <option value="author" {{ if .ProfileUser.IsEduAuthor }}selected{{ end }}>Author</option>
</select> </select>
</div> </div>
<div class="mt3"> <div class="input-group">
<input type="submit" value="Save" /> <input class="btn-primary" type="submit" value="Save" />
</div> </div>
</form> </form>
<div class="mt3"> <div class="mt4 input-group">
<div>Danger zone:</div> <label for="admin_nuke_form">Danger zone:</label>
<form id="admin_nuke_form" method="POST" action="{{ .AdminNukeUrl }}"> <form id="admin_nuke_form" method="POST" action="{{ .AdminNukeUrl }}">
{{ csrftoken .Session }} {{ csrftoken .Session }}
<input type="hidden" name="user_id" value="{{ .ProfileUser.ID }}" /> <input type="hidden" name="user_id" value="{{ .ProfileUser.ID }}" />