From f71d63fda0a04cfddb36c04cd691f3e61c18d3af Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 12 Jun 2012 15:45:44 +0530 Subject: [PATCH] fix in back button after save/submit --- public/js/all-app.js | 4 ++-- public/js/all-web.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/js/all-app.js b/public/js/all-app.js index 25d29e59f1..e850e31a97 100644 --- a/public/js/all-app.js +++ b/public/js/all-app.js @@ -249,7 +249,7 @@ throw new SyntaxError('JSON.parse');};}}()); * lib/js/wn/router.js */ wn.re_route={} -wn.route=function(){if(wn.re_route[window.location.hash]){window.location.hash=wn.re_route[window.location.hash];} +wn.route=function(){if(wn.re_route[window.location.hash]){var re_route_val=wn.get_route_str(wn.re_route[window.location.hash]);var cur_route_val=wn.get_route_str(wn._cur_route);if(decodeURIComponent(re_route_val)===decodeURIComponent(cur_route_val)){window.history.back();return;}else{window.location.hash=wn.re_route[window.location.hash];}} wn._cur_route=window.location.hash;route=wn.get_route();switch(route[0]){case"List":wn.views.doclistview.show(route[1]);break;case"Form":if(route.length>3){route[2]=route.splice(2).join('/');} wn.views.formview.show(route[1],route[2]);break;case"Report":wn.views.reportview.show(route[1],route[2]);break;case"Report2":wn.views.reportview2.show();break;default:wn.views.pageview.show(route[0]);}} wn.get_route=function(route){if(!wn.boot){return[window.page_name];} @@ -1749,7 +1749,7 @@ _f.Frm.prototype.rename_notify=function(dt,old,name){if(this.meta.in_dialog) return;if(this.docname==old) this.docname=name;else return;this.is_editable[name]=this.is_editable[old];delete this.is_editable[old];if(this&&this.opendocs[old]){local_dt[dt][name]=local_dt[dt][old];local_dt[dt][old]=null;} -delete this.opendocs[old];this.opendocs[name]=true;wn.re_route[window.location.hash]='Form/'+encodeURIComponent(this.doctype)+'/'+encodeURIComponent(name);wn.set_route('Form',this.doctype,name);} +delete this.opendocs[old];this.opendocs[name]=true;wn.re_route[window.location.hash]='#Form/'+encodeURIComponent(this.doctype)+'/'+encodeURIComponent(name);wn.set_route('Form',this.doctype,name);} _f.Frm.prototype.setup_meta=function(){this.meta=get_local('DocType',this.doctype);this.perm=get_perm(this.doctype);if(this.meta.istable){this.meta.in_dialog=1} this.setup_print();} _f.Frm.prototype.setup_sidebar=function(){this.sidebar=new wn.widgets.form.sidebar.Sidebar(this);} diff --git a/public/js/all-web.js b/public/js/all-web.js index 150f298c78..381d5f844f 100644 --- a/public/js/all-web.js +++ b/public/js/all-web.js @@ -136,7 +136,7 @@ throw new SyntaxError('JSON.parse');};}}()); * lib/js/wn/router.js */ wn.re_route={} -wn.route=function(){if(wn.re_route[window.location.hash]){window.location.hash=wn.re_route[window.location.hash];} +wn.route=function(){if(wn.re_route[window.location.hash]){var re_route_val=wn.get_route_str(wn.re_route[window.location.hash]);var cur_route_val=wn.get_route_str(wn._cur_route);if(decodeURIComponent(re_route_val)===decodeURIComponent(cur_route_val)){window.history.back();return;}else{window.location.hash=wn.re_route[window.location.hash];}} wn._cur_route=window.location.hash;route=wn.get_route();switch(route[0]){case"List":wn.views.doclistview.show(route[1]);break;case"Form":if(route.length>3){route[2]=route.splice(2).join('/');} wn.views.formview.show(route[1],route[2]);break;case"Report":wn.views.reportview.show(route[1],route[2]);break;case"Report2":wn.views.reportview2.show();break;default:wn.views.pageview.show(route[0]);}} wn.get_route=function(route){if(!wn.boot){return[window.page_name];}