Prompt before leaving page

This commit is contained in:
Julian Arni
2013-09-17 15:55:30 -04:00
parent 0f81bdcefd
commit 4fdf7a4849

View File

@@ -78,7 +78,8 @@ $('#fileupload').fileupload({
submitBtn.hide();
data.submit().complete(function(result, textStatus, xhr) {
if (xhr.status != 200) {
alert('${_("Your import has failed.")}\n\n' + result["ErrMsg"]);
var errMsg = result.hasOwnProperty("ErrMsg") ? result["ErrMsg"] : "" ;
alert('${_("Your import has failed.")}\n\n' + errMsg);
submitBtn.show();
bar.hide();
}
@@ -97,13 +98,18 @@ $('#fileupload').fileupload({
},
done: function(e, data){
bar.hide();
window.onbeforeunload = null;
alert('${_("Your import was successful.")}');
window.location = '${successful_import_redirect_url}';
},
start: function(e) {
window.onbeforeunload = function() {
return "Your import is in progress; navigating " +
"away will abort it.";
}
},
sequentialUploads: true
});
})();