Simplify "Discard changes?" dialog
This commit is contained in:
parent
bc0f8b8046
commit
a6e329faf0
2 changed files with 5 additions and 7 deletions
|
@ -52,10 +52,8 @@ function alertAsync(message) {
|
|||
return popup(dialog);
|
||||
}
|
||||
|
||||
function confirmAsync(message) {
|
||||
const dialog = instantiate("confirm");
|
||||
dialog.querySelector(".message").textContent = message;
|
||||
return popup(dialog);
|
||||
function confirmDiscard() {
|
||||
return popup(instantiate("confirm-discard"));
|
||||
}
|
||||
|
||||
let hasBeenOpen = false;
|
||||
|
@ -161,7 +159,7 @@ function openEditor() {
|
|||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
|
||||
Promise.resolve(!isEdited(form) || confirmAsync("Discard changes?"))
|
||||
Promise.resolve(!isEdited(form) || confirmDiscard())
|
||||
.then(doReset => {
|
||||
if (doReset) {
|
||||
container.classList.remove('edit');
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class=prototype id=confirm>
|
||||
<div class=prototype id=confirm-discard>
|
||||
<div class=modal-block>
|
||||
<div class=popup>
|
||||
<div class=message></div>
|
||||
<div class=message>Discard changes?</div>
|
||||
<div class=btn-row>
|
||||
<button class=primary>No</button>
|
||||
<button data-value=true>Yes</button>
|
||||
|
|
Loading…
Reference in a new issue