From fd44a6f38163ced9923a4d2ffed1e977cefb63da Mon Sep 17 00:00:00 2001 From: Aaron Lidman Date: Tue, 15 Oct 2013 10:06:50 -0400 Subject: [PATCH] Fixes blank hover state for Structure field, closes #1891 --- data/core.yaml | 1 + dist/locales/en.json | 3 ++- js/id/ui/preset/radio.js | 13 +++++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/data/core.yaml b/data/core.yaml index 95bab2545..fa2ec2bae 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -207,6 +207,7 @@ en: check: yes: Yes no: No + none: None background: title: Background description: Background settings diff --git a/dist/locales/en.json b/dist/locales/en.json index 5d1be3ae0..03f542bca 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -254,7 +254,8 @@ "check": { "yes": "Yes", "no": "No" - } + }, + "none": "None" }, "background": { "title": "Background", diff --git a/js/id/ui/preset/radio.js b/js/id/ui/preset/radio.js index 2d1814e5c..4cc123edc 100644 --- a/js/id/ui/preset/radio.js +++ b/js/id/ui/preset/radio.js @@ -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() {