Show confirmation message when loading snapshot backup

This commit is contained in:
juliandescottes 2017-08-01 23:24:22 +02:00 committed by Julian Descottes
parent 2b3bd02479
commit eab21e0839
4 changed files with 6 additions and 5 deletions

View file

@ -58,6 +58,9 @@ var Constants = {
// The datastore limit is 1 MiB, which we roughly approximate to 1 million characters.
APPENGINE_SAVE_LIMIT : 1 * 1024 * 1024,
// Message displayed when an action will lead to erase the current animation.
CONFIRM_OVERWRITE: 'This will replace your current animation, are you sure you want to continue?',
// SERVICE URLS
APPENGINE_SAVE_URL : 'save',
IMAGE_SERVICE_UPLOAD_URL : 'http://piskel-imgstore-b.appspot.com/__/upload',

View file

@ -56,7 +56,7 @@
ns.SessionDetails.prototype.onContainerClick_ = function (evt) {
var action = evt.target.dataset.action;
if (action == 'load') {
if (action == 'load' && window.confirm(Constants.CONFIRM_OVERWRITE)) {
var snapshotId = evt.target.dataset.snapshotId * 1;
pskl.app.backupService.loadSnapshotById(snapshotId).then(function () {
$.publish(Events.DIALOG_HIDE);

View file

@ -144,9 +144,7 @@
if (mode === ns.steps.SelectMode.MODES.REPLACE) {
// Replace the current piskel and close the dialog.
var message = 'This will replace your current animation,' +
' are you sure you want to continue?';
if (window.confirm(message)) {
if (window.confirm(Constants.CONFIRM_OVERWRITE)) {
this.piskelController.setPiskel(piskel);
this.closeDialog();
}

View file

@ -52,7 +52,7 @@
};
ns.FileDropperService.prototype.onPiskelFileLoaded_ = function (piskel) {
if (window.confirm('This will replace your current animation')) {
if (window.confirm(Constants.CONFIRM_OVERWRITE)) {
pskl.app.piskelController.setPiskel(piskel);
}
};