enable dark mode
This commit is contained in:
parent
1353a57990
commit
89c54af921
2 changed files with 2 additions and 27 deletions
|
@ -118,31 +118,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Handle form submissions in the modal
|
|
||||||
document.body.addEventListener('htmx:beforeSend', function(event) {
|
|
||||||
// If the event is from a form inside the modal
|
|
||||||
if (event.detail.elt.closest('#htmxModalBody')) {
|
|
||||||
// Add the HX-Request header to the request
|
|
||||||
event.detail.requestConfig.headers['HX-Request'] = 'true';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Handle redirects from HTMX
|
|
||||||
document.body.addEventListener('htmx:responseError', function(event) {
|
|
||||||
if (event.detail.xhr.status === 303) {
|
|
||||||
const redirectUrl = event.detail.xhr.getResponseHeader('HX-Redirect');
|
|
||||||
if (redirectUrl) {
|
|
||||||
// Close the modal
|
|
||||||
const modal = bootstrap.Modal.getInstance(document.getElementById('htmxModal'));
|
|
||||||
if (modal) {
|
|
||||||
modal.hide();
|
|
||||||
}
|
|
||||||
// Redirect to the specified URL
|
|
||||||
window.location.href = redirectUrl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Initialize number inputs on page load
|
// Initialize number inputs on page load
|
||||||
initNumberInputs();
|
initNumberInputs();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html data-bs-theme="auto">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<nav class="navbar navbar-expand-lg navbar-light bg-light sticky-top">
|
<nav class="navbar navbar-expand-lg sticky-top">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<a class="navbar-brand" href="/">{{ appName }}</a>
|
<a class="navbar-brand" href="/">{{ appName }}</a>
|
||||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue