From: Marc Tobias Metten Date: Thu, 8 Mar 2018 20:59:29 +0000 (+0100) Subject: detailpage: add warning if too many child address lines X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/commitdiff_plain/66f9b3f7c72b20bd01ecfbfc782a4c52900a6602 detailpage: add warning if too many child address lines --- diff --git a/TODO.md b/TODO.md index 21073fb..22d3fd4 100644 --- a/TODO.md +++ b/TODO.md @@ -10,7 +10,6 @@ * need /details to support &format=json * 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 * move this TODO.txt to github issues * write install instructions * check output of /dist into repository diff --git a/src/handlebar_helpers.js b/src/handlebar_helpers.js index f799781..c861966 100644 --- a/src/handlebar_helpers.js +++ b/src/handlebar_helpers.js @@ -100,6 +100,19 @@ Handlebars.registerHelper({ return capitalize(aPlace.type.replace(/_/g, ' ')); } }, + tooManyParentLinesWarning: function(aPlace) { + if (!aPlace.parentof_lines) return; + + var c = 0; + for (var type in aPlace.parentof_lines) { + c = c + type.length+1; + } + if (c < 500) return; + + return new Handlebars.SafeString( + '

There are more child objects which are not shown.

' + ); + }, zoomLevels: function(iSelectedZoom) { var aZoomLevels = [ /* 0 */ 'Continent / Sea', diff --git a/src/templates/detailspage.hbs b/src/templates/detailspage.hbs index 172539c..c7098b4 100644 --- a/src/templates/detailspage.hbs +++ b/src/templates/detailspage.hbs @@ -176,11 +176,8 @@ {{> partial_details_one_row}} {{/each}} {{/each}} - - {{!-- @if (sizeof($aParentOfLines) >= 500) -

There are more child objects which are not shown.

- @end --}} - {{/if}} + {{/if}} + {{tooManyParentLinesWarning aPlace}}