aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2019-03-25 18:50:44 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2019-03-28 13:06:33 +0000
commit0fc6e6b1f6fb58ee1a4c587997e727aafa9a75fa (patch)
tree925b4306ffa4b6867615b2a16183873739e95eb1
parente306b7d2bc269f58f5feca9497cba031929d6e70 (diff)
Fetch reporting data if needed, even if no map.
-rw-r--r--web/cobrands/fixmystreet/fixmystreet.js21
1 files 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 = {