Remove references to template loader JS library

This commit is contained in:
David Baumgold
2013-09-06 09:30:39 -04:00
parent 2c2668ca02
commit d984311b2e
10 changed files with 25 additions and 50 deletions

View File

@@ -10,27 +10,12 @@ CMS.Views.Checklists = Backbone.View.extend({
},
initialize : function() {
var self = this;
this.collection.fetch({
complete: function () {
window.templateLoader.loadRemoteTemplate("checklist",
"/static/client_templates/checklist.html",
function (raw_template) {
self.template = _.template(raw_template);
self.render();
}
);
},
reset: true
}
);
this.template = _.template($("#checklist-tpl").text());
this.listenTo(this.collection, 'reset', this.render);
this.render();
},
render: function() {
// catch potential outside call before template loaded
if (!this.template) return this;
this.$el.empty();
var self = this;

View File

@@ -20,6 +20,7 @@ CMS.Views.Settings.Grading = CMS.Views.ValidatingView.extend({
initialize : function() {
// load template for grading view
var self = this;
this.template = _.template($("#course_grade_policy-tpl").text());
this.gradeCutoffTemplate = _.template('<li class="grade-specific-bar" style="width:<%= width %>%"><span class="letter-grade" contenteditable="true">' +
'<%= descriptor %>' +
'</span><span class="range"></span>' +
@@ -27,27 +28,15 @@ CMS.Views.Settings.Grading = CMS.Views.ValidatingView.extend({
'</li>');
this.setupCutoffs();
// instantiates an editor template for each update in the collection
// Because this calls render, put it after everything which render may depend upon to prevent race condition.
window.templateLoader.loadRemoteTemplate("course_grade_policy",
"/static/client_templates/course_grade_policy.html",
function (raw_template) {
self.template = _.template(raw_template);
self.render();
}
);
this.listenTo(this.model, 'invalid', this.handleValidationError);
this.listenTo(this.model, 'change', this.showNotificationBar);
this.model.get('graders').on('reset', this.render, this);
this.model.get('graders').on('add', this.render, this);
this.selectorToField = _.invert(this.fieldToSelectorMap);
this.render();
},
render: function() {
// prevent bootstrap race condition by event dispatch
if (!this.template) return;
this.clearValidationErrors();
this.renderGracePeriod();