diff options
-rw-r--r-- | web/cobrands/peterborough/assets.js | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/web/cobrands/peterborough/assets.js b/web/cobrands/peterborough/assets.js index 6f5896d72..893e64d9d 100644 --- a/web/cobrands/peterborough/assets.js +++ b/web/cobrands/peterborough/assets.js @@ -37,7 +37,28 @@ fixmystreet.assets.add(defaults, { name: "Adopted Highways" }); -fixmystreet.assets.add(defaults, { +// 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.PeterboroughVectorAsset = 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.PeterboroughVectorAsset' +}); + +var trees_defaults = $.extend(true, {}, defaults, { + class: OpenLayers.Layer.PeterboroughVectorAsset, + select_action: true, + actions: { + asset_found: fixmystreet.message_controller.asset_found, + asset_not_found: fixmystreet.message_controller.asset_not_found + } +}); + +fixmystreet.assets.add(trees_defaults, { http_options: { url: "https://tilma.staging.mysociety.org/mapserver/peterborough", params: { @@ -55,7 +76,7 @@ fixmystreet.assets.add(defaults, { var NEW_TREE_CATEGORY_NAME = 'Request for tree to be planted'; -fixmystreet.assets.add(defaults, { +fixmystreet.assets.add(trees_defaults, { http_options: { url: "https://tilma.staging.mysociety.org/mapserver/peterborough", params: { |