diff --git a/cms/static/js/models/settings/course_details.js b/cms/static/js/models/settings/course_details.js
index ab80179142..bdbb46b3b1 100644
--- a/cms/static/js/models/settings/course_details.js
+++ b/cms/static/js/models/settings/course_details.js
@@ -68,10 +68,12 @@ CMS.Models.Settings.CourseDetails = Backbone.Model.extend({
save_videosource: function(newsource) {
// newsource either is or just the "speed:key, *" string
// returns the videosource for the preview which iss the key whose speed is closest to 1
- if (_.isEmpty(newsource) && !_.isEmpty(this.get('intro_video'))) this.save({'intro_video': null});
+ if (_.isEmpty(newsource) && !_.isEmpty(this.get('intro_video'))) this.save({'intro_video': null},
+ { error : CMS.ServerError});
// TODO remove all whitespace w/in string
else {
- if (this.get('intro_video') !== newsource) this.save('intro_video', newsource);
+ if (this.get('intro_video') !== newsource) this.save('intro_video', newsource,
+ { error : CMS.ServerError});
}
return this.videosourceSample();
diff --git a/cms/static/js/views/course_info_edit.js b/cms/static/js/views/course_info_edit.js
index 0ad02215db..cb396b2a7f 100644
--- a/cms/static/js/views/course_info_edit.js
+++ b/cms/static/js/views/course_info_edit.js
@@ -99,10 +99,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
var targetModel = this.eventModel(event);
targetModel.set({ date : this.dateEntry(event).val(), content : this.$codeMirror.getValue() });
// push change to display, hide the editor, submit the change
- targetModel.save({}, {error : function(model, xhr) {
- // TODO use a standard component
- window.alert(xhr.responseText);
- }});
+ targetModel.save({}, {error : CMS.ServerError});
this.closeEditor(this);
},
@@ -145,8 +142,10 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
this.modelDom(event).remove();
var cacheThis = this;
targetModel.destroy({success : function (model, response) {
- cacheThis.collection.fetch({success : function() {cacheThis.render();}});
- }
+ cacheThis.collection.fetch({success : function() {cacheThis.render();},
+ error : CMS.ServerError});
+ },
+ error : CMS.ServerError
});
},
@@ -225,7 +224,8 @@ CMS.Views.ClassInfoHandoutsView = Backbone.View.extend({
self.render();
}
);
- }
+ },
+ error : CMS.ServerError
}
);
},
@@ -267,7 +267,7 @@ CMS.Views.ClassInfoHandoutsView = Backbone.View.extend({
onSave: function(event) {
this.model.set('data', this.$codeMirror.getValue());
this.render();
- this.model.save();
+ this.model.save({}, {error: CMS.ServerError});
this.$form.hide();
this.closeEditor(this);
},
diff --git a/cms/static/js/views/server_error.js b/cms/static/js/views/server_error.js
new file mode 100644
index 0000000000..11478b5712
--- /dev/null
+++ b/cms/static/js/views/server_error.js
@@ -0,0 +1,4 @@
+CMS.ServerError = function(model, error) {
+ // this handler is for the client:server communication not the validation errors which handleValidationError catches
+ window.alert("Server Error: " + error.responseText);
+};
\ No newline at end of file
diff --git a/cms/static/js/views/settings/main_settings_view.js b/cms/static/js/views/settings/main_settings_view.js
index 9037d4510c..e2b5326aaf 100644
--- a/cms/static/js/views/settings/main_settings_view.js
+++ b/cms/static/js/views/settings/main_settings_view.js
@@ -55,7 +55,7 @@ CMS.Views.ValidatingView = Backbone.View.extend({
var newVal = $(event.currentTarget).val();
if (currentVal != newVal) {
this.clearValidationErrors();
- this.model.save(field, newVal);
+ this.model.save(field, newVal, { error : CMS.ServerError});
return true;
}
else return false;
@@ -227,7 +227,8 @@ CMS.Views.Settings.Details = CMS.Views.ValidatingView.extend({
time = 0;
}
var newVal = new Date(date.getTime() + time * 1000);
- if (cacheModel.get(fieldName) != newVal) cacheModel.save(fieldName, newVal);
+ if (cacheModel.get(fieldName) != newVal) cacheModel.save(fieldName, newVal,
+ { error : CMS.ServerError});
}
};
@@ -276,7 +277,8 @@ CMS.Views.Settings.Details = CMS.Views.ValidatingView.extend({
},
removeSyllabus: function() {
- if (this.model.has('syllabus')) this.model.save({'syllabus': null});
+ if (this.model.has('syllabus')) this.model.save({'syllabus': null},
+ { error : CMS.ServerError});
},
assetSyllabus : function() {
@@ -309,7 +311,8 @@ CMS.Views.Settings.Details = CMS.Views.ValidatingView.extend({
mirror.save();
cachethis.clearValidationErrors();
var newVal = mirror.getValue();
- if (cachethis.model.get(field) != newVal) cachethis.model.save(field, newVal);
+ if (cachethis.model.get(field) != newVal) cachethis.model.save(field, newVal,
+ { error : CMS.ServerError});
}
});
}
@@ -404,7 +407,8 @@ CMS.Views.Settings.Grading = CMS.Views.ValidatingView.extend({
setGracePeriod : function(event) {
event.data.clearValidationErrors();
var newVal = event.data.model.dateToGracePeriod($(event.currentTarget).timepicker('getTime'));
- if (event.data.model.get('grace_period') != newVal) event.data.model.save('grace_period', newVal);
+ if (event.data.model.get('grace_period') != newVal) event.data.model.save('grace_period', newVal,
+ { error : CMS.ServerError});
},
updateModel : function(event) {
if (!this.selectorToField[event.currentTarget.id]) return;
@@ -540,7 +544,8 @@ CMS.Views.Settings.Grading = CMS.Views.ValidatingView.extend({
object[cutoff['designation']] = cutoff['cutoff'] / 100.0;
return object;
},
- {}));
+ {}),
+ { error : CMS.ServerError});
},
addNewGrade: function(e) {
@@ -671,7 +676,8 @@ CMS.Views.Settings.GraderView = CMS.Views.ValidatingView.extend({
}
},
deleteModel : function(e) {
- this.model.destroy();
+ this.model.destroy(
+ { error : CMS.ServerError});
e.preventDefault();
}
diff --git a/cms/templates/course_info.html b/cms/templates/course_info.html
index f4fa661b6e..83d829efa0 100644
--- a/cms/templates/course_info.html
+++ b/cms/templates/course_info.html
@@ -10,6 +10,7 @@
+
diff --git a/cms/templates/settings.html b/cms/templates/settings.html
index 1fa5b0acce..8cd4246da9 100644
--- a/cms/templates/settings.html
+++ b/cms/templates/settings.html
@@ -20,6 +20,7 @@ from contentstore import utils
+