Do not create empty changesets #191

This commit is contained in:
Tom MacWright
2012-12-05 13:17:22 -05:00
parent b540e84ae0
commit 90a0128d8e
2 changed files with 31 additions and 12 deletions
+3 -3
View File
@@ -265,9 +265,9 @@ div.typeahead a.active {
box-shadow:0 0 5px #000;
}
.modal.loading-pane {
width:300px;
height:200px;
.modal.modal-alert {
width:320px;
height:100px;
margin-left:-160px;
}
+28 -9
View File
@@ -84,17 +84,36 @@ window.iD = function(container) {
map.flush().redraw();
});
}
connection.authenticate(function() {
var changes = history.changes();
var has_changes = d3.sum(d3.values(changes).map(function(c) {
return c.length;
})) > 0;
if (has_changes) {
connection.authenticate(function() {
var modal = iD.modal();
modal.select('.content')
.classed('commit-modal', true)
.datum(history.changes())
.call(iD.commit()
.on('cancel', function() {
modal.remove();
})
.on('save', save));
});
} else {
var modal = iD.modal();
modal.select('.modal').classed('modal-alert', true);
modal.select('.content')
.classed('commit-modal', true)
.datum(history.changes())
.call(iD.commit()
.on('cancel', function() {
modal.remove();
})
.on('save', save));
});
.append('p')
.text('You don\'t have any changes to save.');
modal.select('.content')
.append('button')
.text('OK')
.on('click', function() {
modal.remove();
});
}
});
var zoom = bar.append('div')