changeset 2440:3000fd5b0e29

adds div to modify view to check if modify view, instead of checking the URL
author sharky93 <rishabhr123@gmail.com>
date Sun, 01 Sep 2013 14:48:35 +0530
parents 14c6e645de70
children aa5d6575f7ee
files MoinMoin/templates/basic.js MoinMoin/themes/basic/templates/modify.html
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/templates/basic.js	Sun Sep 01 14:24:06 2013 +0530
+++ b/MoinMoin/templates/basic.js	Sun Sep 01 14:48:35 2013 +0530
@@ -5,9 +5,10 @@
     $('#password, #notification, #ui, #navigation, #options').removeClass('active');
     $('textarea').autosize();
     window.onbeforeunload = function(e) {
-        // checks if the URL is of the form http://host/+modify/page
-        var index = $.inArray("+modify", window.location.pathname.split('/'));
-        if (index == 1) {
+        // 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) {
     		return "Data you may have entered will be discarded!";
     	}
     }
--- a/MoinMoin/themes/basic/templates/modify.html	Sun Sep 01 14:24:06 2013 +0530
+++ b/MoinMoin/themes/basic/templates/modify.html	Sun Sep 01 14:48:35 2013 +0530
@@ -14,6 +14,7 @@
 {% block content %}
 <h2>{{ title }}</h2>
 <div id="moin-modify" class="moin-form">
+    <div id="checkmodifyview"> </div>
     {{ gen.form.open(form, method='post', enctype='multipart/form-data') }}
     {{ forms.render_errors(form) }}
     {#