mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-22 16:19:48 +02:00
Do not create empty changesets #191
This commit is contained in:
+3
-3
@@ -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
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user