From d984311b2e99bce6ba1c0b86e5d4906060f41d0a Mon Sep 17 00:00:00 2001 From: David Baumgold Date: Fri, 6 Sep 2013 09:30:39 -0400 Subject: [PATCH] Remove references to template loader JS library --- .../client_templates/advanced_entry.html | 11 ---------- cms/static/js/views/checklists_view.js | 21 +++---------------- .../views/settings/settings_grading_view.js | 15 ++----------- cms/templates/checklists.html | 12 +++++++++-- .../js/checklist.underscore} | 0 .../js/course_grade_policy.underscore} | 0 cms/templates/settings.html | 1 - cms/templates/settings_advanced.html | 1 - .../settings_discussions_faculty.html | 1 - cms/templates/settings_graders.html | 13 +++++++++--- 10 files changed, 25 insertions(+), 50 deletions(-) delete mode 100644 cms/static/client_templates/advanced_entry.html rename cms/{static/client_templates/checklist.html => templates/js/checklist.underscore} (100%) rename cms/{static/client_templates/course_grade_policy.html => templates/js/course_grade_policy.underscore} (100%) diff --git a/cms/static/client_templates/advanced_entry.html b/cms/static/client_templates/advanced_entry.html deleted file mode 100644 index 6be22e2116..0000000000 --- a/cms/static/client_templates/advanced_entry.html +++ /dev/null @@ -1,11 +0,0 @@ -
  • -
    - - -
    - -
    - - -
    -
  • \ No newline at end of file diff --git a/cms/static/js/views/checklists_view.js b/cms/static/js/views/checklists_view.js index 086d7e0b5b..eaa31195ec 100644 --- a/cms/static/js/views/checklists_view.js +++ b/cms/static/js/views/checklists_view.js @@ -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; diff --git a/cms/static/js/views/settings/settings_grading_view.js b/cms/static/js/views/settings/settings_grading_view.js index 1a4235e438..716ca6b4e6 100644 --- a/cms/static/js/views/settings/settings_grading_view.js +++ b/cms/static/js/views/settings/settings_grading_view.js @@ -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('
  • ' + '<%= descriptor %>' + '' + @@ -27,27 +28,15 @@ CMS.Views.Settings.Grading = CMS.Views.ValidatingView.extend({ '
  • '); 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(); diff --git a/cms/templates/checklists.html b/cms/templates/checklists.html index ad4f29aeb6..6c8fecdbf9 100644 --- a/cms/templates/checklists.html +++ b/cms/templates/checklists.html @@ -5,9 +5,17 @@ <%block name="bodyclass">is-signedin course uxdesign checklists <%namespace name='static' file='static_content.html'/> + +<%block name="header_extras"> +% for template_name in ["checklist"]: + +% endfor + + <%block name="jsextra"> - @@ -20,7 +28,7 @@ el: $('.course-checklists'), collection: checklistCollection }); - + checklistCollection.fetch({reset: true}); }); diff --git a/cms/static/client_templates/checklist.html b/cms/templates/js/checklist.underscore similarity index 100% rename from cms/static/client_templates/checklist.html rename to cms/templates/js/checklist.underscore diff --git a/cms/static/client_templates/course_grade_policy.html b/cms/templates/js/course_grade_policy.underscore similarity index 100% rename from cms/static/client_templates/course_grade_policy.html rename to cms/templates/js/course_grade_policy.underscore diff --git a/cms/templates/settings.html b/cms/templates/settings.html index 84e9155e6d..89b8930b9c 100644 --- a/cms/templates/settings.html +++ b/cms/templates/settings.html @@ -16,7 +16,6 @@ from contentstore import utils - diff --git a/cms/templates/settings_advanced.html b/cms/templates/settings_advanced.html index d87f3586b6..24d4c58864 100644 --- a/cms/templates/settings_advanced.html +++ b/cms/templates/settings_advanced.html @@ -13,7 +13,6 @@ % endfor - diff --git a/cms/templates/settings_discussions_faculty.html b/cms/templates/settings_discussions_faculty.html index b8f9a24e73..b4ecb47cc2 100644 --- a/cms/templates/settings_discussions_faculty.html +++ b/cms/templates/settings_discussions_faculty.html @@ -12,7 +12,6 @@ from contentstore import utils <%block name="jsextra"> - diff --git a/cms/templates/settings_graders.html b/cms/templates/settings_graders.html index 6dd22482ec..cffe926852 100644 --- a/cms/templates/settings_graders.html +++ b/cms/templates/settings_graders.html @@ -1,18 +1,25 @@ -<%! from django.utils.translation import ugettext as _ %> <%inherit file="base.html" /> <%block name="title">${_("Grading Settings")} <%block name="bodyclass">is-signedin course grading settings <%namespace name='static' file='static_content.html'/> <%! -from contentstore import utils + from contentstore import utils + from django.utils.translation import ugettext as _ %> +<%block name="header_extras"> +% for template_name in ["course_grade_policy"]: + +% endfor + + <%block name="jsextra"> -