From 0fc6e6b1f6fb58ee1a4c587997e727aafa9a75fa Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Mon, 25 Mar 2019 18:50:44 +0000 Subject: Fetch reporting data if needed, even if no map. --- web/cobrands/fixmystreet/fixmystreet.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js index 0a1e1d2cc..8638c4228 100644 --- a/web/cobrands/fixmystreet/fixmystreet.js +++ b/web/cobrands/fixmystreet/fixmystreet.js @@ -378,8 +378,8 @@ $.extend(fixmystreet.set_up, { // /report/new), fetch it first. That will then automatically call this // function again, due to it calling change() on the category if set. if (!fixmystreet.reporting_data) { - if (fixmystreet.map) { - fixmystreet.update_pin(fixmystreet.map.getCenter(), false); + if (fixmystreet.page === 'new') { + fixmystreet.fetch_reporting_data(); } return; } @@ -1158,6 +1158,15 @@ fixmystreet.update_pin = function(lonlat, savePushState) { } } + fixmystreet.fetch_reporting_data(); + + if (!$('#side-form-error').is(':visible')) { + $('#side-form').show(); + $('#map_sidebar').scrollTop(0); + } +}; + +fixmystreet.fetch_reporting_data = function() { $.getJSON('/report/new/ajax', { latitude: $('#fixmystreet\\.latitude').val(), longitude: $('#fixmystreet\\.longitude').val() @@ -1171,7 +1180,7 @@ fixmystreet.update_pin = function(lonlat, savePushState) { $('body').removeClass('with-notes'); return; } - $('#side-form, #site-logo').show(); + $('#side-form').show(); var old_category_group = $('#category_group').val(), old_category = $("#form_category").val(), filter_category = $("#filter_categories").val(); @@ -1226,12 +1235,6 @@ fixmystreet.update_pin = function(lonlat, savePushState) { $('#js-contribute-as-wrapper').hide(); } }); - - if (!$('#side-form-error').is(':visible')) { - $('#side-form, #site-logo').show(); - $('#map_sidebar').scrollTop(0); - } - }; fixmystreet.display = { -- cgit v1.2.3