mirror of
https://github.com/prurigro/hypothetical.git
synced 2024-11-09 19:26:38 -05:00
Reset the state correctly if a dashboard modal is cancelled with the escape button
This commit is contained in:
parent
f2ba9d2a1b
commit
e7643992b1
1 changed files with 10 additions and 10 deletions
20
resources/js/dashboard.js
vendored
20
resources/js/dashboard.js
vendored
|
@ -48,10 +48,19 @@ function askConfirmation(message, command, cancelCommand) {
|
||||||
}, fadeTime);
|
}, fadeTime);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// functionality to run when clicking the cancel button
|
||||||
|
const cancelModal = function() {
|
||||||
|
if (cancelCommand !== undefined) {
|
||||||
|
cancelCommand();
|
||||||
|
}
|
||||||
|
|
||||||
|
closeConfirmationModal();
|
||||||
|
};
|
||||||
|
|
||||||
// close the modal if the escape button is pressed
|
// close the modal if the escape button is pressed
|
||||||
const escapeModal = function(e) {
|
const escapeModal = function(e) {
|
||||||
if (e.keyCode === 27) {
|
if (e.keyCode === 27) {
|
||||||
closeConfirmationModal();
|
cancelModal();
|
||||||
} else {
|
} else {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
@ -63,15 +72,6 @@ function askConfirmation(message, command, cancelCommand) {
|
||||||
closeConfirmationModal();
|
closeConfirmationModal();
|
||||||
};
|
};
|
||||||
|
|
||||||
// functionality to run when clicking the cancel button
|
|
||||||
const cancelModal = function() {
|
|
||||||
if (cancelCommand !== undefined) {
|
|
||||||
cancelCommand();
|
|
||||||
}
|
|
||||||
|
|
||||||
closeConfirmationModal();
|
|
||||||
};
|
|
||||||
|
|
||||||
// hide the modal when the cancel button is pressed
|
// hide the modal when the cancel button is pressed
|
||||||
$cancelButton.on("click", cancelModal);
|
$cancelButton.on("click", cancelModal);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue