diff options
author | Matthew Somerville <matthew@mysociety.org> | 2019-11-19 16:48:03 +0000 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2019-12-09 12:50:07 +0000 |
commit | 0c91a1c3cfd0e188a9781501870fb177cf450f99 (patch) | |
tree | d1b7b68507a7aa1b2cf45c2dd9a485f33468506e | |
parent | 6c6c3d0b9dee563b68710db4aeaacda4e960080d (diff) |
[TfL] Link through to .com with correct co-ordinates.
-rw-r--r-- | templates/web/tfl/report/new/roads_message.html | 2 | ||||
-rw-r--r-- | web/cobrands/tfl/js.js | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/templates/web/tfl/report/new/roads_message.html b/templates/web/tfl/report/new/roads_message.html index ad9abd061..85e1650b3 100644 --- a/templates/web/tfl/report/new/roads_message.html +++ b/templates/web/tfl/report/new/roads_message.html @@ -1,7 +1,7 @@ <div id="js-roads-responsibility" class="box-warning hidden"> <div id="js-not-tfl-road" class="hidden js-responsibility-message"> <p>Transport for London does not maintain this road. Please use - <a href="https://www.fixmystreet.com/">FixMyStreet.com</a> to report it + <a class="js-not-tfl-link" href="https://www.fixmystreet.com/report/new?latitude=[% latitude | html %]&longitude=[% longitude | html %]">FixMyStreet.com</a> to report it to the appropriate borough.</p> </div> <div id="js-not-an-asset" class="hidden js-responsibility-message"> diff --git a/web/cobrands/tfl/js.js b/web/cobrands/tfl/js.js index 613c07231..c80036370 100644 --- a/web/cobrands/tfl/js.js +++ b/web/cobrands/tfl/js.js @@ -3,6 +3,20 @@ translation_strings.name.validName = 'Please enter your full name, Transport for London needs this information – if you do not wish your name to be shown on the site, untick the box below'; translation_strings.upload_default_message = 'Drag photo here to upload or <u>browse files</u>'; +fixmystreet.tfl_link_update = function() { + var lat = document.getElementById('fixmystreet.latitude'); + if (!lat) { + return; + } + lat = lat.value; + var lon = document.getElementById('fixmystreet.longitude').value; + $('.js-not-tfl-link').each(function(){ + this.search = 'latitude=' + lat + '&longitude=' + lon; + }); +}; +$(fixmystreet).on('maps:update_pin', fixmystreet.tfl_link_update); +$(fixmystreet).on('report_new:category_change', fixmystreet.tfl_link_update); + $(function() { function update_category_group_label() { var group = $("#report_inspect_form select#category option:selected").closest("optgroup").attr('label'); |