diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/cobrands/bexley/js.js | 23 | ||||
-rw-r--r-- | web/cobrands/bristol/assets.js | 17 | ||||
-rw-r--r-- | web/cobrands/buckinghamshire/assets.js | 6 | ||||
-rw-r--r-- | web/cobrands/fixmystreet/assets.js | 25 | ||||
-rw-r--r-- | web/cobrands/fixmystreet/fixmystreet.js | 12 | ||||
-rw-r--r-- | web/cobrands/northamptonshire/assets.js | 17 | ||||
-rw-r--r-- | web/cobrands/oxfordshire/assets.js | 5 |
7 files changed, 26 insertions, 79 deletions
diff --git a/web/cobrands/bexley/js.js b/web/cobrands/bexley/js.js index f2ee820b2..d0f2e8963 100644 --- a/web/cobrands/bexley/js.js +++ b/web/cobrands/bexley/js.js @@ -111,28 +111,5 @@ fixmystreet.assets.add(defaults, { asset_item: 'public toilet' }); -// We need to trigger the below function on subcategory change also -$(function(){ - $("#problem_form").on("change.category", "#form_DALocation", function() { - $(fixmystreet).trigger('report_new:category_change'); - }); -}); - -fixmystreet.message_controller.register_category({ - body: defaults.body, - category: function() { - var cat = $('#form_category').val(); - if (cat === 'Dead animal') { - var where = $('#form_DALocation').val(); - if (where === 'Garden' || where === 'Other private property') { - return true; - } - } - return false; - }, - keep_category_extras: true, - message: 'Please follow the link below to pay to remove a dead animal from a private property.' -}); - })(); diff --git a/web/cobrands/bristol/assets.js b/web/cobrands/bristol/assets.js index d770b45d6..01abb028c 100644 --- a/web/cobrands/bristol/assets.js +++ b/web/cobrands/bristol/assets.js @@ -80,21 +80,4 @@ fixmystreet.assets.add(options, { filter_value: 'S180' }); -var redirects = { - "Abandoned vehicles": "https://www.bristol.gov.uk/streets-travel/abandoned-vehicles", - "Flytipping": "https://www.bristol.gov.uk/streets-travel/flytipping", - "Flyposting": "https://www.bristol.gov.uk/streets-travel/flyposting", - "Graffiti": "https://www.bristol.gov.uk/streets-travel/graffiti", - "Dog fouling": "https://www.bristol.gov.uk/streets-travel/dog-fouling", - "Street cleaning": "https://www.bristol.gov.uk/streets-travel/street-that-needs-cleaning" -}; - -$.each(redirects, function(name, value) { - fixmystreet.message_controller.register_category({ - body: options.body, - category: name, - message: 'If you wish to report an issue with ' + name + ', please use <a href="' + value + '">this service</a>.' - }); -}); - })(); diff --git a/web/cobrands/buckinghamshire/assets.js b/web/cobrands/buckinghamshire/assets.js index fe54c32fe..1cf5b236c 100644 --- a/web/cobrands/buckinghamshire/assets.js +++ b/web/cobrands/buckinghamshire/assets.js @@ -371,10 +371,4 @@ fixmystreet.assets.add(defaults, { } }); -fixmystreet.message_controller.register_category({ - body: defaults.body, - category: 'Rights of Way', - message: 'If you wish to report an issue on a Public Right of Way, please use <a href="https://www.buckscc.gov.uk/services/environment/public-rights-of-way/report-a-rights-of-way-issue/">this service</a>.' -}); - })(); diff --git a/web/cobrands/fixmystreet/assets.js b/web/cobrands/fixmystreet/assets.js index a00adb055..0ce6c7624 100644 --- a/web/cobrands/fixmystreet/assets.js +++ b/web/cobrands/fixmystreet/assets.js @@ -1015,7 +1015,8 @@ must be on a road, taking into account Highways England roads. fixmystreet.message_controller = (function() { var stopperId = 'js-category-stopper', - stoppers = []; + stoppers = [], + ignored_bodies = []; // This shows an error message because e.g. an asset isn't selected or a road hasn't been clicked function show_responsibility_error(id, asset_item, asset_type) { @@ -1107,19 +1108,11 @@ fixmystreet.message_controller = (function() { var $id = $('#' + stopperId); var body = $('#form_category').data('body'); var matching = $.grep(stoppers, function(stopper, i) { - if (stopper.staff_ignore && body) { + if (OpenLayers.Util.indexOf(ignored_bodies, body) > -1) { return false; } - var relevant_body = OpenLayers.Util.indexOf(fixmystreet.bodies, stopper.body) > -1; - var relevant_cat; - if (typeof stopper.category === 'function') { - relevant_cat = stopper.category(); - } else { - relevant_cat = $('#form_category').val() == stopper.category; - } - var relevant = relevant_body && relevant_cat; - return relevant; + return $('#form_category').val() == stopper.category; }); if (!matching.length) { @@ -1135,7 +1128,7 @@ fixmystreet.message_controller = (function() { if (typeof stopper.message === 'function') { $msg = stopper.message(); } else { - $msg = $('<p class="box-warning">' + stopper.message + '</p>'); + $msg = $('<div class="box-warning">' + stopper.message + '</div>'); } $msg.attr('id', stopperId); $msg.attr('role', 'alert'); @@ -1200,6 +1193,14 @@ fixmystreet.message_controller = (function() { register_category: function(params) { stoppers.push(params); + }, + + unregister_all_categories: function() { + stoppers = []; + }, + + add_ignored_body: function(body) { + ignored_bodies.push(body); } }; diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js index 704a665ff..40b098973 100644 --- a/web/cobrands/fixmystreet/fixmystreet.js +++ b/web/cobrands/fixmystreet/fixmystreet.js @@ -1256,6 +1256,18 @@ fixmystreet.fetch_reporting_data = function() { fixmystreet.update_councils_text(data); $('#js-top-message').html(data.top_message || ''); + if (fixmystreet.message_controller) { + fixmystreet.message_controller.unregister_all_categories(); + $.each(data.by_category, function(category, details) { + if (details.disable_form) { + fixmystreet.message_controller.register_category({ + category: category, + message: details.disable_form + }); + } + }); + } + $('#form_category_row').html(data.category); if ($("#form_category option[value=\"" + old_category + "\"]").length) { $("#form_category").val(old_category); diff --git a/web/cobrands/northamptonshire/assets.js b/web/cobrands/northamptonshire/assets.js index 07745ac8b..dcbb599ff 100644 --- a/web/cobrands/northamptonshire/assets.js +++ b/web/cobrands/northamptonshire/assets.js @@ -552,21 +552,6 @@ fixmystreet.assets.add(northants_road_defaults, { ] }); -fixmystreet.message_controller.register_category({ - body: northants_defaults.body, - category: function() { - return !!$('label[for=form_emergency]').length; - }, - message: function() { - return $('<div class="box-warning">' + $('label[for=form_emergency]').html() + '</div>'); - }, - staff_ignore: true -}); - -fixmystreet.message_controller.register_category({ - body: northants_defaults.body, - category: 'Street lighting', - message: 'Street lighting in Northamptonshire is maintained by Balfour Beatty on behalf of the County Council under a Street Lighting Private Finance Initiative (PFI) contract. Please view our <b><a href="https://www3.northamptonshire.gov.uk/councilservices/northamptonshire-highways/roads-and-streets/Pages/street-lighting.aspx">Street Lighting</a></b> page to report any issues.' -}); +fixmystreet.message_controller.add_ignored_body(northants_defaults.body); })(); diff --git a/web/cobrands/oxfordshire/assets.js b/web/cobrands/oxfordshire/assets.js deleted file mode 100644 index df60b89c7..000000000 --- a/web/cobrands/oxfordshire/assets.js +++ /dev/null @@ -1,5 +0,0 @@ -fixmystreet.message_controller.register_category({ - body: 'Oxfordshire County Council', - category: 'Countryside Paths / Public Rights of Way (usually not tarmac)', - message: 'Please report problems with rights of way using <a href="https://publicrightsofway.oxfordshire.gov.uk/web/standardmap.aspx">this page</a>.' -}); |