diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-04-23 09:39:26 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-05-07 15:42:00 +0100 |
commit | 3d4be3e7c53982963d86b9da952c45a2132d91bc (patch) | |
tree | ac12412b6e7e4b620cd3eab65e7638912a43d20c | |
parent | 92b253904062edd533e55c22824de6fd01e2f7c1 (diff) |
[Northamptonshire] Fix issue disabling form.
If you switch from an asset category to a district category,
`asset_not_found()` is called, and would disable the form,
with nothing re-enabling it. This change also pleasingly
gives it the same structure as the road not found call.
-rw-r--r-- | web/cobrands/northamptonshire/assets.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/web/cobrands/northamptonshire/assets.js b/web/cobrands/northamptonshire/assets.js index 36f354761..a03950512 100644 --- a/web/cobrands/northamptonshire/assets.js +++ b/web/cobrands/northamptonshire/assets.js @@ -421,11 +421,18 @@ var northants_defaults = $.extend(true, {}, fixmystreet.assets.alloy_defaults, { $("#overlapping_features_msg").addClass('hidden'); var emergency_state = ncc_is_emergency_category(); - disable_report_form(); - if ((!emergency_state.relevant || emergency_state.body) && this.visibility) { - show_responsibility_error('#js-not-an-asset', this.fixmystreet.asset_item, this.fixmystreet.asset_type); - } else { + if (!layer.visibility) { + if (!emergency_state.relevant || emergency_state.body) { + enable_report_form(); + } hide_responsibility_errors(); + } else { + disable_report_form(); + if (!emergency_state.relevant || emergency_state.body) { + show_responsibility_error('#js-not-an-asset', this.fixmystreet.asset_item, this.fixmystreet.asset_type); + } else { + hide_responsibility_errors(); + } } } } |