aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--web/cobrands/buckinghamshire/assets.js20
1 files changed, 12 insertions, 8 deletions
diff --git a/web/cobrands/buckinghamshire/assets.js b/web/cobrands/buckinghamshire/assets.js
index 87d700ff1..e11bf1a28 100644
--- a/web/cobrands/buckinghamshire/assets.js
+++ b/web/cobrands/buckinghamshire/assets.js
@@ -219,6 +219,14 @@ var ex_district_categories = [
"Street nameplates"
];
+function category_unselected_or_ex_district() {
+ var cat = $('select#form_category').val();
+ if (cat === "-- Pick a category --" || cat === "Loading..." || OpenLayers.Util.indexOf(ex_district_categories, cat) != -1) {
+ return true;
+ }
+ return false;
+}
+
// We show roads that Bucks are and aren't responsible for, and display a
// message to the user if they click something Bucks don't maintain.
var types_to_show = bucks_types.concat(non_bucks_types);
@@ -305,27 +313,23 @@ fixmystreet.assets.add(defaults, {
fixmystreet.message_controller.road_found(layer, feature, function(feature) {
// If an ex-district category is selected, always allow report
// regardless of road ownership.
- var cat = $('select#form_category').val();
- if (cat === "-- Pick a category --" || OpenLayers.Util.indexOf(ex_district_categories, cat) != -1) {
+ if (category_unselected_or_ex_district()) {
return true;
}
if (OpenLayers.Util.indexOf(bucks_types, feature.attributes.feature_ty) != -1) {
return true;
- } else {
- return false;
}
+ return false;
}, msg_id);
},
not_found: function(layer) {
// If an ex-district category is selected, always allow report.
- var cat = $('select#form_category').val();
- if (cat === "-- Pick a category --" || OpenLayers.Util.indexOf(ex_district_categories, cat) != -1) {
+ fixmystreet.body_overrides.remove_only_send();
+ if (category_unselected_or_ex_district()) {
fixmystreet.body_overrides.allow_send(layer.fixmystreet.body);
- fixmystreet.body_overrides.remove_only_send();
} else {
fixmystreet.body_overrides.do_not_send(layer.fixmystreet.body);
- fixmystreet.body_overrides.remove_only_send();
fixmystreet.message_controller.road_not_found(layer);
}
}