]> git.openstreetmap.org Git - nominatim-ui.git/commitdiff
detail page: only load and display parent-of section after button click
authormarc tobias <mtmail@gmx.net>
Thu, 20 Feb 2020 17:47:52 +0000 (18:47 +0100)
committermarc tobias <mtmail@gmx.net>
Thu, 20 Feb 2020 17:47:52 +0000 (18:47 +0100)
src/assets/js/detailpage.js
src/templates/detailspage.hbs

index 9ef2d97d63e0e4752680b80a3ad0f10f5c50c0fd..09a8ce105d12c218aa419073d4517b21243c2b1c 100644 (file)
@@ -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);
 
index a4e510ccb0e185b06b584de1129e180b1db2b0b9..8f9ff76af9e54b9dd26902c30636897369075f39 100644 (file)
             {{/each}}
           {{/if}}
 
+          {{> partial_h2 'Parent Of'}}
           {{#if aPlace.hierarchy}}
-            {{> partial_h2 'Parent Of'}}
 
             {{#each aPlace.hierarchy as |lines type|}}
               {{> partial_h3 type}}
                 {{> partial_details_one_row}}
               {{/each}}
             {{/each}}
+          {{else}}
+            <tr>
+              <td>
+                <a class="btn btn-default btn-xs" href="{{base_url}}&hierarchy=1">display child places</a>
+              </td>
+            </tr>
           {{/if}}
           {{tooManyHierarchyLinesWarning aPlace}}
         </tbody>