X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/blobdiff_plain/9e2946d9a9ff5a1436403dfe051bf9f8866da178..f3a77b08006768e90b0e2d6f7797a610630f5cfd:/dist/handlebar_helpers.js?ds=sidebyside diff --git a/dist/handlebar_helpers.js b/dist/handlebar_helpers.js index 6443d37..e233eb9 100644 --- a/dist/handlebar_helpers.js +++ b/dist/handlebar_helpers.js @@ -1,3 +1,5 @@ +'use strict'; + function formatOSMType(sType, bExcludeExternal) { if (sType === 'N') return 'node'; if (sType === 'W') return 'way'; @@ -12,6 +14,12 @@ function formatOSMType(sType, bExcludeExternal) { } Handlebars.registerHelper({ + shortOSMType: function (sType) { + if (sType === 'node') return 'N'; + if (sType === 'way') return 'W'; + if (sType === 'relation') return 'R'; + return ''; + }, isaddresses_unused: function (aAddressLine) { return ((aAddressLine.isaddress && aAddressLine.isaddress === 'f') ? 'notused' : ''); }, @@ -60,8 +68,13 @@ Handlebars.registerHelper({ var sTitleEscaped = Handlebars.escapeExpression(sTitle || sOSMType + ' ' + aFeature.osm_id); + var sURL = 'details.html?osmtype=' + aFeature.osm_type + '&osmid=' + aFeature.osm_id; + if (aFeature.category) { + sURL = sURL + '&class=' + aFeature.category; + } + return new Handlebars.SafeString( - '' + sTitleEscaped + '' + '' + sTitleEscaped + '' ); }, coverageType: function (aPlace) { @@ -88,7 +101,7 @@ Handlebars.registerHelper({ return (iLevel < 15 ? iLevel : ''); }, formatMapIcon: function (sIcon) { - if (!sIcon) return; + if (!sIcon) return ''; var url = sIcon; if (!url.match(/^http/)) url = get_config_value('Images_Base_Url') + url; @@ -104,10 +117,13 @@ Handlebars.registerHelper({ return s && s[0].toUpperCase() + s.slice(1); } - if (aPlace.type && aPlace.type === 'yes') { + if (aPlace.type && aPlace.type === 'yes' && aPlace.class) { return capitalize(aPlace.class.replace(/_/g, ' ')); } - return capitalize(aPlace.type.replace(/_/g, ' ')); + if (aPlace.type) { + return capitalize(aPlace.type.replace(/_/g, ' ')); + } + return ''; }, formatSearchRank: function (iRank) { // same as @@ -133,13 +149,10 @@ Handlebars.registerHelper({ return 'other: ' + iRank; }, tooManyHierarchyLinesWarning: function (aPlace) { - if (!aPlace.hierarchy) return; + if (!aPlace.hierarchy) return ''; - var c = 0; - for (var type in aPlace.hierarchy) { - c = c + type.length + 1; - } - if (c < 500) return; + var c = Object.keys(aPlace.hierarchy); + if (c < 500) return ''; return new Handlebars.SafeString( '

There are more child objects which are not shown.

' @@ -173,7 +186,9 @@ Handlebars.registerHelper({ var select = $('