Prefer a key=value match over a key only match for object descriptions
authorTom Hughes <tom@compton.nu>
Mon, 24 Nov 2014 11:00:24 +0000 (11:00 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 24 Nov 2014 11:00:24 +0000 (11:00 +0000)
app/assets/javascripts/index/query.js

index 1f45a687278a37a797576628107037830cb9751a..29916272e6285dfd51db9af120f3119e9944989d 100644 (file)
@@ -95,14 +95,20 @@ OSM.Query = function(map) {
         if (prefixes[key]) {
           if (prefixes[key][value]) {
             return prefixes[key][value];
-          } else {
-            var first = value.substr(0, 1).toUpperCase(),
-              rest = value.substr(1).replace(/_/g, " ");
-
-            return first + rest;
           }
         }
       }
+
+      for (var key in tags) {
+        var value = tags[key];
+
+        if (prefixes[key]) {
+          var first = value.substr(0, 1).toUpperCase(),
+            rest = value.substr(1).replace(/_/g, " ");
+
+          return first + rest;
+        }
+      }
     }
 
     if (!prefix) {