]> git.openstreetmap.org Git - nominatim-ui.git/blobdiff - src/handlebar_helpers.js
Further ignore yes (e.g. building=yes) as type when printing results
[nominatim-ui.git] / src / handlebar_helpers.js
index 088d09cbd8ec62b8cff4a4ecfbff318c46d354d2..358ac36ae54613406eda4c363c1efa81acef0b86 100644 (file)
@@ -66,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(
-      '<a href="details.html?osmtype=' + aFeature.osm_type + '&osmid=' + aFeature.osm_id + '&class=' + aFeature.category + '">' + sTitleEscaped + '</a>'
+      '<a href="' + sURL + '">' + sTitleEscaped + '</a>'
     );
   },
   coverageType: function (aPlace) {
@@ -112,8 +117,10 @@ Handlebars.registerHelper({
 
     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