X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/blobdiff_plain/65a67281bcf5f1258512b96136920aceb64a8b23..302bbba7cfc04b0bc90fff9279c587545a9816c4:/src/handlebar_helpers.js?ds=sidebyside
diff --git a/src/handlebar_helpers.js b/src/handlebar_helpers.js
index 6443d37..358ac36 100644
--- a/src/handlebar_helpers.js
+++ b/src/handlebar_helpers.js
@@ -12,6 +12,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 +66,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) {
@@ -104,10 +115,12 @@ 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, ' '));
+ } else if (aPlace.type) {
+ return capitalize(aPlace.type.replace(/_/g, ' '));
}
- return capitalize(aPlace.type.replace(/_/g, ' '));
+ return '';
},
formatSearchRank: function (iRank) {
// same as