Skip to content
Snippets Groups Projects
Commit 81742c50 authored by Jared Hancock's avatar Jared Hancock
Browse files

pjax: Reinstate leaving unsaved changes warning

parent 21f87e50
Branches
Tags
No related merge requests found
...@@ -140,7 +140,10 @@ var scp_prep = function() { ...@@ -140,7 +140,10 @@ var scp_prep = function() {
$('input[type=submit]', fObj).css('color', 'red'); $('input[type=submit]', fObj).css('color', 'red');
$(window).bind('beforeunload', function(e) { $(window).bind('beforeunload', function(e) {
return 'Are you sure you want to leave? Any changes or info you\'ve entered will be discarded!'; return 'Are you sure you want to leave? Any changes or info you\'ve entered will be discarded!';
}); });
$(document).on('pjax:beforeSend.changed', function(e) {
return confirm('Are you sure you want to leave? Any changes or info you\'ve entered will be discarded!');
});
} }
}; };
...@@ -651,6 +654,10 @@ $(document).on('pjax:start', function() { ...@@ -651,6 +654,10 @@ $(document).on('pjax:start', function() {
$("#loadingbar").width((50 + Math.random() * 30) + "%"); $("#loadingbar").width((50 + Math.random() * 30) + "%");
$('#overlay').css('background-color','white').fadeIn(); $('#overlay').css('background-color','white').fadeIn();
} }
// Cancel save-changes warning banner
$(document).unbind('pjax:beforeSend.changed');
$(window).unbind('beforeunload');
}); });
$(document).on('pjax:end', function() { $(document).on('pjax:end', function() {
// right // right
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment