diff --git a/data/presets/fields.json b/data/presets/fields.json index e6bc41498..e16b320bc 100644 --- a/data/presets/fields.json +++ b/data/presets/fields.json @@ -367,7 +367,7 @@ }, "cycle_network": { "key": "cycle_network", - "type": "combo", + "type": "networkCombo", "label": "Network" }, "cycleway": { diff --git a/data/presets/fields/cycle_network.json b/data/presets/fields/cycle_network.json index 5565a5dae..3d6974b3d 100644 --- a/data/presets/fields/cycle_network.json +++ b/data/presets/fields/cycle_network.json @@ -1,5 +1,5 @@ { "key": "cycle_network", - "type": "combo", + "type": "networkCombo", "label": "Network" } \ No newline at end of file diff --git a/modules/ui/fields/combo.js b/modules/ui/fields/combo.js index 2e7b3c4d6..fe5bcb903 100644 --- a/modules/ui/fields/combo.js +++ b/modules/ui/fields/combo.js @@ -140,7 +140,8 @@ export function combo(field, context) { function setTaginfoValues(q, callback) { var fn = isMulti ? 'multikeys' : 'values'; var query = (isMulti ? field.key : '') + q; - if (isNetwork && countryCode && countryCode.indexOf(q.toLowerCase()) === 0) { + var hasCountryPrefix = isNetwork && countryCode && countryCode.indexOf(q.toLowerCase()) === 0; + if (hasCountryPrefix) { query = countryCode + ':'; } context.taginfo()[fn]({ @@ -150,6 +151,11 @@ export function combo(field, context) { query: query }, function(err, data) { if (err) return; + if (hasCountryPrefix) { + data = _.filter(data, function(d) { + return d.value.toLowerCase().indexOf(countryCode + ':') === 0; + }); + } comboData = _.map(data, function(d) { var k = d.value; if (isMulti) k = k.replace(field.key, '');