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
|
||||
initNumberInputs();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue