Try to use strings when generating placeholder

This commit is contained in:
Bryan Housel
2014-07-21 15:56:03 -04:00
parent a68cb30fd2
commit 0d5d0b19fc
+10 -4
View File
@@ -37,15 +37,21 @@ iD.ui.preset.typeCombo = function(field) {
.on('change', change)
.on('blur', change)
.each(function() {
var keys = _.keys(strings);
var keys = _.keys(strings),
strs = [],
placeholders;
combobox.data(keys.map(function(k) {
var o = {};
o.title = o.value = strings[k];
var s = strings[k],
o = {};
o.title = o.value = s;
if (s.length < 20) { strs.push(s); }
return o;
}));
placeholders = strs.length ? strs : keys;
input.attr('placeholder', field.placeholder() ||
(keys.length < 3 ? '' : keys.slice(0, 3).join(', ') + '...'));
(placeholders.slice(0, 3).join(', ') + '...'));
});
}