From 453758a9ffdc7048b4a6e1b01676ae1d3bc52342 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sat, 29 Nov 2014 15:23:53 -0500 Subject: [PATCH] use lambda to store currentPage so explore/mine doesn't get rendered incorrectly in url as explore/ --- app/assets/javascripts/src/Metamaps.Views.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/src/Metamaps.Views.js b/app/assets/javascripts/src/Metamaps.Views.js index eab536ba..36fc0d2c 100644 --- a/app/assets/javascripts/src/Metamaps.Views.js +++ b/app/assets/javascripts/src/Metamaps.Views.js @@ -91,8 +91,14 @@ Metamaps.Views.init = function () { } Metamaps.Loading.hide(); - setTimeout(function(){ - var path = Metamaps.currentSection == "" ? "" : "/explore/" + Metamaps.currentPage; + + console.log("OK current page is " + Metamaps.currentPage); + console.log(Metamaps); + setTimeout((function(localCurrentPage){ return function(){ + console.log("YEAH current page is " + Metamaps.currentPage); + console.log("YEAH current page passed is " + localCurrentPage); + console.log(Metamaps); + var path = (Metamaps.currentSection == "") ? "" : "/explore/" + localCurrentPage; // alter url if for mapper profile page if (that.collection && that.collection.mapperId) { @@ -100,7 +106,7 @@ Metamaps.Views.init = function () { } Metamaps.Router.navigate(path); - }, 500); + }})(Metamaps.currentPage), 500); }, handleSuccess: function () { var that = this; @@ -133,4 +139,4 @@ Metamaps.Views.init = function () { Metamaps.Views.exploreMaps = new mapsWrapper(); }; -})(); \ No newline at end of file +})();