mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-31 01:09:22 +02:00
Detect, pass, and display errors. Fixes #124
This commit is contained in:
30
js/id/id.js
30
js/id/id.js
@@ -122,17 +122,25 @@ window.iD = function(container) {
|
||||
l.remove();
|
||||
history.reset();
|
||||
map.flush().redraw();
|
||||
var modal = iD.modal();
|
||||
modal.select('.content')
|
||||
.classed('success-modal', true)
|
||||
.datum({
|
||||
id: changeset_id,
|
||||
comment: e.comment
|
||||
})
|
||||
.call(iD.success()
|
||||
.on('cancel', function() {
|
||||
modal.remove();
|
||||
}));
|
||||
if (err) {
|
||||
var desc = iD.confirm()
|
||||
.select('.description');
|
||||
desc.append('h2')
|
||||
.text('An error occurred while trying to save');
|
||||
desc.append('p').text(err.responseText);
|
||||
} else {
|
||||
var modal = iD.modal();
|
||||
modal.select('.content')
|
||||
.classed('success-modal', true)
|
||||
.datum({
|
||||
id: changeset_id,
|
||||
comment: e.comment
|
||||
})
|
||||
.call(iD.success()
|
||||
.on('cancel', function() {
|
||||
modal.remove();
|
||||
}));
|
||||
}
|
||||
});
|
||||
}
|
||||
var changes = history.changes();
|
||||
|
||||
@@ -49,8 +49,9 @@ iD.OAuth = function() {
|
||||
o.oauth_signature = ohauth.signature(oauth_secret, oauth_token_secret,
|
||||
ohauth.baseString(options.method, url, o));
|
||||
ohauth.xhr(options.method, url, o, options.content, options.options, function(err, xhr) {
|
||||
if (xhr.responseXML) callback(err, xhr.responseXML);
|
||||
else callback(err, xhr.response);
|
||||
if (err) return callback(err);
|
||||
if (xhr.responseXML) return callback(err, xhr.responseXML);
|
||||
else return callback(err, xhr.response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
iD.confirm = function(message) {
|
||||
iD.confirm = function() {
|
||||
var modal = iD.modal();
|
||||
modal.select('.modal').classed('modal-alert', true);
|
||||
modal.select('.content')
|
||||
.classed('modal-section', true)
|
||||
.append('div').attr('class', 'description');
|
||||
.append('div')
|
||||
.attr('class', 'description');
|
||||
var nochanges = modal.select('.content')
|
||||
.append('button')
|
||||
.attr('class','wide action centered')
|
||||
|
||||
Reference in New Issue
Block a user