From b263323fe46728f594239819b3153706b449ce61 Mon Sep 17 00:00:00 2001 From: Marc Tobias Metten Date: Thu, 8 Mar 2018 21:36:49 +0100 Subject: [PATCH] detailpage: ask API for addressdetails, childplaces --- TODO.md | 5 +++-- src/assets/js/detailpage.js | 3 +++ src/templates/detailspage.hbs | 9 +++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/TODO.md b/TODO.md index c27300d..21073fb 100644 --- a/TODO.md +++ b/TODO.md @@ -11,16 +11,16 @@ * reverse: zoom not set http://localhost:8000/reverse.html?format=html&lat=52.3755991766591&lon=7.646484374999999&zoom= * details page: add "There are more child objects which are not shown" back in -* details page: nicer 404 * move this TODO.txt to github issues * write install instructions * check output of /dist into repository ## Might never work -* pagination +* pagination. API returns an array whichout indication if more results exist * API returns category, type, but without admin_level we can't derive e.g. state,country * seeting acceptlanguage whichout a server component https://github.com/dansingerman/jQuery-Browser-Language +* nice 404 detail page. The API returns HTTP 400 error instead of an empty data set. ## Unknown @@ -44,6 +44,7 @@ http://localhost:8000/reverse.html?format=html&lat=52.3755991766591&lon=7.646484 * don't copy jquery/leaflet in /src, use dependency manager instead, e.g. https://bower.io/ * add tests with fixtures * concatenate/minify JS and CSS +* detailpage: make linkedplaces, childplaces optional (rarely used? second click to enable?) ## Code cleanup diff --git a/src/assets/js/detailpage.js b/src/assets/js/detailpage.js index 0466670..9ab6cc8 100644 --- a/src/assets/js/detailpage.js +++ b/src/assets/js/detailpage.js @@ -56,6 +56,9 @@ jQuery(document).ready(function(){ place_id: search_params.get('place_id'), osmtype: search_params.get('osmtype'), osmid: search_params.get('osmid'), + addressdetails: 1, + linkedplaces: 1, + childplaces: 1, group_parents: 1, format: 'json' }; diff --git a/src/templates/detailspage.hbs b/src/templates/detailspage.hbs index 5982ee9..172539c 100644 --- a/src/templates/detailspage.hbs +++ b/src/templates/detailspage.hbs @@ -140,10 +140,11 @@ - {{#each aPlace.address_lines}} - {{> partial_details_one_row}} - {{/each}} - + {{#if aPlace.address_lines}} + {{#each aPlace.address_lines}} + {{> partial_details_one_row}} + {{/each}} + {{/if}} {{#if aPlace.linked_lines}} {{> partial_h2 'Linked Places'}} -- 2.39.5