Use taginfo for preset comboboxes

This commit is contained in:
Ansis Brammanis
2013-02-18 16:52:40 -05:00
parent f568985bcf
commit f99a80b52f
2 changed files with 17 additions and 5 deletions
+13 -5
View File
@@ -1,5 +1,6 @@
iD.ui.preset = function() {
var event = d3.dispatch('change'),
taginfo = iD.taginfo(),
hidden,
sections,
exttags,
@@ -84,12 +85,19 @@ iD.ui.preset = function() {
.attr('label', function(d) { return d; });
break;
case 'combo':
var w = this.append('span').attr('class', 'input-wrap-position');
var w = this.append('span').attr('class', 'input-wrap-position'),
combobox = d3.combobox();
i = w.append('input');
w.call(d3.combobox()
.data([''].map(function(o) {
return { value: o, title: o };
})));
w.call(combobox);
taginfo.values({
key: d.key
}, function(err, data) {
if (!err) combobox.data(data.map(function(d) {
d.title = d.value = d.value.replace('_', ' ');
return d;
}));
});
break;
}
if (i) {
+4
View File
@@ -15,6 +15,10 @@
"title": "Internet Access",
"type": "select",
"options": ["yes", "no", "wlan", "wired", "terminal"]
},
{
"key": "cuisine",
"type": "combo"
}
]
},