mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-08-14 16:26:23 -07:00
52 lines
2.3 KiB
HTML
52 lines
2.3 KiB
HTML
{{$isAdmin := (eq .currentStaff.Rank 3) -}}
|
|
{{$showNewStaffForm := (and (eq .updateUsername "") $isAdmin) -}}
|
|
<table class="mgmt-table stafflist">
|
|
<tr><th>Username</th><th>Rank</th><th>Added on</th><th>Action</th></tr>
|
|
{{range $s, $staff := $.allstaff -}}
|
|
<tr>
|
|
<td>{{$staff.Username}}</td>
|
|
<td>{{$staff.RankTitle}}</td>
|
|
<td>{{formatTimestamp $staff.AddedOn}}</td>
|
|
<td>
|
|
{{if or $isAdmin (eq $staff.Username $.currentStaff.Username) -}}
|
|
<a href="{{webPath "/manage/staff"}}?update={{$staff.Username}}" title="Update your password">Update</a>
|
|
{{end -}}
|
|
{{if eq $.currentStaff.Rank 3}}
|
|
<a {{if eq $staff.Username $.currentStaff.Username -}}
|
|
href="{{webPath "/manage/staff"}}" title="Cannot self terminate" style="color: black;"
|
|
{{- else -}}
|
|
href="{{webPath "/manage/staff"}}?do=del&username={{$staff.Username}}" title="Delete {{$staff.Username}}" onclick="return confirm('Are you sure you want to delete the staff account for \'{{$staff.Username}}\'?')" style="color:red;"
|
|
{{end}}>Delete</a>
|
|
{{- end}}
|
|
</td>
|
|
</tr>
|
|
{{end}}
|
|
</table><hr />
|
|
{{if $showNewStaffForm -}}
|
|
<h2>Add new staff</h2>
|
|
{{- else -}}
|
|
<h2>Update password</h2>
|
|
{{- end}}
|
|
<form action="{{webPath "/manage/staff"}}" {{if $showNewStaffForm}}onsubmit="return makeNewStaff();"{{end}} method="POST">
|
|
<table>
|
|
<tr><td>Username:</td><td><input id="username" name="username" type="text" value="{{if $isAdmin}}{{.updateUsername}}{{else}}{{.currentStaff.Username}}{{end}}" {{if not $showNewStaffForm}}disabled{{end}}/></td></tr>
|
|
<tr><td>Password:</td><td><input id="password" name="password" type="password"/></td></tr>
|
|
<tr><td>Confirm password:</td><td><input id="passwordconfirm" name="passwordconfirm" type="password"/></td></tr>
|
|
{{if $showNewStaffForm -}}
|
|
<tr><td>Rank:</td><td><select id="rank" name="rank">
|
|
<option value="3">Admin</option>
|
|
<option value="2">Moderator</option>
|
|
<option value="1">Janitor</option>
|
|
</select></td></tr>
|
|
<tr><td>
|
|
<input type="hidden" name="do" value="add" />
|
|
<input id="submitnewstaff" type="submit" value="Add" /></td></tr>
|
|
{{- else -}}
|
|
<tr><td>
|
|
<input type="hidden" name="do" value="update" />
|
|
<input type="hidden" name="update" value="{{if $isAdmin}}{{.updateUsername}}{{else}}{{.currentStaff.Username}}{{end}}">
|
|
<input id="submitupdate" type="submit" value="Update password" />
|
|
{{- end}}
|
|
</td></tr>
|
|
</table>
|
|
</form>
|