19 lines
716 B
JavaScript
19 lines
716 B
JavaScript
document.addEventListener('DOMContentLoaded', function () {
|
|
// Initialize toasts if they are present
|
|
var toastElList = [].slice.call(document.querySelectorAll('.toast'));
|
|
var toastList = toastElList.map(function (toastEl) {
|
|
return new bootstrap.Toast(toastEl, { delay: 3000 });
|
|
});
|
|
toastList.forEach(toast => toast.show());
|
|
|
|
// Add confirmation to delete buttons
|
|
const deleteForms = document.querySelectorAll('form.delete-task-form');
|
|
deleteForms.forEach(form => {
|
|
form.addEventListener('submit', function (event) {
|
|
if (!confirm('Are you sure you want to delete this task?')) {
|
|
event.preventDefault();
|
|
}
|
|
});
|
|
});
|
|
});
|