Skip to content

Commit

Permalink
router.js: hack, force page reload to avoid some maps api problems
Browse files Browse the repository at this point in the history
  • Loading branch information
trey0 committed Oct 23, 2012
1 parent 2e9b8bf commit 535b4c9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion geocamTiePoint/static/geocamTiePoint/js/backbone/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,25 @@ $(function($) {
view.render();
},

reloadToFixMapIfNeeded: function () {
// HACK: force reload to avoid problems the second time we
// render a map in the same tab
this.numMapViews++;
if (this.numMapViews > 1) {
location.reload();
}
},

viewOverlay: function(overlay_id) {
console.log('Routed to viewOverlay for ' + overlay_id);
this.reloadToFixMapIfNeeded();
var view = new app.views.MapView({id: overlay_id, readonly: true});
view.render();
},

editOverlay: function(overlay_id) {
console.log('Routed to editOverlay for ' + overlay_id);
this.reloadToFixMapIfNeeded();
var view = new app.views.SplitOverlayView({id: overlay_id});
view.render();
},
Expand All @@ -59,14 +70,15 @@ $(function($) {
},

start: function() {
this.numMapViews = 0;
Backbone.history.start();
}
});

app.router = new AppRouter();
//app.router.start();

/*
/*
* Support for undo/redo global functions
*/
window.getState = function() {
Expand Down

0 comments on commit 535b4c9

Please sign in to comment.