diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/cobrands/fixmystreet-uk-councils/alloy.js | 5 | ||||
-rw-r--r-- | web/cobrands/fixmystreet/assets.js | 2 | ||||
-rw-r--r-- | web/cobrands/northamptonshire/assets.js | 49 |
3 files changed, 40 insertions, 16 deletions
diff --git a/web/cobrands/fixmystreet-uk-councils/alloy.js b/web/cobrands/fixmystreet-uk-councils/alloy.js index 1ceabef66..1ade3a1fa 100644 --- a/web/cobrands/fixmystreet-uk-councils/alloy.js +++ b/web/cobrands/fixmystreet-uk-councils/alloy.js @@ -11,7 +11,7 @@ OpenLayers.Protocol.Alloy = OpenLayers.Class(OpenLayers.Protocol.HTTP, { var rresp; var start = new Date(); var max = all_tiles.length; - $(fixmystreet).trigger('alloy:start_request', [start, max]); + options.scope.newRequest(start, max); for (var i = 0; i < max; i++) { var resp = new OpenLayers.Protocol.Response({requestType: "read"}); resp.start = start; @@ -69,9 +69,8 @@ OpenLayers.Strategy.Alloy = OpenLayers.Class(OpenLayers.Strategy.FixMyStreet, { requestStart: 0, initialize: function(name, options) { OpenLayers.Strategy.FixMyStreet.prototype.initialize.apply(this, arguments); - $(fixmystreet).on('alloy:start_request', this.newRequest.bind(this)); }, - newRequest: function(evt, start, max) { + newRequest: function(start, max) { this.max = max; this.requestStart = start; this.count = 0; diff --git a/web/cobrands/fixmystreet/assets.js b/web/cobrands/fixmystreet/assets.js index e4a48dc34..8b121066b 100644 --- a/web/cobrands/fixmystreet/assets.js +++ b/web/cobrands/fixmystreet/assets.js @@ -405,6 +405,8 @@ function layer_visibilitychanged() { this.road_not_found(); } return; + } else if (!this.getVisibility()) { + this.asset_not_found(); } check_zoom_message_visibility.call(this); diff --git a/web/cobrands/northamptonshire/assets.js b/web/cobrands/northamptonshire/assets.js index 9d27933f0..36f354761 100644 --- a/web/cobrands/northamptonshire/assets.js +++ b/web/cobrands/northamptonshire/assets.js @@ -30,6 +30,11 @@ function disable_report_form() { $(".js-hide-if-invalid-category").hide(); } +var is_live = false; +if ( location.hostname === 'www.fixmystreet.com' || location.hostname == 'fixmystreet.northamptonshire.gov.uk' ) { + is_live = true; +} + var layers = [ /* { @@ -267,8 +272,8 @@ var layers = [ "categories": [ "Damaged / Missing / Facing Wrong Way", "Obscured by vegetation or Dirty" ], "item_name": "sign", "layer_name": "Signs", - "layer": 60, - "version": "60.2113-" + "layer": is_live ? 60 : 303, + "version": is_live ? "60.2113-" : "303.1-" }, { "categories": [ "Shelter Damaged", "Sign/Pole Damaged" ], @@ -322,12 +327,10 @@ var layers = [ { "categories": [ "Fallen Tree", - "Restricted Visibility / Overgrown / Overhanging", - "Restricted Visibility", ], "layer_name": "Tree", - "layer": 307, - "version": "307.1-" + "layer": is_live ? 307 : 228, + "version": is_live ? "307.1-" : "228.24-" }, { "categories": [ "Safety Bollard - Damaged/Missing" ], @@ -343,6 +346,7 @@ $(fixmystreet).on('report_new:highways_change', function() { if (fixmystreet.body_overrides.get_only_send() === 'Highways England') { hide_responsibility_errors(); enable_report_form(); + $('#ncc_streetlights').remove(); } else { $(fixmystreet).trigger('report_new:category_change', [ $('#form_category') ]); } @@ -360,10 +364,6 @@ OpenLayers.Layer.NCCVectorAsset = OpenLayers.Class(OpenLayers.Layer.VectorAsset, CLASS_NAME: 'OpenLayers.Layer.NCCVectorAsset' }); -var is_live = false; -if ( location.hostname === 'www.fixmystreet.com' || location.hostname == 'fixmystreet.northamptonshire.gov.uk' ) { - is_live = true; -} // default options for northants assets include // a) checking for multiple assets in same location // b) preventing submission unless an asset is selected @@ -422,7 +422,7 @@ var northants_defaults = $.extend(true, {}, fixmystreet.assets.alloy_defaults, { var emergency_state = ncc_is_emergency_category(); disable_report_form(); - if (!emergency_state.relevant || emergency_state.body) { + 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 { hide_responsibility_errors(); @@ -536,8 +536,8 @@ var highways_style = new OpenLayers.Style({ fixmystreet.assets.add($.extend(true, {}, northants_road_defaults, { protocol_class: OpenLayers.Protocol.Alloy, http_options: { - layerid: 20, - layerVersion: '20.123-', + layerid: is_live ? 20 : 308, + layerVersion: is_live ? '20.123-' : '308.8-', }, stylemap: new OpenLayers.StyleMap({ 'default': highways_style @@ -568,6 +568,8 @@ fixmystreet.assets.add($.extend(true, {}, northants_road_defaults, { "Icy Footpath", "Icy Road", "Missed published Gritted Route", + "Restricted Visibility / Overgrown / Overhanging", + "Restricted Visibility", ] })); @@ -628,4 +630,25 @@ function check_emergency() { } $(fixmystreet).on('report_new:category_change', check_emergency); +function ncc_check_streetlights() { + var relevant_body = OpenLayers.Util.indexOf(fixmystreet.bodies, northants_defaults.body) > -1; + var relevant_cat = $('#form_category').val() == 'Street lighting'; + var relevant = relevant_body && relevant_cat; + var currently_shown = !!$('#ncc_streetlights').length; + + if (relevant === currently_shown || fixmystreet.body_overrides.get_only_send() == 'Highways England') { + return; + } + + if (!relevant) { + $('#ncc_streetlights').remove(); + return; + } + + var $msg = $('<p id="ncc_streetlights" class="box-warning">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.</p>'); + $msg.insertBefore('#js-post-category-messages'); + disable_report_form(); +} +$(fixmystreet).on('report_new:category_change', ncc_check_streetlights); + })(); |