diff --git a/cms/static/coffee/spec/views/textbook_spec.coffee b/cms/static/coffee/spec/views/textbook_spec.coffee index e76736b155..50fbd71c3f 100644 --- a/cms/static/coffee/spec/views/textbook_spec.coffee +++ b/cms/static/coffee/spec/views/textbook_spec.coffee @@ -1,8 +1,8 @@ -define ["js/models/textbook", "js/models/chapter", "js/collections/chapter", "js/models/section", +define ["js/models/textbook", "js/models/chapter", "js/collections/chapter", "js/models/course", "js/collections/textbook", "js/views/show_textbook", "js/views/edit_textbook", "js/views/list_textbooks", "js/views/edit_chapter", "js/views/feedback_prompt", "js/views/feedback_notification", "sinon", "jasmine-stealth"], -(Textbook, Chapter, ChapterSet, Section, TextbookSet, ShowTextbook, EditTextbook, ListTexbook, EditChapter, Prompt, Notification, sinon) -> +(Textbook, Chapter, ChapterSet, Course, TextbookSet, ShowTextbook, EditTextbook, ListTexbook, EditChapter, Prompt, Notification, sinon) -> feedbackTpl = readFixtures('system-feedback.underscore') beforeEach -> @@ -30,7 +30,7 @@ define ["js/models/textbook", "js/models/chapter", "js/collections/chapter", "js @promptSpies = spyOnConstructor(Prompt, "Warning", ["show", "hide"]) @promptSpies.show.andReturn(@promptSpies) - window.section = new Section({ + window.course = new Course({ id: "5", name: "Course Name", url_name: "course_name", @@ -40,7 +40,7 @@ define ["js/models/textbook", "js/models/chapter", "js/collections/chapter", "js }); afterEach -> - delete window.section + delete window.course describe "Basic", -> it "should render properly", -> @@ -285,11 +285,11 @@ define ["js/models/textbook", "js/models/chapter", "js/collections/chapter", "js @view = new EditChapter({model: @model}) spyOn(@view, "remove").andCallThrough() CMS.URL.UPLOAD_ASSET = "/upload" - window.section = new Section({name: "abcde"}) + window.course = new Course({name: "abcde"}) afterEach -> delete CMS.URL.UPLOAD_ASSET - delete window.section + delete window.course it "can render", -> @view.render() diff --git a/cms/static/js/views/edit_chapter.js b/cms/static/js/views/edit_chapter.js index 64169304e3..af6c5c61dd 100644 --- a/cms/static/js/views/edit_chapter.js +++ b/cms/static/js/views/edit_chapter.js @@ -53,7 +53,7 @@ define(["backbone", "underscore", "underscore.string", "jquery", "gettext", "js/ }); var msg = new FileUploadModel({ title: _.template(gettext("Upload a new PDF to “<%= name %>”"), - {name: section.escape('name')}), + {name: course.escape('name')}), message: "Files must be in PDF format.", mimeTypes: ['application/pdf'] }); diff --git a/cms/static/js/views/show_textbook.js b/cms/static/js/views/show_textbook.js index 7bae395fd5..580f4e9840 100644 --- a/cms/static/js/views/show_textbook.js +++ b/cms/static/js/views/show_textbook.js @@ -16,7 +16,7 @@ define(["backbone", "underscore", "gettext", "js/views/feedback_notification", " render: function() { var attrs = $.extend({}, this.model.attributes); attrs.bookindex = this.model.collection.indexOf(this.model); - attrs.course = window.section.attributes; + attrs.course = window.course.attributes; this.$el.html(this.template(attrs)); return this; }, diff --git a/cms/templates/textbooks.html b/cms/templates/textbooks.html index 238834da22..622f712d0b 100644 --- a/cms/templates/textbooks.html +++ b/cms/templates/textbooks.html @@ -23,13 +23,6 @@ CMS.URL.TEXTBOOKS = "${textbook_url}" CMS.URL.LMS_BASE = "${settings.LMS_BASE}" require(["js/models/section", "js/collections/textbook", "js/views/list_textbooks"], function(Section, TextbookCollection, ListTextbooksView) { - window.section = new Section({ - name: "${course.display_name_with_default | h}", - url_name: "${course.location.name | h}", - org: "${course.location.org | h}", - num: "${course.location.course | h}", - revision: "${course.location.revision | h}" - }); var textbooks = new TextbookCollection(${json.dumps(course.pdf_textbooks)}, {parse: true}); var tbView = new ListTextbooksView({collection: textbooks});