From 27c3e4ce5d7042c729f2c74969e82d5425128956 Mon Sep 17 00:00:00 2001 From: Aaron Lidman Date: Tue, 15 Oct 2013 10:55:53 -0400 Subject: [PATCH] Moved localized delete button to the label, closes #1892 --- css/app.css | 5 ++++- js/id/ui/preset/localized.js | 36 ++++++++++++++++++------------------ 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/css/app.css b/css/app.css index 1f8342d6b..5867beefb 100644 --- a/css/app.css +++ b/css/app.css @@ -1516,11 +1516,14 @@ input[type=number] { } .form-field .localized-wrap .entry .localized-value { - padding-right: 10%; border-top-width: 0; border-radius: 0 0 4px 4px; } +.form-field .localized-wrap .form-label button { + border-top-right-radius: 3px; +} + /* Preset form address */ .form-field .addr-housename { diff --git a/js/id/ui/preset/localized.js b/js/id/ui/preset/localized.js index 708c3360a..f20d93d33 100644 --- a/js/id/ui/preset/localized.js +++ b/js/id/ui/preset/localized.js @@ -113,11 +113,28 @@ iD.ui.preset.localized = function(field, context) { var wrap = d3.select(this); var langcombo = d3.combobox().fetcher(fetcher); - wrap.append('label') + var label = wrap.append('label') .attr('class','form-label') .text(t('translate.localized_translation_label')) .attr('for','localized-lang'); + label.append('button') + .attr('class', 'minor remove') + .on('click', function(d){ + d3.event.preventDefault(); + var t = {}; + t[key(d.lang)] = undefined; + event.change(t); + d3.select(this.parentNode.parentNode) + .style('top','0') + .style('max-height','240px') + .transition() + .style('opacity', '0') + .style('max-height','0px') + .remove(); + }) + .append('span').attr('class', 'icon delete'); + wrap.append('input') .attr('class', 'localized-lang') .attr('type', 'text') @@ -132,23 +149,6 @@ iD.ui.preset.localized = function(field, context) { .attr('type', 'text') .attr('placeholder', t('translate.localized_translation_name')) .attr('class', 'localized-value'); - - wrap.append('button') - .attr('class', 'minor button-input-action remove') - .on('click', function(d) { - d3.event.preventDefault(); - var t = {}; - t[key(d.lang)] = undefined; - event.change(t); - d3.select(this.parentNode) - .style('top','0') - .style('max-height','240px') - .transition() - .style('opacity', '0') - .style('max-height','0px') - .remove(); - }) - .append('span').attr('class', 'icon delete'); }); innerWrap