Added check for unsaved changes before navigating away from wiki edit page.
--HG-- branch : bridger-dev
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user