From 969cb19b784b65b745d206aad6ac072256eb1e1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Sun, 31 Jul 2016 03:29:15 -0700 Subject: [PATCH 1/3] Include network in relation display name If a relation is tagged with a network, the network is needed alongside the ref to identify the relation. --- modules/util/util.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/util/util.js b/modules/util/util.js index 3b2bca297..377b9be6e 100644 --- a/modules/util/util.js +++ b/modules/util/util.js @@ -29,8 +29,15 @@ export function entityOrMemberSelector(ids, graph) { } export function displayName(entity) { - var localeName = 'name:' + Detect().locale.toLowerCase().split('-')[0]; - return entity.tags[localeName] || entity.tags.name || entity.tags.ref; + var localizedNameKey = 'name:' + Detect().locale.toLowerCase().split('-')[0]; + var name = entity.tags[localizedNameKey] || entity.tags.name; + if (!name && entity.tags.ref) { + name = entity.tags.ref; + if (entity.tags.network) { + name = entity.tags.network + ' ' + name; + } + } + return name; } export function displayType(id) { From 3e9d7c2b639ecc32c353b4df39521ff61174ba79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Tue, 2 Aug 2016 07:06:09 -0700 Subject: [PATCH 2/3] Prefer cycle_network over network --- modules/util/util.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/util/util.js b/modules/util/util.js index 377b9be6e..3222306af 100644 --- a/modules/util/util.js +++ b/modules/util/util.js @@ -29,12 +29,13 @@ export function entityOrMemberSelector(ids, graph) { } export function displayName(entity) { - var localizedNameKey = 'name:' + Detect().locale.toLowerCase().split('-')[0]; - var name = entity.tags[localizedNameKey] || entity.tags.name; + var localizedNameKey = 'name:' + Detect().locale.toLowerCase().split('-')[0] + name = entity.tags[localizedNameKey] || entity.tags.name || '', + network = entity.tags.cycle_network || entity.tags.network; if (!name && entity.tags.ref) { name = entity.tags.ref; - if (entity.tags.network) { - name = entity.tags.network + ' ' + name; + if (network) { + name = network + ' ' + name; } } return name; From e861e08c680272f3a5f32eea77ac7d1b4726d824 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Tue, 2 Aug 2016 07:33:04 -0700 Subject: [PATCH 3/3] Fixed missing comma --- modules/util/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/util/util.js b/modules/util/util.js index 3222306af..62550a198 100644 --- a/modules/util/util.js +++ b/modules/util/util.js @@ -29,7 +29,7 @@ export function entityOrMemberSelector(ids, graph) { } export function displayName(entity) { - var localizedNameKey = 'name:' + Detect().locale.toLowerCase().split('-')[0] + var localizedNameKey = 'name:' + Detect().locale.toLowerCase().split('-')[0], name = entity.tags[localizedNameKey] || entity.tags.name || '', network = entity.tags.cycle_network || entity.tags.network; if (!name && entity.tags.ref) {