Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
06f40019
Commit
06f40019
authored
Dec 05, 2013
by
David Baumgold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use window.course instead of window.section
parent
0d349037
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
15 deletions
+8
-15
cms/static/coffee/spec/views/textbook_spec.coffee
+6
-6
cms/static/js/views/edit_chapter.js
+1
-1
cms/static/js/views/show_textbook.js
+1
-1
cms/templates/textbooks.html
+0
-7
No files found.
cms/static/coffee/spec/views/textbook_spec.coffee
View file @
06f40019
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/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"
,
"js/views/edit_chapter"
,
"js/views/feedback_prompt"
,
"js/views/feedback_notification"
,
"sinon"
,
"jasmine-stealth"
],
"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'
)
feedbackTpl
=
readFixtures
(
'system-feedback.underscore'
)
beforeEach
->
beforeEach
->
...
@@ -30,7 +30,7 @@ define ["js/models/textbook", "js/models/chapter", "js/collections/chapter", "js
...
@@ -30,7 +30,7 @@ define ["js/models/textbook", "js/models/chapter", "js/collections/chapter", "js
@
promptSpies
=
spyOnConstructor
(
Prompt
,
"Warning"
,
[
"show"
,
"hide"
])
@
promptSpies
=
spyOnConstructor
(
Prompt
,
"Warning"
,
[
"show"
,
"hide"
])
@
promptSpies
.
show
.
andReturn
(
@
promptSpies
)
@
promptSpies
.
show
.
andReturn
(
@
promptSpies
)
window
.
section
=
new
Section
({
window
.
course
=
new
Course
({
id
:
"5"
,
id
:
"5"
,
name
:
"Course Name"
,
name
:
"Course Name"
,
url_name
:
"course_name"
,
url_name
:
"course_name"
,
...
@@ -40,7 +40,7 @@ define ["js/models/textbook", "js/models/chapter", "js/collections/chapter", "js
...
@@ -40,7 +40,7 @@ define ["js/models/textbook", "js/models/chapter", "js/collections/chapter", "js
});
});
afterEach
->
afterEach
->
delete
window
.
section
delete
window
.
course
describe
"Basic"
,
->
describe
"Basic"
,
->
it
"should render properly"
,
->
it
"should render properly"
,
->
...
@@ -285,11 +285,11 @@ define ["js/models/textbook", "js/models/chapter", "js/collections/chapter", "js
...
@@ -285,11 +285,11 @@ define ["js/models/textbook", "js/models/chapter", "js/collections/chapter", "js
@
view
=
new
EditChapter
({
model
:
@
model
})
@
view
=
new
EditChapter
({
model
:
@
model
})
spyOn
(
@
view
,
"remove"
).
andCallThrough
()
spyOn
(
@
view
,
"remove"
).
andCallThrough
()
CMS
.
URL
.
UPLOAD_ASSET
=
"/upload"
CMS
.
URL
.
UPLOAD_ASSET
=
"/upload"
window
.
section
=
new
Section
({
name
:
"abcde"
})
window
.
course
=
new
Course
({
name
:
"abcde"
})
afterEach
->
afterEach
->
delete
CMS
.
URL
.
UPLOAD_ASSET
delete
CMS
.
URL
.
UPLOAD_ASSET
delete
window
.
section
delete
window
.
course
it
"can render"
,
->
it
"can render"
,
->
@
view
.
render
()
@
view
.
render
()
...
...
cms/static/js/views/edit_chapter.js
View file @
06f40019
...
@@ -53,7 +53,7 @@ define(["backbone", "underscore", "underscore.string", "jquery", "gettext", "js/
...
@@ -53,7 +53,7 @@ define(["backbone", "underscore", "underscore.string", "jquery", "gettext", "js/
});
});
var
msg
=
new
FileUploadModel
({
var
msg
=
new
FileUploadModel
({
title
:
_
.
template
(
gettext
(
"Upload a new PDF to “<%= name %>”"
),
title
:
_
.
template
(
gettext
(
"Upload a new PDF to “<%= name %>”"
),
{
name
:
section
.
escape
(
'name'
)}),
{
name
:
course
.
escape
(
'name'
)}),
message
:
"Files must be in PDF format."
,
message
:
"Files must be in PDF format."
,
mimeTypes
:
[
'application/pdf'
]
mimeTypes
:
[
'application/pdf'
]
});
});
...
...
cms/static/js/views/show_textbook.js
View file @
06f40019
...
@@ -16,7 +16,7 @@ define(["backbone", "underscore", "gettext", "js/views/feedback_notification", "
...
@@ -16,7 +16,7 @@ define(["backbone", "underscore", "gettext", "js/views/feedback_notification", "
render
:
function
()
{
render
:
function
()
{
var
attrs
=
$
.
extend
({},
this
.
model
.
attributes
);
var
attrs
=
$
.
extend
({},
this
.
model
.
attributes
);
attrs
.
bookindex
=
this
.
model
.
collection
.
indexOf
(
this
.
model
);
attrs
.
bookindex
=
this
.
model
.
collection
.
indexOf
(
this
.
model
);
attrs
.
course
=
window
.
section
.
attributes
;
attrs
.
course
=
window
.
course
.
attributes
;
this
.
$el
.
html
(
this
.
template
(
attrs
));
this
.
$el
.
html
(
this
.
template
(
attrs
));
return
this
;
return
this
;
},
},
...
...
cms/templates/textbooks.html
View file @
06f40019
...
@@ -23,13 +23,6 @@ CMS.URL.TEXTBOOKS = "${textbook_url}"
...
@@ -23,13 +23,6 @@ CMS.URL.TEXTBOOKS = "${textbook_url}"
CMS
.
URL
.
LMS_BASE
=
"${settings.LMS_BASE}"
CMS
.
URL
.
LMS_BASE
=
"${settings.LMS_BASE}"
require
([
"js/models/section"
,
"js/collections/textbook"
,
"js/views/list_textbooks"
],
require
([
"js/models/section"
,
"js/collections/textbook"
,
"js/views/list_textbooks"
],
function
(
Section
,
TextbookCollection
,
ListTextbooksView
)
{
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
textbooks
=
new
TextbookCollection
(
$
{
json
.
dumps
(
course
.
pdf_textbooks
)},
{
parse
:
true
});
var
tbView
=
new
ListTextbooksView
({
collection
:
textbooks
});
var
tbView
=
new
ListTextbooksView
({
collection
:
textbooks
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment