changeset 2441:aa5d6575f7ee

fixes alert on saving the edit
author sharky93 <rishabhr123@gmail.com>
date Sun, 01 Sep 2013 15:16:28 +0530
parents 3000fd5b0e29
children bf19865c6e0b
files MoinMoin/templates/basic.js
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/templates/basic.js	Sun Sep 01 14:48:35 2013 +0530
+++ b/MoinMoin/templates/basic.js	Sun Sep 01 15:16:28 2013 +0530
@@ -4,13 +4,17 @@
     $('#meta, #help').removeClass('active');
     $('#password, #notification, #ui, #navigation, #options').removeClass('active');
     $('textarea').autosize();
+    $('#moin-save-text-button').click(function (){
+        edit = true;
+    });
     window.onbeforeunload = function(e) {
         // previously checked if the URL is of the form http://host/+modify/page
         // it is bad way if we rewrite URL's, hence used a div with id -> "checkmodifyview" in the modify view
         var test = $('#checkmodifyview').length;
-        if (test == 1) {
+        if (test == 1 && edit == false) {
     		return "Data you may have entered will be discarded!";
     	}
+        edit = false;
     }
     $('div.dropup').removeClass('menu');
     $('ul.dropdown-menu').removeClass('submenu');