Add admin-route & dropdown-menu. Add clear-cache & create-code. Adjustments for activation-code and user models. Add sweet-alert for admin-tools.
This commit is contained in:
@@ -2,13 +2,77 @@
|
||||
|
||||
<div class="row justify-content-between border-top pt-4 position-relative mb-5">
|
||||
<div class="col-auto position-absolute start-0">
|
||||
<a class="btn btn-lg btn-outline-secondary text-secondary-emphasis" href="/logout" data-bs-toggle="tooltip" data-bs-title="Abmelden">
|
||||
<i class="bi bi-door-closed"></i>
|
||||
</a>
|
||||
<button class="btn btn-lg btn-outline-secondary text-secondary-emphasis" data-bs-toggle="modal" data-bs-target="#settingsModal">
|
||||
<i class="bi bi-gear-fill me-2"></i>
|
||||
Einstellungen
|
||||
</button>
|
||||
<div class="btn-toolbar" role="toolbar">
|
||||
<a class="btn btn-lg btn-outline-secondary text-secondary-emphasis me-2" href="/logout" data-bs-toggle="tooltip" data-bs-title="Abmelden">
|
||||
<i class="bi bi-door-closed"></i>
|
||||
</a>
|
||||
<button class="btn btn-lg btn-outline-secondary text-secondary-emphasis me-2" data-bs-toggle="modal" data-bs-target="#settingsModal">
|
||||
<i class="bi bi-gear-fill"></i>
|
||||
</button>
|
||||
{{ if .isAdmin }}
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-lg btn-outline-secondary text-secondary-emphasis dropdown-toggle" type="button" data-bs-toggle="dropdown">
|
||||
<i class="bi bi-tools"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><h6 class="dropdown-header">ACCOUNTS</h6></li>
|
||||
<li>
|
||||
<button class="dropdown-item fs-5 text-info-emphasis fst-italic"
|
||||
hx-post="/admin/create_code" hx-trigger="confirmed" hx-swap="none"
|
||||
onclick="createCodeDialog(this)">
|
||||
Create Code
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button class="dropdown-item fs-5 text-info-emphasis fst-italic"
|
||||
hx-get="/admin/reset_password" hx-trigger="confirmed" hx-swap="none"
|
||||
onclick="confirmAndTrigger(this)">
|
||||
Reset Password
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button class="dropdown-item fs-5 text-info-emphasis fst-italic"
|
||||
hx-get="/admin/disable_account" hx-trigger="confirmed" hx-swap="none"
|
||||
onclick="confirmAndTrigger(this)">
|
||||
Disable Account
|
||||
</button>
|
||||
</li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><h6 class="dropdown-header">TOOLS</h6></li>
|
||||
<li>
|
||||
<button class="dropdown-item fs-5 text-warning-emphasis"
|
||||
hx-get="/admin/clear_cache" hx-trigger="confirmed" hx-swap="none"
|
||||
onclick="confirmAndTrigger(this)">
|
||||
Clear Cache
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button class="dropdown-item fs-5 text-warning-emphasis fst-italic"
|
||||
hx-get="/admin/update_cache" hx-trigger="confirmed" hx-swap="none"
|
||||
onclick="confirmAndTrigger(this)">
|
||||
Update Cache
|
||||
</button>
|
||||
</li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><h6 class="dropdown-header">DANGER ZONE</h6></li>
|
||||
<li>
|
||||
<button class="dropdown-item fs-5 text-danger-emphasis fst-italic"
|
||||
hx-get="/admin/purge_players" hx-trigger="confirmed" hx-swap="none"
|
||||
onclick="confirmAndTrigger(this)">
|
||||
Purge Players
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button class="dropdown-item fs-5 text-danger-emphasis fst-italic"
|
||||
hx-get="/admin/purge_cache" hx-trigger="confirmed" hx-swap="none"
|
||||
onclick="confirmAndTrigger(this)">
|
||||
Purge Clans
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto position-absolute start-50 translate-middle-x">
|
||||
<button class="btn btn-lg btn-outline-primary">
|
||||
@@ -24,4 +88,16 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.body.addEventListener('htmx:afterRequest', function (event) {
|
||||
if (event.detail.pathInfo.requestPath.startsWith("/admin/")) {
|
||||
Swal.fire({
|
||||
title: 'Action executed',
|
||||
text: event.detail.xhr.response,
|
||||
icon: event.detail.xhr.status === 200 ? 'success' : 'error'
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
{{ end }}
|
||||
@@ -9,6 +9,8 @@
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<link href="https://cdn.jsdelivr.net/npm/@sweetalert2/theme-dark@4/dark.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.js"></script>
|
||||
<link rel="stylesheet" href="../static/index.css">
|
||||
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user