diff options
author | Matthew Somerville <matthew@mysociety.org> | 2015-06-19 19:07:19 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2015-07-28 16:12:53 +0100 |
commit | a6390b55a0f05ef348b831ad76ce07834ac26e7e (patch) | |
tree | 698061b52e15a35adf9a410c442213c5ec5c3da7 /web/js/map-OpenLayers.js | |
parent | 2649ef1e9f57fedde8eb77754c5213732d2bb973 (diff) |
If only one category, be sure to fetch extras for it.
Diffstat (limited to 'web/js/map-OpenLayers.js')
-rw-r--r-- | web/js/map-OpenLayers.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js index a0ab4f34c..7b7bee7e8 100644 --- a/web/js/map-OpenLayers.js +++ b/web/js/map-OpenLayers.js @@ -9,8 +9,8 @@ function fixmystreet_update_pin(lonlat) { document.getElementById('fixmystreet.longitude').value = lonlat.lon || lonlat.x; $.getJSON('/report/new/ajax', { - latitude: $('#fixmystreet\\.latitude').val(), - longitude: $('#fixmystreet\\.longitude').val() + latitude: $('#fixmystreet\\.latitude').val(), + longitude: $('#fixmystreet\\.longitude').val() }, function(data) { if (data.error) { if (!$('#side-form-error').length) { @@ -29,6 +29,7 @@ function fixmystreet_update_pin(lonlat) { if ( lb.length === 0 ) { lb = $('#form_name').prev(); } lb.before(data.extra_name_info); } + // If the category filter appears on the map and the user has selected // something from it, then pre-fill the category field in the report, // if it's a value already present in the drop-down. @@ -36,6 +37,11 @@ function fixmystreet_update_pin(lonlat) { if (category !== undefined && $("#form_category option[value="+category+"]").length) { $("#form_category").val(category); } + + var category_select = $("select#form_category"); + if (category_select.val() != '-- Pick a category --') { + category_select.change(); + } }); if (!$('#side-form-error').is(':visible')) { |