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
This commit is contained in:
David Baumgold
2013-05-14 16:43:41 -04:00
parent 60f5314ab0
commit e9a8f408bf
5 changed files with 39 additions and 32 deletions

View File

@@ -22,6 +22,7 @@ CMS.Views.Checklists = Backbone.View.extend({
}
);
},
reset: true,
error: CMS.ServerError
}
);

View File

@@ -160,11 +160,17 @@ 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});
},
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,20 +244,19 @@ CMS.Views.ClassInfoHandoutsView = Backbone.View.extend({
initialize: function() {
var self = this;
this.model.fetch(
{
complete: function() {
window.templateLoader.loadRemoteTemplate("course_info_handouts",
"/static/client_templates/course_info_handouts.html",
function (raw_template) {
self.template = _.template(raw_template);
self.render();
}
);
},
error : CMS.ServerError
}
);
this.model.fetch({
complete: function() {
window.templateLoader.loadRemoteTemplate("course_info_handouts",
"/static/client_templates/course_info_handouts.html",
function (raw_template) {
self.template = _.template(raw_template);
self.render();
}
);
},
reset: true,
error: CMS.ServerError
});
},
render: function () {

View File

@@ -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
});
},