diff options
author | Chris Mytton <chrism@mysociety.org> | 2020-02-12 16:17:19 +0000 |
---|---|---|
committer | Chris Mytton <chrism@mysociety.org> | 2020-02-20 14:01:10 +0000 |
commit | e0718d33c1ba55a3773ec55a8869dff41896c065 (patch) | |
tree | 0d4558efaba6eb65699879f579604a17717e3f59 /web | |
parent | ce5948821df7ce63c32181b419aa26a9de73f330 (diff) |
[Peterborough] Force users to select assets for trees
We always want a tree code for tree reports, so add the code needed to
make the asset selection step mandatory.
Diffstat (limited to 'web')
-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: { |