Make use of message area

This commit is contained in:
Ansis Brammanis
2013-02-15 16:18:54 -05:00
parent bf3a635da5
commit 87ef7ecf91
3 changed files with 23 additions and 5 deletions

View File

@@ -30,7 +30,8 @@ iD.ui.Inspector = function() {
presetGrid = iD.ui.PresetGrid()
.presetData(presetData)
.entity(entity)
.on('message', message.text)
.context(context)
.on('message', changeMessage)
.on('choose', function(preset) {
inspectorbody.call(tagEditor, expert, preset);
});
@@ -38,11 +39,13 @@ iD.ui.Inspector = function() {
tagEditor = iD.ui.TagEditor()
.presetData(presetData)
.context(context)
.on('message', message.text)
.on('message', changeMessage)
.on('choose', function() {
inspectorbody.call(presetGrid);
});
function changeMessage(msg) { message.text(msg);}
if (initial) {
inspectorbody.call(presetGrid);

View File

@@ -1,6 +1,7 @@
iD.ui.PresetGrid = function() {
var event = d3.dispatch('choose', 'message'),
entity,
context,
presetData;
function presetgrid(selection) {
@@ -10,6 +11,7 @@ iD.ui.PresetGrid = function() {
.attr('class', 'fillL');
var viable = presetData.match(entity);
event.message('What kind of ' + entity.geometry(context.graph()) + ' are you adding?');
var grid = wrap.append('div')
.attr('class', 'preset-grid')
@@ -21,7 +23,10 @@ iD.ui.PresetGrid = function() {
var search = searchwrap.append('input')
.attr('class', 'preset-grid-search')
.on('keyup', function() {
grid.call(drawGrid, filter(search.property('value')));
var value = search.property('value'),
presets = filter(value);
event.message('' + presets.length + ' results for ' + value);
grid.call(drawGrid, presets);
});
@@ -59,6 +64,12 @@ iD.ui.PresetGrid = function() {
return presetgrid;
};
presetgrid.context = function(_) {
if (!arguments.length) return context;
context = _;
return presetgrid;
};
presetgrid.entity = function(_) {
if (!arguments.length) return entity;
entity = _;

View File

@@ -2,7 +2,6 @@ iD.ui.TagEditor = function() {
var event = d3.dispatch('changeTags', 'choose', 'close', 'change', 'message'),
taginfo = iD.taginfo(),
presetData = iD.presetData(),
expert = false,
inspectorbody,
entity,
presetMatch,
@@ -22,7 +21,10 @@ iD.ui.TagEditor = function() {
.attr('class', 'inspector-inner tag-wrap fillL2');
var typewrap = editorwrap.append('div')
.attr('class', 'type inspector-inner fillL');
.attr('class', 'type inspector-inner fillL')
.on('click', function() {
event.choose();
});
typewrap.append('h4')
.text('Type');
@@ -79,6 +81,8 @@ iD.ui.TagEditor = function() {
.preset(presetMatch));
}
event.message('Edit ' + (presetMatch && presetMatch.name || ''));
var taglistwrap = editorwrap.append('div').call(tagList);
tageditor.tags(entity.tags);