From 4376afb3a37ace2236de26725af278fdd34740f7 Mon Sep 17 00:00:00 2001 From: marc tobias Date: Thu, 20 Feb 2020 18:47:52 +0100 Subject: [PATCH] detail page: only load and display parent-of section after button click --- src/assets/js/detailpage.js | 4 ++-- src/templates/detailspage.hbs | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/assets/js/detailpage.js b/src/assets/js/detailpage.js index 9ef2d97..09a8ce1 100644 --- a/src/assets/js/detailpage.js +++ b/src/assets/js/detailpage.js @@ -57,7 +57,7 @@ jQuery(document).ready(function () { osmid: search_params.get('osmid'), keywords: search_params.get('keywords'), addressdetails: 1, - hierarchy: 1, + hierarchy: (search_params.get('hierarchy') === '1' ? 1 : 0), group_hierarchy: 1, polygon_geojson: 1, format: 'json' @@ -65,7 +65,7 @@ jQuery(document).ready(function () { if (api_request_params.place_id || (api_request_params.osmtype && api_request_params.osmid)) { fetch_from_api('details', api_request_params, function (aFeature) { - var context = { aPlace: aFeature }; + var context = { aPlace: aFeature, base_url: location.search }; render_template($('main'), 'detailspage-template', context); diff --git a/src/templates/detailspage.hbs b/src/templates/detailspage.hbs index a4e510c..8f9ff76 100644 --- a/src/templates/detailspage.hbs +++ b/src/templates/detailspage.hbs @@ -169,8 +169,8 @@ {{/each}} {{/if}} + {{> partial_h2 'Parent Of'}} {{#if aPlace.hierarchy}} - {{> partial_h2 'Parent Of'}} {{#each aPlace.hierarchy as |lines type|}} {{> partial_h3 type}} @@ -178,6 +178,12 @@ {{> partial_details_one_row}} {{/each}} {{/each}} + {{else}} + + + display child places + + {{/if}} {{tooManyHierarchyLinesWarning aPlace}} -- 2.45.1