Compare commits
No commits in common. "8d59462f0e6fc16d4b4e64ccf494e16c19900f79" and "37253c31dde435dbafa7da473356e210866ef751" have entirely different histories.
8d59462f0e
...
37253c31dd
2 changed files with 1 additions and 88 deletions
|
|
@ -12,7 +12,7 @@ a:hover {
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body hx-on::response-error="showErrorDialog(event)">
|
<body>
|
||||||
<main>
|
<main>
|
||||||
<nav>
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
@ -37,38 +37,5 @@ a:hover {
|
||||||
{{ inner | safe }}
|
{{ inner | safe }}
|
||||||
</article>
|
</article>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<dialog id="error-dialog">
|
|
||||||
<article>
|
|
||||||
<header>
|
|
||||||
<button aria-label="Close" rel="prev" onclick="this.closest('dialog').close()"></button>
|
|
||||||
<h5>Failed web request</h5>
|
|
||||||
</header>
|
|
||||||
<p id="error-message">Failed web request</p>
|
|
||||||
</article>
|
|
||||||
</dialog>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
function showErrorDialog(evt) {
|
|
||||||
// TODO exclude certain error codes, e.g. 400 bad request
|
|
||||||
const xhr = evt.detail.xhr;
|
|
||||||
const errorMessage = document.getElementById('error-message');
|
|
||||||
|
|
||||||
let message = 'An unexpected error occurred.';
|
|
||||||
|
|
||||||
if (xhr.status === 401) {
|
|
||||||
message = 'You need to log in.';
|
|
||||||
} else if (xhr.status === 403) {
|
|
||||||
message = 'Access denied.';
|
|
||||||
} else if (xhr.status === 404) {
|
|
||||||
message = 'Resource not found.';
|
|
||||||
} else if (xhr.status === 500) {
|
|
||||||
message = 'Server error occurred.';
|
|
||||||
}
|
|
||||||
|
|
||||||
errorMessage.textContent = message;
|
|
||||||
document.getElementById('error-dialog').showModal();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,6 @@
|
||||||
{% block inner %}
|
{% block inner %}
|
||||||
<h3>Users</h3>
|
<h3>Users</h3>
|
||||||
|
|
||||||
<button
|
|
||||||
onclick="document.getElementById('create-user-form').reset(); document.getElementById('create-user-modal').showModal()"
|
|
||||||
id="create-user">Create new user</button>
|
|
||||||
|
|
||||||
<input
|
<input
|
||||||
type="text" id="username" name="username"
|
type="text" id="username" name="username"
|
||||||
hx-get="/administration/users"
|
hx-get="/administration/users"
|
||||||
|
|
@ -52,54 +48,4 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<dialog id="create-user-modal">
|
|
||||||
<article>
|
|
||||||
<header>
|
|
||||||
<button
|
|
||||||
aria-label="Close"
|
|
||||||
rel="prev"
|
|
||||||
onclick="document.getElementById('create-user-modal').close()"
|
|
||||||
class="close-button"></button>
|
|
||||||
<h5>Create User</h5>
|
|
||||||
</header>
|
|
||||||
<div class="content">
|
|
||||||
<form id="create-user-form">
|
|
||||||
<fieldset>
|
|
||||||
<label>
|
|
||||||
Username
|
|
||||||
<input name="username"
|
|
||||||
placeholder="Username"
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
Admin
|
|
||||||
<input name="admin"
|
|
||||||
type="checkbox"
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
Password
|
|
||||||
<input type="password"
|
|
||||||
name="password"
|
|
||||||
placeholder="Password"
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
Confirm password
|
|
||||||
<input type="password"
|
|
||||||
name="password-confirm"
|
|
||||||
placeholder="Password"
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<input type="submit"
|
|
||||||
value="Create user"
|
|
||||||
/>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
</dialog>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue