aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2018-03-27 17:34:51 +0100
committerDave Arter <davea@mysociety.org>2018-04-03 11:08:21 +0100
commitba6d96eb0f45d95034e4fd9c7204fade7876b4b3 (patch)
tree1758ed0a50c709a91ceb7bf8f4cba9b53462d177
parent3c21d8a9793ee7d80a76df278811627e5af88b8f (diff)
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
-rw-r--r--web/cobrands/fixmystreet/assets.js19
1 files changed, 9 insertions, 10 deletions
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('<div class="box-warning" id="road-warning">' + msg + '</div>');
+ $('#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('');
},
};