Commit fdc4bd71 by Bridger Maxwell

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

--HG--
branch : bridger-dev
parent 1921bd01
...@@ -11,16 +11,15 @@ ${ wiki_article.title } ...@@ -11,16 +11,15 @@ ${ wiki_article.title }
<%block name="wiki_head"> <%block name="wiki_head">
<script> <script>
$(function() { $(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.onbeforeunload = function askConfirm() { //Warn the user before they navigate away
window. if ( $("#id_contents").val() != $("#id_contents").data('initial_contents') ) {
return "You have made changes to the article that have not been saved yet.";
} }
};
//On load, we save });
var blah;
</script> </script>
</%block> </%block>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment