Use window.course instead of window.section
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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']
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
},
|
||||
|
||||
@@ -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});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user