Commit e9a8f408 by David Baumgold

Add {reset: true} to all collection.fetch() calls

This is to fix a bug with the Backbone 1.0 upgrade; some views were listening to
reset events that were not longer getting fired
parent 60f5314a
......@@ -22,6 +22,7 @@ CMS.Views.Checklists = Backbone.View.extend({
}
);
},
reset: true,
error: CMS.ServerError
}
);
......
......@@ -160,9 +160,15 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
var targetModel = this.eventModel(event);
this.modelDom(event).remove();
var cacheThis = this;
targetModel.destroy({success : function (model, response) {
cacheThis.collection.fetch({success : function() {cacheThis.render();},
error : CMS.ServerError});
targetModel.destroy({
success: function (model, response) {
cacheThis.collection.fetch({
success: function() {
cacheThis.render();
},
reset: true,
error: CMS.ServerError
});
},
error : CMS.ServerError
});
......@@ -238,8 +244,7 @@ CMS.Views.ClassInfoHandoutsView = Backbone.View.extend({
initialize: function() {
var self = this;
this.model.fetch(
{
this.model.fetch({
complete: function() {
window.templateLoader.loadRemoteTemplate("course_info_handouts",
"/static/client_templates/course_info_handouts.html",
......@@ -249,9 +254,9 @@ CMS.Views.ClassInfoHandoutsView = Backbone.View.extend({
}
);
},
error : CMS.ServerError
}
);
reset: true,
error: CMS.ServerError
});
},
render: function () {
......
......@@ -155,6 +155,7 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({
self.model.clear({silent : true});
self.model.fetch({
success : function() { self.render(); },
reset: true,
error : CMS.ServerError
});
},
......
......@@ -21,7 +21,7 @@
$(document).ready(function(){
var course_updates = new CMS.Models.CourseUpdateCollection();
course_updates.urlbase = '${url_base}';
course_updates.fetch();
course_updates.fetch({reset: true});
var course_handouts = new CMS.Models.ModuleInfo({
id: '${handouts_location}'
......
......@@ -32,15 +32,15 @@ from contentstore import utils
});
var model = new CMS.Models.Settings.CourseDetails();
model.urlRoot = '${details_url}';
model.fetch({success :
function(model) {
model.fetch({
success: function(model) {
var editor = new CMS.Views.Settings.Details({
el: $('.settings-details'),
model: model
});
editor.render();
}
},
reset: true
});
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment