79 lines
3.5 KiB
HTML
79 lines
3.5 KiB
HTML
{{define "admin"}}
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>{{.Title}}</title>
|
|
<link rel="stylesheet" href="{{.StaticPath}}/style.css">
|
|
<script src="{{.StaticPath}}/app.js" defer></script>
|
|
</head>
|
|
<body>
|
|
{{template "navbar" .}}
|
|
<main>
|
|
<header>
|
|
<h2>Admin Panel</h2>
|
|
</header>
|
|
{{if .ShowSuccess}}
|
|
<div class="notification success" style="position: static; margin-bottom: 1em; animation: none;">
|
|
Settings saved successfully!
|
|
</div>
|
|
{{end}}
|
|
{{if .ShowDeleted}}
|
|
<div class="notification success" style="position: static; margin-bottom: 1em; animation: none;">
|
|
User deleted successfully.
|
|
</div>
|
|
{{end}}
|
|
<section>
|
|
<h3>Registration</h3>
|
|
<form method="post" action="{{.BasePath}}/admin/">
|
|
<label for="allow_signup" style="display: flex; align-items: center; gap: 0.5em; cursor: pointer;">
|
|
<input type="checkbox" id="allow_signup" name="allow_signup" {{if .AllowSignup}}checked{{end}}>
|
|
<span>Allow new user signups</span>
|
|
</label>
|
|
<p style="margin-left: 1.5em; margin-top: 0.25em; font-size: 0.9em; opacity: 0.8;">
|
|
When disabled, the signup page redirects to login and prevents account creation.
|
|
</p>
|
|
|
|
<input type="submit" value="Save Settings" style="margin-top: 1.5em;">
|
|
</form>
|
|
</section>
|
|
|
|
<section>
|
|
<h3>User Management</h3>
|
|
{{if .Users}}
|
|
<table style="width: 100%; border-collapse: collapse; margin-top: 1em;">
|
|
<thead>
|
|
<tr style="border-bottom: 2px solid #f582ae;">
|
|
<th style="text-align: left; padding: 0.5em;">Username</th>
|
|
<th style="text-align: left; padding: 0.5em;">Display Name</th>
|
|
<th style="text-align: left; padding: 0.5em;">Joined</th>
|
|
<th style="text-align: right; padding: 0.5em;">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{range .Users}}
|
|
<tr style="border-bottom: 1px solid #ddd;">
|
|
<td style="padding: 0.5em;">{{.Username}}{{if eq .ID $.CurrentUserID}} <em>(you)</em>{{end}}</td>
|
|
<td style="padding: 0.5em;">{{if .DisplayName}}{{.DisplayName}}{{else}}—{{end}}</td>
|
|
<td style="padding: 0.5em;">{{.CreatedAt.Format "02/01/2006"}}</td>
|
|
<td style="padding: 0.5em; text-align: right;">
|
|
{{if ne .ID $.CurrentUserID}}
|
|
<form method="post" action="{{$.BasePath}}/admin/?action=delete_user" style="display: inline;" onsubmit="return confirm('Permanently delete user \'{{.Username}}\'? This cannot be undone.')">
|
|
<input type="hidden" name="user_id" value="{{.ID}}">
|
|
<button type="submit" style="background: #f582ae; color: #001858; padding: 0.2em 0.6em; font-size: 0.85em;">Delete</button>
|
|
</form>
|
|
{{end}}
|
|
</td>
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
{{else}}
|
|
<p>No users found.</p>
|
|
{{end}}
|
|
</section>
|
|
</main>
|
|
{{template "cookie_banner" .}}
|
|
</body>
|
|
</html>
|
|
{{end}}
|