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:
@@ -22,6 +22,7 @@ CMS.Views.Checklists = Backbone.View.extend({
|
||||
}
|
||||
);
|
||||
},
|
||||
reset: true,
|
||||
error: CMS.ServerError
|
||||
}
|
||||
);
|
||||
|
||||
@@ -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 () {
|
||||
|
||||
@@ -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
|
||||
});
|
||||
},
|
||||
|
||||
@@ -16,18 +16,18 @@
|
||||
<script src="${static.url('js/vendor/timepicker/jquery.timepicker.js')}"></script>
|
||||
<script src="${static.url('js/vendor/timepicker/datepair.js')}"></script>
|
||||
<script src="${static.url('js/vendor/date.js')}"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(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}'
|
||||
});
|
||||
course_handouts.urlbase = '${url_base}';
|
||||
|
||||
|
||||
var editor = new CMS.Views.CourseInfoEdit({
|
||||
el: $('.main-wrapper'),
|
||||
model : new CMS.Models.CourseInfo({
|
||||
@@ -80,4 +80,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</%block>
|
||||
</%block>
|
||||
|
||||
@@ -32,15 +32,15 @@ from contentstore import utils
|
||||
});
|
||||
var model = new CMS.Models.Settings.CourseDetails();
|
||||
model.urlRoot = '${details_url}';
|
||||
model.fetch({success :
|
||||
function(model) {
|
||||
var editor = new CMS.Views.Settings.Details({
|
||||
el: $('.settings-details'),
|
||||
model: model
|
||||
});
|
||||
|
||||
editor.render();
|
||||
}
|
||||
model.fetch({
|
||||
success: function(model) {
|
||||
var editor = new CMS.Views.Settings.Details({
|
||||
el: $('.settings-details'),
|
||||
model: model
|
||||
});
|
||||
editor.render();
|
||||
},
|
||||
reset: true
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user