From f579795dee9c8b988352df1fb313a244259b2f5b Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Thu, 25 Jul 2013 14:58:20 -0700 Subject: [PATCH] Display features in sidebar list only on search (#1629) --- data/core.yaml | 2 +- dist/locales/en.json | 2 +- js/id/ui/feature_list.js | 11 +++++------ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/data/core.yaml b/data/core.yaml index eee956b15..377d3f806 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -187,7 +187,7 @@ en: search: Search unknown: Unknown incomplete: - feature_list: Feature list + feature_list: Search features edit: Edit feature background: title: Background diff --git a/dist/locales/en.json b/dist/locales/en.json index 2cfe630c5..aa0587a9b 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -230,7 +230,7 @@ "search": "Search", "unknown": "Unknown", "incomplete": "", - "feature_list": "Feature list", + "feature_list": "Search features", "edit": "Edit feature" }, "background": { diff --git a/js/id/ui/feature_list.js b/js/id/ui/feature_list.js index 17da77f09..d25376171 100644 --- a/js/id/ui/feature_list.js +++ b/js/id/ui/feature_list.js @@ -50,21 +50,20 @@ iD.ui.FeatureList = function(context) { graph = context.graph(), q = search.property('value').toLowerCase(); + if (!q) return result; + function addEntity(entity) { if (entity.id in entities || result.length > 200) return; entities[entity.id] = true; - var preset = context.presets().match(entity, graph), - name = iD.util.displayName(entity) || ''; - - if (!q || name.toLowerCase().indexOf(q) >= 0 || - preset.name().toLowerCase().indexOf(q) >= 0) { + var name = iD.util.displayName(entity) || ''; + if (name.toLowerCase().indexOf(q) >= 0) { result.push({ entity: entity, geometry: context.geometry(entity.id), - preset: preset, + preset: context.presets().match(entity, graph), name: name }); }