Leave save mode when displaying success message

This commit is contained in:
John Firebaugh
2013-07-25 13:53:15 -07:00
parent 476509111f
commit c3ec3569b5
4 changed files with 31 additions and 16 deletions

View File

@@ -5,7 +5,7 @@ iD.modes.Browse = function(context) {
title: t('modes.browse.title'),
description: t('modes.browse.description'),
key: '1'
};
}, sidebar;
var behaviors = [
iD.behavior.Hover(context)
@@ -21,13 +21,28 @@ iD.modes.Browse = function(context) {
// Get focus on the body.
document.activeElement.blur();
context.ui().sidebar.select(null);
if (sidebar) {
context.ui().sidebar.show(sidebar);
} else {
context.ui().sidebar.select(null);
}
};
mode.exit = function() {
behaviors.forEach(function(behavior) {
context.uninstall(behavior);
});
if (sidebar) {
context.ui().sidebar.hide(sidebar);
}
};
mode.sidebar = function(_) {
if (!arguments.length) return sidebar;
sidebar = _;
return mode;
};
return mode;

View File

@@ -45,16 +45,15 @@ iD.modes.Save = function(context) {
}
function success(e, changeset_id) {
context.ui().sidebar.hide(ui);
ui = iD.ui.Success(context)
.changeset({
id: changeset_id,
comment: e.comment
})
.on('cancel', cancel);
context.ui().sidebar.show(ui);
context.enter(iD.modes.Browse(context)
.sidebar(iD.ui.Success(context)
.changeset({
id: changeset_id,
comment: e.comment
})
.on('cancel', function(ui) {
context.ui().sidebar.hide(ui);
})));
}
var mode = {

View File

@@ -25,7 +25,7 @@ iD.ui.Sidebar = function(context) {
inspectorWrap.call(inspector);
}
} else {
} else if (!current) {
featureListWrap.classed('inspector-hidden', false);
inspectorWrap.classed('inspector-hidden', true);
}
@@ -45,7 +45,7 @@ iD.ui.Sidebar = function(context) {
inspectorWrap.call(inspector);
}
} else {
} else if (!current) {
featureListWrap.classed('inspector-hidden', false);
inspectorWrap.classed('inspector-hidden', true);
}
@@ -54,6 +54,7 @@ iD.ui.Sidebar = function(context) {
sidebar.show = function(component) {
featureListWrap.classed('inspector-hidden', true);
inspectorWrap.classed('inspector-hidden', true);
if (current) current.remove();
current = selection.append('div')
.attr('class', 'sidebar-component')
.call(component);
@@ -61,7 +62,7 @@ iD.ui.Sidebar = function(context) {
sidebar.hide = function() {
featureListWrap.classed('inspector-hidden', false);
current.remove();
if (current) current.remove();
current = null;
};
}

View File

@@ -13,7 +13,7 @@ iD.ui.Success = function(context) {
.attr('class', 'fr')
.append('span')
.attr('class', 'icon close')
.on('click', event.cancel);
.on('click', function() { event.cancel(success) });
header.append('h3')
.text(t('just_edited'));