Notify the user of errors when saving a notebook.

pull/37/head
Felix Werner 15 years ago
parent a89d947322
commit f5b52442aa

@ -871,7 +871,8 @@ var IPython = (function (IPython) {
type : "PUT",
data : JSON.stringify(data),
headers : {'Content-Type': 'application/json'},
success : $.proxy(this.notebook_saved,this)
success : $.proxy(this.notebook_saved,this),
error : $.proxy(this.notebook_save_failed,this)
};
IPython.save_widget.status_saving();
$.ajax("/notebooks/" + notebook_id, settings);
@ -886,6 +887,14 @@ var IPython = (function (IPython) {
}
Notebook.prototype.notebook_save_failed = function (xhr, status, error_msg) {
// Notify the user and reset the save button
// TODO: Handle different types of errors (timeout etc.)
alert('An unexpected error occured while saving the notebook.');
setTimeout($.proxy(IPython.save_widget.reset_status,IPython.save_widget),500);
}
Notebook.prototype.load_notebook = function (callback) {
var that = this;
var notebook_id = IPython.save_widget.get_notebook_id();

@ -115,6 +115,11 @@ var IPython = (function (IPython) {
};
SaveWidget.prototype.reset_status = function () {
this.is_renaming();
};
SaveWidget.prototype.status_save = function () {
this.element.find('button#save_notebook').button('option', 'label', '<u>S</u>ave');
this.element.find('button#save_notebook').button('enable');

Loading…
Cancel
Save