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. // The datastore limit is 1 MiB, which we roughly approximate to 1 million characters.
APPENGINE_SAVE_LIMIT : 1 * 1024 * 1024, 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 // SERVICE URLS
APPENGINE_SAVE_URL : 'save', APPENGINE_SAVE_URL : 'save',
IMAGE_SERVICE_UPLOAD_URL : 'http://piskel-imgstore-b.appspot.com/__/upload', IMAGE_SERVICE_UPLOAD_URL : 'http://piskel-imgstore-b.appspot.com/__/upload',

View File

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

View File

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

View File

@ -52,7 +52,7 @@
}; };
ns.FileDropperService.prototype.onPiskelFileLoaded_ = function (piskel) { 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); pskl.app.piskelController.setPiskel(piskel);
} }
}; };