Added check for unsaved changes before navigating away from wiki edit page.

--HG--
branch : bridger-dev
This commit is contained in:
Bridger Maxwell
2012-02-16 18:16:01 -05:00
parent 1921bd01ba
commit fdc4bd71be

View File

@@ -11,16 +11,15 @@ ${ wiki_article.title }
<%block name="wiki_head">
<script>
$(function() {
$("#id_contents").data('initial_contents') = $("#id_contents");
//Store the initial contents of #id_contents (the wiki body field) so we can compare for unsaved changes
$("#id_contents").data('initial_contents', $("#id_contents").val());
window.
}
//On load, we save
var blah;
window.onbeforeunload = function askConfirm() { //Warn the user before they navigate away
if ( $("#id_contents").val() != $("#id_contents").data('initial_contents') ) {
return "You have made changes to the article that have not been saved yet.";
}
};
});
</script>
</%block>