aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2018-05-16 14:21:19 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-08-06 09:32:27 +0100
commit18e74eeb512c2824ca43c54fead5ba63d04f361b (patch)
tree31d6aa874a43cc724003d2c41264f1ba06d94f0c
parentb8e851216b28394181c1e695ccc1aaf6b920fc9c (diff)
[Buckinghamshire] Display not-road message better.
is_only_body() checks if the supplied body is the only one listed in fixmystreet.bodies and hence if it's the only one that reports for the current pin position will be sent to.
-rw-r--r--web/cobrands/buckinghamshire/assets.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/web/cobrands/buckinghamshire/assets.js b/web/cobrands/buckinghamshire/assets.js
index a67f16a4e..9b392daba 100644
--- a/web/cobrands/buckinghamshire/assets.js
+++ b/web/cobrands/buckinghamshire/assets.js
@@ -149,6 +149,13 @@ function enable_report_form() {
$("#problem_form").show();
}
+function is_only_body(body) {
+ if (fixmystreet.bodies && fixmystreet.bodies.length == 1 && fixmystreet.bodies[0] == body) {
+ return true;
+ }
+ return false;
+}
+
fixmystreet.assets.add($.extend(true, {}, defaults, {
http_options: {
params: {
@@ -171,7 +178,7 @@ fixmystreet.assets.add($.extend(true, {}, defaults, {
} else if (OpenLayers.Util.indexOf(bucks_types, feature.attributes.feature_ty) != -1) {
hide_responsibility_errors();
enable_report_form();
- } else {
+ } else if (is_only_body(layer.fixmystreet.body)) {
// User has clicked a road that Bucks don't maintain.
show_responsibility_error("#js-not-council-road");
disable_report_form();
@@ -185,7 +192,7 @@ fixmystreet.assets.add($.extend(true, {}, defaults, {
if (fixmystreet.assets.selectedFeature()) {
hide_responsibility_errors();
enable_report_form();
- } else {
+ } else if (is_only_body(layer.fixmystreet.body)){
show_responsibility_error("#js-not-a-road");
disable_report_form();
}