From 87ef7ecf9110c9f33877e1d3f2bedef0803202af Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Fri, 15 Feb 2013 16:18:54 -0500 Subject: [PATCH] Make use of message area --- js/id/ui/inspector.js | 7 +++++-- js/id/ui/presetgrid.js | 13 ++++++++++++- js/id/ui/tageditor.js | 8 ++++++-- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/js/id/ui/inspector.js b/js/id/ui/inspector.js index 6d4ee74a8..5a2c1df24 100644 --- a/js/id/ui/inspector.js +++ b/js/id/ui/inspector.js @@ -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); diff --git a/js/id/ui/presetgrid.js b/js/id/ui/presetgrid.js index dea3fd6cd..48307b73a 100644 --- a/js/id/ui/presetgrid.js +++ b/js/id/ui/presetgrid.js @@ -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 = _; diff --git a/js/id/ui/tageditor.js b/js/id/ui/tageditor.js index ca9eeab1e..33e70557d 100644 --- a/js/id/ui/tageditor.js +++ b/js/id/ui/tageditor.js @@ -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);