From e12e5a7685b4ae5dcfeaf931adde2dbb91ef745f Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Fri, 21 Oct 2016 19:59:05 +0100 Subject: Store and use initial URL to fix JavaScript bugs. If you were on a body page, selected a report, then another report, the "Back to all reports" link then had an incorrect URL. Also, going "Back to all reports" after one report would fetch an incorrect Ajax query of reports to show (as the URL had not yet been updated). Both of these are fixed by storing the URL on page load, and using that for the "Back to all reports" link and the URL used by the Ajax call. There is still an issue with the URL shown if you filter, then select a report, then click "Back to all reports", but the contents are okay. --- web/js/map-OpenLayers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'web/js/map-OpenLayers.js') diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js index 553823818..afe47b4e7 100644 --- a/web/js/map-OpenLayers.js +++ b/web/js/map-OpenLayers.js @@ -435,7 +435,7 @@ var fixmystreet = fixmystreet || {}; if (fixmystreet.page == 'reports' || fixmystreet.page == 'my') { pin_layer_options.strategies = [ new OpenLayers.Strategy.FixMyStreetFixed() ]; pin_layer_options.protocol = new OpenLayers.Protocol.FixMyStreet({ - url: '?ajax=1', + url: fixmystreet.original.href.split('?')[0] + '?ajax=1', format: new OpenLayers.Format.FixMyStreet() }); } -- cgit v1.2.3