Inspector buttons to header (#1062, #1063)

This commit is contained in:
John Firebaugh
2013-03-18 17:05:49 -07:00
parent 2fc4f041d7
commit a7b5bee63a
3 changed files with 42 additions and 55 deletions

View File

@@ -622,7 +622,7 @@ a.selected:hover .toggle.icon { background-position: -40px -180px;}
position: absolute;
right: 0;
left: 0;
bottom: 90px;
bottom: 30px;
top: 60px;
}
@@ -653,13 +653,20 @@ a.selected:hover .toggle.icon { background-position: -40px -180px;}
transition: box-shadow 100ms;
}
.inspector-wrap .message button.preset-reset {
.inspector-wrap .message button.fl {
height: 100%;
border-radius: 0;
border-right: 1px solid #CCC;
width: 12.5%;
}
.inspector-wrap .message button.fr {
height: 100%;
border-radius: 0;
border-left: 1px solid #CCC;
width: 12.5%;
}
.inspector-wrap .message h3 {
display: block;
line-height: 20px;

View File

@@ -12,11 +12,26 @@ iD.ui.PresetGrid = function(context, entity) {
presets = context.presets().matchGeometry(entity, context.graph());
var messagewrap = selection.append('div')
.attr('class', 'message inspector-inner fillL');
.attr('class', 'message fillL');
var message = messagewrap.append('h3')
.attr('class', 'inspector-inner fl')
.text(t('inspector.choose'));
if (preset) {
messagewrap.append('button')
.attr('class', 'tooltip-bottom preset-choose fr')
.on('click', event.choose)
.append('span')
.attr('class', 'icon forward');
} else {
messagewrap.append('button')
.attr('class', 'tooltip-bottom preset-close fr')
.on('click', event.close)
.append('span')
.attr('class', 'icon close');
}
var gridwrap = selection.append('div')
.attr('class', 'fillL inspector-body inspector-body-' + entity.geometry(context.graph()));
@@ -90,12 +105,6 @@ iD.ui.PresetGrid = function(context, entity) {
search.node().focus();
if (preset) {
selection.append('div')
.attr('class', 'inspector-actions pad1 fillD col12')
.call(drawButtons);
}
function choose(d) {
// Category
if (d.members) {
@@ -224,20 +233,5 @@ iD.ui.PresetGrid = function(context, entity) {
}
}
function cancel() {
event.choose();
}
function drawButtons(selection) {
var inspectorButton = selection.append('button')
.attr('class', 'apply action')
.on('click', cancel);
inspectorButton.append('span')
.attr('class','label')
.text(t('commit.cancel'));
}
return d3.rebind(presetgrid, event, 'on');
};

View File

@@ -37,12 +37,19 @@ iD.ui.TagEditor = function(context, entity) {
.on('click', function() {
event.choose(preset);
})
.append('span').attr('class','icon back');
.append('span')
.attr('class', 'icon back');
messagewrap.append('h3')
.attr('class', 'inspector-inner fl')
.text(t('inspector.editing'));
messagewrap.append('button')
.attr('class', 'tooltip-bottom preset-close fr')
.on('click', event.close)
.append('span')
.attr('class', 'icon close');
var editorwrap = selection.append('div')
.attr('class', 'tag-wrap inspector-body fillL inspector-body-' + entity.geometry(context.graph()));
@@ -94,11 +101,16 @@ iD.ui.TagEditor = function(context, entity) {
}
editorwrap.append('div')
.attr('class','inspector-inner col12 fillL2').call(tagList, preset.id === 'other');
.attr('class','inspector-inner col12 fillL2')
.call(tagList, preset.id === 'other');
selection.append('div')
.attr('class', 'inspector-actions pad1 fillD col12')
.call(drawButtons);
// Don't add for created entities
if (entity.osmId() > 0) {
editorwrap.append('a')
.attr('href', 'http://www.openstreetmap.org/browse/' + entity.type + '/' + entity.osmId())
.attr('target', '_blank')
.text(t('inspector.view_on_osm'));
}
tageditor.tags(tags);
changeTags();
@@ -117,32 +129,6 @@ iD.ui.TagEditor = function(context, entity) {
event.changeTags(_.clone(tags));
}
function apply() {
event.close();
}
function drawButtons(selection) {
var inspectorButton = selection.append('button')
.attr('class', 'apply action')
.on('click', apply);
inspectorButton.append('span')
.attr('class','label')
.text(t('inspector.okay'));
var minorButtons = selection.append('div')
.attr('class','minor-buttons fl');
// Don't add for created entities
if (entity.osmId() > 0) {
minorButtons.append('a')
.attr('href', 'http://www.openstreetmap.org/browse/' + entity.type + '/' + entity.osmId())
.attr('target', '_blank')
.text(t('inspector.view_on_osm'));
}
}
tageditor.tags = function(newtags) {
tags = _.clone(newtags);
if (presetUI && tagList) {