From c031fc02119b5d1fe9bebe78bcadfdf6ff5270d5 Mon Sep 17 00:00:00 2001 From: Dave Arter Date: Mon, 4 Mar 2019 16:23:04 +0000 Subject: Set this to the current Layer in asset_found/asset_not_found calls --- web/cobrands/buckinghamshire/assets.js | 12 ++++++------ web/cobrands/fixmystreet/assets.js | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/web/cobrands/buckinghamshire/assets.js b/web/cobrands/buckinghamshire/assets.js index e0b6f729b..7fb0f8833 100644 --- a/web/cobrands/buckinghamshire/assets.js +++ b/web/cobrands/buckinghamshire/assets.js @@ -104,18 +104,18 @@ var labeled_defaults = $.extend(true, {}, defaults, { stylemap: streetlight_stylemap, feature_code: 'feature_id', actions: { - asset_found: function(asset, config) { - var id = asset.attributes[config.feature_code] || ''; + asset_found: function(asset) { + var id = asset.attributes[this.fixmystreet.feature_code] || ''; if (id !== '') { var code = id.replace(/[0-9]/g, ''); - var asset_name = streetlight_code_to_type[code] || config.asset_item; + var asset_name = streetlight_code_to_type[code] || this.fixmystreet.asset_item; $('.category_meta_message').html('You have selected ' + asset_name + ' ' + id + ''); } else { - $('.category_meta_message').html('You can pick a ' + config.asset_item + ' from the map »'); + $('.category_meta_message').html('You can pick a ' + this.fixmystreet.asset_item + ' from the map »'); } }, - asset_not_found: function(config) { - $('.category_meta_message').html('You can pick a ' + config.asset_item + ' from the map »'); + asset_not_found: function() { + $('.category_meta_message').html('You can pick a ' + this.fixmystreet.asset_item + ' from the map »'); } } }); diff --git a/web/cobrands/fixmystreet/assets.js b/web/cobrands/fixmystreet/assets.js index d22db7bed..732bcb1ef 100644 --- a/web/cobrands/fixmystreet/assets.js +++ b/web/cobrands/fixmystreet/assets.js @@ -112,13 +112,13 @@ OpenLayers.Layer.VectorAsset = OpenLayers.Class(OpenLayers.Layer.Vector, { asset_found: function() { if (this.fixmystreet.actions) { - this.fixmystreet.actions.asset_found(fixmystreet.assets.selectedFeature(), this.fixmystreet); + this.fixmystreet.actions.asset_found.call(this, fixmystreet.assets.selectedFeature()); } }, asset_not_found: function() { if (this.fixmystreet.actions) { - this.fixmystreet.actions.asset_not_found(this.fixmystreet); + this.fixmystreet.actions.asset_not_found.call(this); } }, -- cgit v1.2.3