diff --git a/js/id/ui/inspector.js b/js/id/ui/inspector.js index d1b3c3e90..259cabcf6 100644 --- a/js/id/ui/inspector.js +++ b/js/id/ui/inspector.js @@ -41,6 +41,9 @@ iD.ui.Inspector = function() { .tags(entity.tags) .context(context) .on('message', changeMessage) + .on('change', function() { + event.changeTags(entity, inspector.tags()); + }) .on('choose', function() { inspectorbody.call(presetGrid); }); diff --git a/js/id/ui/preset.js b/js/id/ui/preset.js index 691b7d531..9c8e94f2c 100644 --- a/js/id/ui/preset.js +++ b/js/id/ui/preset.js @@ -1,6 +1,8 @@ iD.ui.preset = function() { var event = d3.dispatch('change'), taginfo = iD.taginfo(), + context, + entity, hidden, sections, exttags, @@ -93,7 +95,7 @@ iD.ui.preset = function() { key: d.key }, function(err, data) { if (!err) combobox.data(data.map(function(d) { - d.title = d.value = d.value.replace('_', ' '); + d.title = d.value; return d; })); }); @@ -102,6 +104,7 @@ iD.ui.preset = function() { } if (i) { i.on('change', key); + i.on('blur', key); } } @@ -116,13 +119,23 @@ iD.ui.preset = function() { var s = d3.select(this); var wrap = s.append('div') .attr('class', 'preset-section-input cf'); + wrap.append('div') .attr('class', 'col4 preset-label') .append('label') .attr('for', 'input-' + d.key) .text(d.title || d.key); - input.call(wrap.append('div') - .attr('class', 'col8 preset-input'), d); + + // Single input element + if (d.key) { + input.call(wrap.append('div') + .attr('class', 'col8 preset-input'), d); + + // Multiple elements, eg, address + } else { + if (d.type === 'address') { + } + } }); if (exttags) setTags(exttags); } @@ -144,5 +157,17 @@ iD.ui.preset = function() { return clean(getTags()); }; + presets.context = function(_) { + if (!arguments.length) return context; + context = _; + return presets; + }; + + presets.entity = function(_) { + if (!arguments.length) return entity; + entity = _; + return presets; + }; + return d3.rebind(presets, event, 'on'); }; diff --git a/js/id/ui/tageditor.js b/js/id/ui/tageditor.js index c4a57254f..12a4bb203 100644 --- a/js/id/ui/tageditor.js +++ b/js/id/ui/tageditor.js @@ -87,14 +87,16 @@ iD.ui.TagEditor = function() { presetUI = iD.ui.preset() + .context(context) + .entity(entity) .on('change', function(tags) { - event.change(); + event.change(tags); }); tagList = iD.ui.Taglist() .context(context) .on('change', function(tags) { - event.change(); + event.change(tags); }); var tageditorpreset = editorwrap.append('div') diff --git a/js/id/ui/taglist.js b/js/id/ui/taglist.js index bcc6413d8..14417ab12 100644 --- a/js/id/ui/taglist.js +++ b/js/id/ui/taglist.js @@ -35,7 +35,7 @@ iD.ui.Taglist = function() { .attr('class', 'label') .text(t('inspector.new_tag')); - if (collapsed) wrap.classed('hide', true); + wrap.classed('hide', collapsed); }