Fixes blank hover state for Structure field, closes #1891

This commit is contained in:
Aaron Lidman
2013-10-15 10:06:50 -04:00
parent 29469ffb86
commit fd44a6f381
3 changed files with 12 additions and 5 deletions

View File

@@ -207,6 +207,7 @@ en:
check:
yes: Yes
no: No
none: None
background:
title: Background
description: Background settings

View File

@@ -254,7 +254,8 @@
"check": {
"yes": "Yes",
"no": "No"
}
},
"none": "None"
},
"background": {
"title": "Background",

View File

@@ -1,7 +1,7 @@
iD.ui.preset.radio = function(field) {
var event = d3.dispatch('change'),
labels, radios;
labels, radios, placeholder;
function radio(selection) {
selection.classed('preset-radio', true);
@@ -12,9 +12,8 @@ iD.ui.preset.radio = function(field) {
var buttonWrap = wrap.enter().append('div')
.attr('class', 'preset-input-wrap toggle-list');
buttonWrap.append('span')
.attr('class', 'placeholder')
.text(field.placeholder());
placeholder = buttonWrap.append('span')
.attr('class', 'placeholder');
labels = wrap.selectAll('label')
.data(field.options || field.keys);
@@ -59,6 +58,12 @@ iD.ui.preset.radio = function(field) {
labels.classed('active', checked);
radios.property('checked', checked);
var selection = radios.filter(function() { return this.checked; });
if (selection.empty()) {
placeholder.text(t('inspector.none'));
} else {
placeholder.text(selection.attr('value'));
}
};
radio.focus = function() {