aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2019-11-15 15:36:18 +0000
committerDave Arter <davea@mysociety.org>2019-12-09 12:50:07 +0000
commit63c3a5092406f49cdbffd0d7d34178baa7e65a0c (patch)
treeeb85835bb94ae493ebe1316e7b64dd09dc1785a0
parentd06536b5db5453d1383e272b83c41a9efd5aff53 (diff)
[TfL] Make sure found/not_found assets fire when needed.
Copied from Northamptonshire code.
-rw-r--r--web/cobrands/tfl/assets.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/web/cobrands/tfl/assets.js b/web/cobrands/tfl/assets.js
index 262039688..832f3c875 100644
--- a/web/cobrands/tfl/assets.js
+++ b/web/cobrands/tfl/assets.js
@@ -191,11 +191,24 @@ if (red_routes_layer) {
});
}
+// This is required so that the found/not found actions are fired on category
+// select and pin move rather than just on asset select/not select.
+OpenLayers.Layer.TfLVectorAsset = OpenLayers.Class(OpenLayers.Layer.VectorAsset, {
+ initialize: function(name, options) {
+ OpenLayers.Layer.VectorAsset.prototype.initialize.apply(this, arguments);
+ $(fixmystreet).on('maps:update_pin', this.checkSelected.bind(this));
+ $(fixmystreet).on('report_new:category_change', this.checkSelected.bind(this));
+ },
+
+ CLASS_NAME: 'OpenLayers.Layer.TfLVectorAsset'
+});
+
/* Point asset layers, bus stops and traffic lights. This comes after the red
* route so its check for asset not clicked on happens after whether red route
* clicked on or not */
var asset_defaults = $.extend(true, {}, defaults, {
+ class: OpenLayers.Layer.TfLVectorAsset,
body: 'TfL',
select_action: true,
no_asset_msg_id: '#js-not-an-asset',