From ba6d96eb0f45d95034e4fd9c7204fade7876b4b3 Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Tue, 27 Mar 2018 17:34:51 +0100 Subject: let road layers define their own found/not_found actions Default to setting or unsetting single_body_only but if there is an action defined in the layer then call that instead --- web/cobrands/fixmystreet/assets.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'web') diff --git a/web/cobrands/fixmystreet/assets.js b/web/cobrands/fixmystreet/assets.js index 8df7680e9..c27ca0b79 100644 --- a/web/cobrands/fixmystreet/assets.js +++ b/web/cobrands/fixmystreet/assets.js @@ -94,7 +94,7 @@ fixmystreet.roads = { if (selected_road) { fixmystreet.roads.found(road_layer); } else { - fixmystreet.roads.not_found(); + fixmystreet.roads.not_found(road_layer); } } else { fixmystreet.roads.not_found(); @@ -102,20 +102,19 @@ fixmystreet.roads = { }, found: function(layer) { - var msg = "This road may not be the responsibility of Bromley Borough Council"; - if ( $('#road-warning').length ) { - $('#road-warning').text(msg); + if (layer.fixmystreet.actions) { + layer.fixmystreet.actions.found(layer); } else { - $('.change_location').after('
' + msg + '
'); + $('#single_body_only').val(layer.fixmystreet.body); } - $('#single_body_only').val(layer.fixmystreet.body); }, - not_found: function() { - if ( $('#road-warning').length ) { - $('#road-warning').remove(); + not_found: function(layer) { + if (layer && layer.fixmystreet.actions) { + layer.fixmystreet.actions.not_found(layer); + } else { + $('#single_body_only').val(''); } - $('#single_body_only').val(''); }, }; -- cgit v1.2.3