diff options
-rw-r--r-- | web/cobrands/fixmystreet/fixmystreet.js | 9 | ||||
-rw-r--r-- | web/js/map-OpenLayers.js | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js index fea863b14..53954f57a 100644 --- a/web/cobrands/fixmystreet/fixmystreet.js +++ b/web/cobrands/fixmystreet/fixmystreet.js @@ -1087,15 +1087,19 @@ fixmystreet.display = { // If this is the first individual report we've loaded, remove the // "all reports" sub_map_links but store them in a global variable // so we can reinsert them when the user returns to the all reports - // view. Also set the Back link to know where to go back to. + // view. if (!fixmystreet.original.sub_map_links) { fixmystreet.original.sub_map_links = $('#sub_map_links').detach(); - $('.js-back-to-report-list').attr('href', location.href); } // With #sub_map_links detached from the DOM, we set up the // individual report's sub_map_links using map_controls(). fixmystreet.set_up.map_controls(); + // Set the Back link to know where to go back to. + // TODO: If you e.g. filter before selecting a report, this URL is + // wrong (but what is shown is correct). + $('.js-back-to-report-list').attr('href', fixmystreet.original.href); + // Problems nearby should act the same as 'Back to all reports' on around, // but on /my and /reports should go to that around page. if (fixmystreet.original.page == 'around') { @@ -1179,6 +1183,7 @@ fixmystreet.display = { $(function() { fixmystreet.original = { + 'href': location.href, 'title': document.title, 'page': fixmystreet.page }; 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() }); } |