Skip to content

Commit 0c292a3

Browse files
committed
Refactor confirmation dialog #127
Signed-off-by: John M. Horan <[email protected]>
1 parent 07ffbfa commit 0c292a3

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

assets/app/js/componentDialog.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,12 @@ class ComponentDialog {
160160

161161
this.title.text(data.id);
162162

163-
// Disable the ability to close the dialog by clicking outside the dialog or pressing the escape key.
163+
// Disable the ability to close the dialog by clicking outside
164+
// the dialog or pressing the escape key.
164165
this.dialog.modal({ backdrop: "static", keyboard: false });
165166

166-
// Retrieve any previously-saved values -- use below in _closeComponent() to compare with any new edits before closing the dialog.
167+
// Retrieve any previously-saved values -- use below in _closeComponent()
168+
// to compare with any new edits before closing the dialog.
167169
this.initialSerialization = this.dialog.find("form").serialize();
168170

169171
this.dialog.modal('show');
@@ -175,10 +177,7 @@ class ComponentDialog {
175177
this.currentSerialization = this.dialog.find("form").serialize();
176178

177179
if (this.initialSerialization !== this.currentSerialization) {
178-
if(!confirm('Any edits you\'ve made will be lost if you close without saving. \n\nClick "OK" if you don\'t want to save your edits.')) {
179-
// This closes the alert and leaves the modal open if "Cancel" is clicked.
180-
return false;
181-
}
180+
return confirm('Your new changes haven\'t been saved. \n\nAre you sure you want to exit without saving?')
182181
}
183182
}
184183

0 commit comments

Comments
 (0)