mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
Use taginfo for preset comboboxes
This commit is contained in:
+13
-5
@@ -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) {
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
"title": "Internet Access",
|
||||
"type": "select",
|
||||
"options": ["yes", "no", "wlan", "wired", "terminal"]
|
||||
},
|
||||
{
|
||||
"key": "cuisine",
|
||||
"type": "combo"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user