diff options
author | Matthew Somerville <matthew@mysociety.org> | 2019-11-11 18:51:35 +0000 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2019-12-09 12:50:07 +0000 |
commit | 46042546c2eae542f47fbb2a0b17ce302750adb6 (patch) | |
tree | cff649814a6ff141463e00c9c10c0a8b63ab1bf9 | |
parent | 63c3a5092406f49cdbffd0d7d34178baa7e65a0c (diff) |
[UK] Switch cobrands to using central TfL handler.
-rw-r--r-- | templates/web/bexley/footer_extra_js.html | 1 | ||||
-rw-r--r-- | templates/web/bromley/footer_extra_js.html | 1 | ||||
-rw-r--r-- | templates/web/fixmystreet-uk-councils/report/new/roads_message.html | 5 | ||||
-rw-r--r-- | templates/web/greenwich/footer_extra_js.html | 13 | ||||
-rw-r--r-- | templates/web/hounslow/footer_extra_js.html | 1 | ||||
-rw-r--r-- | templates/web/westminster/footer_extra_js.html | 1 | ||||
-rw-r--r-- | web/cobrands/bexley/js.js | 27 | ||||
-rw-r--r-- | web/cobrands/bromley/assets.js | 42 | ||||
-rw-r--r-- | web/cobrands/fixmystreet/assets.js | 4 | ||||
-rw-r--r-- | web/cobrands/westminster/assets.js | 26 |
10 files changed, 22 insertions, 99 deletions
diff --git a/templates/web/bexley/footer_extra_js.html b/templates/web/bexley/footer_extra_js.html index f4b5652a1..db48a126c 100644 --- a/templates/web/bexley/footer_extra_js.html +++ b/templates/web/bexley/footer_extra_js.html @@ -7,6 +7,7 @@ IF bodyclass.match('mappage'); version('/vendor/OpenLayers.Projection.OrdnanceSurvey.js'), version('/cobrands/fixmystreet/assets.js'), version('/cobrands/bexley/js.js'), + version('/cobrands/tfl/assets.js'), version('/cobrands/highways/assets.js'), ); END diff --git a/templates/web/bromley/footer_extra_js.html b/templates/web/bromley/footer_extra_js.html index b58dda570..0998a28f4 100644 --- a/templates/web/bromley/footer_extra_js.html +++ b/templates/web/bromley/footer_extra_js.html @@ -9,5 +9,6 @@ version('/cobrands/fixmystreet/assets.js'), version('/cobrands/bromley/map.js'), version('/cobrands/bromley/assets.js'), + version('/cobrands/tfl/assets.js'), ); END %] diff --git a/templates/web/fixmystreet-uk-councils/report/new/roads_message.html b/templates/web/fixmystreet-uk-councils/report/new/roads_message.html new file mode 100644 index 000000000..dbed24eed --- /dev/null +++ b/templates/web/fixmystreet-uk-councils/report/new/roads_message.html @@ -0,0 +1,5 @@ +<div id="js-roads-responsibility" class="box-warning hidden"> + <div id="js-not-an-asset" class="hidden js-responsibility-message"> + <p>Please select <span class="js-roads-asset" data-original="an item">an item</span> from the map on which to make a report.</p> + </div> +</div> diff --git a/templates/web/greenwich/footer_extra_js.html b/templates/web/greenwich/footer_extra_js.html new file mode 100644 index 000000000..7b37893cf --- /dev/null +++ b/templates/web/greenwich/footer_extra_js.html @@ -0,0 +1,13 @@ +[% scripts.push( + version('/cobrands/fixmystreet-uk-councils/js.js'), +) %] +[%~ +IF bodyclass.match('mappage'); + scripts.push( + version('/vendor/OpenLayers.Projection.OrdnanceSurvey.js'), + version('/cobrands/fixmystreet/assets.js'), + version('/cobrands/highways/assets.js'), + version('/cobrands/tfl/assets.js'), + ); +END +%] diff --git a/templates/web/hounslow/footer_extra_js.html b/templates/web/hounslow/footer_extra_js.html index f0b01419e..3970faee6 100644 --- a/templates/web/hounslow/footer_extra_js.html +++ b/templates/web/hounslow/footer_extra_js.html @@ -9,6 +9,7 @@ IF bodyclass.match('mappage'); version('/cobrands/highways/assets.js'), version('/cobrands/hounslow/js.js'), version('/cobrands/hounslow/assets.js'), + version('/cobrands/tfl/assets.js'), ); END %] diff --git a/templates/web/westminster/footer_extra_js.html b/templates/web/westminster/footer_extra_js.html index ec25926c5..33fdb4dc2 100644 --- a/templates/web/westminster/footer_extra_js.html +++ b/templates/web/westminster/footer_extra_js.html @@ -4,6 +4,7 @@ IF bodyclass.match('mappage'); version('/vendor/OpenLayers.Projection.OrdnanceSurvey.js'), version('/cobrands/fixmystreet/assets.js'), version('/cobrands/westminster/assets.js'), + version('/cobrands/tfl/assets.js'), ); END %] diff --git a/web/cobrands/bexley/js.js b/web/cobrands/bexley/js.js index 89f52a7fb..10d675b93 100644 --- a/web/cobrands/bexley/js.js +++ b/web/cobrands/bexley/js.js @@ -136,32 +136,5 @@ fixmystreet.assets.add(defaults, { asset_item: 'public toilet' }); -fixmystreet.assets.add(road_defaults, { - http_options: { - url: "https://tilma.mysociety.org/mapserver/tfl", - params: { - TYPENAME: "RedRoutes" - } - }, - road: true, - all_categories: true, - nearest_radius: 0.1, - actions: { - found: function(layer, feature) { - var category = $('select#form_category').val(), - relevant = (category !== 'Street cleaning'); - if (!fixmystreet.assets.selectedFeature() && relevant) { - fixmystreet.body_overrides.only_send('TfL'); - $('#category_meta').empty(); - } else { - fixmystreet.body_overrides.remove_only_send(); - } - }, - not_found: function(layer) { - fixmystreet.body_overrides.remove_only_send(); - } - } -}); - })(); diff --git a/web/cobrands/bromley/assets.js b/web/cobrands/bromley/assets.js index a0ca82134..397735007 100644 --- a/web/cobrands/bromley/assets.js +++ b/web/cobrands/bromley/assets.js @@ -75,54 +75,12 @@ fixmystreet.assets.add(defaults, { asset_item: 'tree' }); -var bromley_to_tfl = { - 'Enforcement': ['ENF_NUI_SIGN', 'ENF_OBS_HIGH', 'ENF_OHANG_HANG', 'ENF_UNLIC_HIGH'], - 'Graffiti and Flyposting': ['GF_NUI_SIGN'], - 'Parks and Greenspace': ['PG_BLOC_DRAIN', 'PG_FLO_DISP', 'PG_GRASS_CUT'], - 'Street Cleansing': ['SC_BLOCK_DRAIN'], - 'Road and Pavement Issues': true, - 'Street Lighting and Road Signs': true, - 'Public Trees': true -}; -var tfl_asset_categories = Object.keys(bromley_to_tfl); - $(function(){ $("#problem_form").on("change.category", "#form_service_sub_code", function() { $(fixmystreet).trigger('report_new:category_change'); }); }); -fixmystreet.assets.add(defaults, { - http_options: { - params: { - TYPENAME: "TFL_Red_Route" - } - }, - stylemap: fixmystreet.assets.stylemap_invisible, - always_visible: true, - - asset_category: tfl_asset_categories, - non_interactive: true, - road: true, - body: 'Bromley Council', - actions: { - found: function(layer, feature) { - var category = $('select#form_category').val(), - subcategory = $('#form_service_sub_code').val(), - subcategories = bromley_to_tfl[category], - relevant = (subcategories === true || (subcategory && OpenLayers.Util.indexOf(subcategories, subcategory) > -1)); - if (!fixmystreet.assets.selectedFeature() && relevant) { - fixmystreet.body_overrides.only_send('TfL'); - } else { - fixmystreet.body_overrides.remove_only_send(); - } - }, - not_found: function(layer) { - fixmystreet.body_overrides.remove_only_send(); - } - } -}); - var prow_stylemap = new OpenLayers.StyleMap({ 'default': new OpenLayers.Style({ fill: false, diff --git a/web/cobrands/fixmystreet/assets.js b/web/cobrands/fixmystreet/assets.js index d9c4dc209..327c31346 100644 --- a/web/cobrands/fixmystreet/assets.js +++ b/web/cobrands/fixmystreet/assets.js @@ -1119,7 +1119,6 @@ fixmystreet.message_controller = (function() { } function is_matching_stopper(stopper, i) { - var only_send = fixmystreet.body_overrides.get_only_send(); var body = $('#form_category').data('body'); if (OpenLayers.Util.indexOf(ignored_bodies, body) > -1) { @@ -1130,9 +1129,6 @@ fixmystreet.message_controller = (function() { if (category != stopper.category) { return false; } - if (only_send == 'TfL') { - return false; - } if (stopper.answers) { var answer = $('#form_' + stopper.code).val(); diff --git a/web/cobrands/westminster/assets.js b/web/cobrands/westminster/assets.js index 97f93a4d2..408d62041 100644 --- a/web/cobrands/westminster/assets.js +++ b/web/cobrands/westminster/assets.js @@ -88,32 +88,6 @@ fixmystreet.assets.add(defaults, { } }); -fixmystreet.assets.add(defaults, { - http_options: { - url: url_base + '2/query?' - }, - asset_category: 'Road or pavement damage', - non_interactive: true, - road: true, - nearest_radius: 25, - stylemap: fixmystreet.assets.stylemap_invisible, - actions: { - found: function(layer, feature) { - if (!fixmystreet.assets.selectedFeature()) { - fixmystreet.body_overrides.only_send('TfL'); - $('#category_meta').empty(); - } else { - fixmystreet.body_overrides.remove_only_send(); - } - fixmystreet.message_controller.check_for_stopper(); - }, - not_found: function(layer) { - fixmystreet.body_overrides.remove_only_send(); - fixmystreet.message_controller.check_for_stopper(); - } - } -}); - var layer_data = [ { category: [ 'Food safety/hygiene' ] }, { category: 'Damaged, dirty, or missing bin', subcategories: [ '1', '4' ], subcategory_id: '#form_bin_type' }, |