aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2019-03-27 17:44:48 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2019-03-27 17:48:15 +0000
commit48c807b87f81ba89732d36b4459a4ca5bd4933ef (patch)
tree62da21e16d69bafe359dfa29e067898c3c2569e5
parentf3b874f79532fc4896e3fbacf0c2bb2d532ed138 (diff)
[Bucks,Oxon] Fix .com RoW message display.
The two functions were conflicting with one another.
-rw-r--r--web/cobrands/buckinghamshire/assets.js9
-rw-r--r--web/cobrands/oxfordshire/assets.js31
-rw-r--r--web/cobrands/oxfordshire/base.scss5
3 files changed, 25 insertions, 20 deletions
diff --git a/web/cobrands/buckinghamshire/assets.js b/web/cobrands/buckinghamshire/assets.js
index 3c030cb18..87b7561b8 100644
--- a/web/cobrands/buckinghamshire/assets.js
+++ b/web/cobrands/buckinghamshire/assets.js
@@ -468,8 +468,15 @@ fixmystreet.assets.add($.extend(true, {}, defaults, {
function check_rights_of_way() {
var relevant_body = OpenLayers.Util.indexOf(fixmystreet.bodies, defaults.body) > -1;
var relevant_cat = $('#form_category').val() == 'Rights of Way';
+ var relevant = relevant_body && relevant_cat;
+ var currently_shown = !!$('#row-message').length;
- if (!relevant_body || !relevant_cat) {
+ if (relevant === currently_shown) {
+ // Either should be shown and already is, or shouldn't be shown and isn't
+ return;
+ }
+
+ if (!relevant) {
$('#row-message').remove();
$('.js-hide-if-invalid-category').show();
return;
diff --git a/web/cobrands/oxfordshire/assets.js b/web/cobrands/oxfordshire/assets.js
index 59a6d777d..819719dc1 100644
--- a/web/cobrands/oxfordshire/assets.js
+++ b/web/cobrands/oxfordshire/assets.js
@@ -1,23 +1,26 @@
(function(){
- function disable_form(disable) {
- $('.js-hide-if-invalid-category').toggle(!disable);
- }
- function check_rights_of_way() {
- if (OpenLayers.Util.indexOf(fixmystreet.bodies, 'Oxfordshire County Council') == -1) {
- $('#occ_prow').remove();
- disable_form(false);
+function check_rights_of_way() {
+ var relevant_body = OpenLayers.Util.indexOf(fixmystreet.bodies, 'Oxfordshire County Council') > -1;
+ var relevant_cat = $('#form_category').val() == 'Countryside Paths / Public Rights of Way (usually not tarmac)';
+ var relevant = relevant_body && relevant_cat;
+ var currently_shown = !!$('#occ_prow').length;
+
+ if (relevant === currently_shown) {
+ // Either should be shown and already is, or shouldn't be shown and isn't
return;
}
- if ($('#form_category').val() == 'Countryside Paths / Public Rights of Way (usually not tarmac)') {
- $('#form_category_row').after('<p id="occ_prow" class="category-message">Please report problems with rights of way using <a href="https://publicrightsofway.oxfordshire.gov.uk/web/standardmap.aspx">this page</a>.</p>');
- disable_form(true);
- } else {
+ if (!relevant) {
$('#occ_prow').remove();
- disable_form(false);
+ $('.js-hide-if-invalid-category').show();
+ return;
}
- }
- $(fixmystreet).on('report_new:category_change', check_rights_of_way);
+ var $msg = $('<p id="occ_prow" class="box-warning">Please report problems with rights of way using <a href="https://publicrightsofway.oxfordshire.gov.uk/web/standardmap.aspx">this page</a>.</p>');
+ $('#form_category_row').after($msg);
+ $('.js-hide-if-invalid-category').hide();
+}
+$(fixmystreet).on('report_new:category_change', check_rights_of_way);
+
})();
diff --git a/web/cobrands/oxfordshire/base.scss b/web/cobrands/oxfordshire/base.scss
index e55769ac7..a14e018b2 100644
--- a/web/cobrands/oxfordshire/base.scss
+++ b/web/cobrands/oxfordshire/base.scss
@@ -287,11 +287,6 @@ textarea {
}
}
-.category-message {
- padding: 1em;
- background-color: $color-oxfordshire-pale-grey-green;
-}
-
.item-list--reports__item {
small {
font-style: inherit;