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
404c36b8
Commit
404c36b8
authored
Jun 24, 2013
by
David Baumgold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PDF textbooks: namespace JS variables for URLs
parent
696a795c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
14 deletions
+15
-14
cms/djangoapps/contentstore/views/course.py
+2
-2
cms/static/coffee/spec/models/textbook_spec.coffee
+3
-3
cms/static/coffee/spec/views/textbook_spec.coffee
+5
-5
cms/static/coffee/src/main.coffee
+1
-0
cms/static/js/models/textbook.js
+1
-1
cms/static/js/views/textbook.js
+1
-1
cms/templates/textbooks.html
+2
-2
No files found.
cms/djangoapps/contentstore/views/course.py
View file @
404c36b8
...
...
@@ -460,7 +460,7 @@ def textbook_index(request, org, course, name):
return
HttpResponse
(
''
,
content_type
=
"application/json"
,
status
=
204
)
else
:
upload_asset_
callback_
url
=
reverse
(
'upload_asset'
,
kwargs
=
{
upload_asset_url
=
reverse
(
'upload_asset'
,
kwargs
=
{
'org'
:
org
,
'course'
:
course
,
'coursename'
:
name
,
...
...
@@ -473,6 +473,6 @@ def textbook_index(request, org, course, name):
return
render_to_response
(
'textbooks.html'
,
{
'context_course'
:
course_module
,
'course'
:
course_module
,
'upload_asset_
callback_url'
:
upload_asset_callback
_url
,
'upload_asset_
url'
:
upload_asset
_url
,
'textbook_url'
:
textbook_url
,
})
cms/static/coffee/spec/models/textbook_spec.coffee
View file @
404c36b8
...
...
@@ -71,14 +71,14 @@ describe "CMS.Models.Textbook input/output", ->
describe
"CMS.Collections.TextbookSet"
,
->
beforeEach
->
window
.
TEXTBOOK_URL
=
"/textbooks"
CMS
.
URL
.
TEXTBOOK
=
"/textbooks"
@
collection
=
new
CMS
.
Collections
.
TextbookSet
()
afterEach
->
delete
window
.
TEXTBOOK_URL
delete
CMS
.
URL
.
TEXTBOOK
it
"should have a url set"
,
->
expect
(
_
.
result
(
@
collection
,
"url"
),
window
.
TEXTBOOK_URL
)
expect
(
_
.
result
(
@
collection
,
"url"
),
"/textbooks"
)
it
"can call save"
,
->
spyOn
(
@
collection
,
"sync"
)
...
...
cms/static/coffee/spec/views/textbook_spec.coffee
View file @
404c36b8
...
...
@@ -225,11 +225,11 @@ describe "CMS.Views.EditChapter", ->
@
collection
.
add
(
@
model
)
@
view
=
new
CMS
.
Views
.
EditChapter
({
model
:
@
model
})
spyOn
(
@
view
,
"remove"
).
andCallThrough
()
window
.
UPLOAD_ASSET_CALLBACK_URL
=
"/upload"
CMS
.
URL
.
UPLOAD_ASSET
=
"/upload"
window
.
section
=
new
CMS
.
Models
.
Section
({
name
:
"abcde"
})
afterEach
->
delete
window
.
UPLOAD_ASSET_CALLBACK_URL
delete
CMS
.
URL
.
UPLOAD_ASSET
delete
window
.
section
it
"can render"
,
->
...
...
@@ -267,7 +267,7 @@ describe "CMS.Views.UploadDialog", ->
beforeEach
->
setFixtures
(
$
(
"<script>"
,
{
id
:
"upload-dialog-tpl"
,
type
:
"text/template"
}).
text
(
tpl
))
appendSetFixtures
(
$
(
"<script>"
,
{
id
:
"system-feedback-tpl"
,
type
:
"text/template"
}).
text
(
feedbackTpl
))
window
.
UPLOAD_ASSET_CALLBACK_URL
=
"/upload"
CMS
.
URL
.
UPLOAD_ASSET
=
"/upload"
@
model
=
new
CMS
.
Models
.
FileUpload
()
@
chapter
=
new
CMS
.
Models
.
Chapter
()
...
...
@@ -288,7 +288,7 @@ describe "CMS.Views.UploadDialog", ->
realMethod
.
apply
(
this
,
arguments
)
afterEach
->
delete
window
.
UPLOAD_ASSET_CALLBACK_URL
delete
CMS
.
URL
.
UPLOAD_ASSET
describe
"Basic"
,
->
it
"should be shown by default"
,
->
...
...
@@ -346,7 +346,7 @@ describe "CMS.Views.UploadDialog", ->
expect
(
@
model
.
get
(
"uploading"
)).
toBeTruthy
()
expect
(
@
requests
.
length
).
toEqual
(
1
)
request
=
@
requests
[
0
]
expect
(
request
.
url
).
toEqual
(
UPLOAD_ASSET_CALLBACK_URL
)
expect
(
request
.
url
).
toEqual
(
"/upload"
)
expect
(
request
.
method
).
toEqual
(
"POST"
)
request
.
respond
(
200
,
{
"Content-Type"
:
"application/json"
},
...
...
cms/static/coffee/src/main.coffee
View file @
404c36b8
...
...
@@ -4,6 +4,7 @@ AjaxPrefix.addAjaxPrefix(jQuery, -> CMS.prefix)
Models
:
{}
Views
:
{}
Collections
:
{}
URL
:
{}
prefix
:
$
(
"meta[name='path_prefix']"
).
attr
(
'content'
)
...
...
cms/static/js/models/textbook.js
View file @
404c36b8
...
...
@@ -39,7 +39,7 @@ CMS.Models.Textbook = Backbone.AssociatedModel.extend({
});
CMS
.
Collections
.
TextbookSet
=
Backbone
.
Collection
.
extend
({
model
:
CMS
.
Models
.
Textbook
,
url
:
function
()
{
return
window
.
TEXTBOOK_URL
;
},
url
:
function
()
{
return
CMS
.
URL
.
TEXTBOOK
;
},
initialize
:
function
()
{
this
.
listenTo
(
this
,
"editOne"
,
this
.
editOne
);
},
...
...
cms/static/js/views/textbook.js
View file @
404c36b8
...
...
@@ -259,7 +259,7 @@ CMS.Views.UploadDialog = Backbone.View.extend({
var
oldInput
=
this
.
$
(
"input[type=file]"
).
get
(
0
);
this
.
$el
.
html
(
this
.
template
({
shown
:
this
.
options
.
shown
,
url
:
UPLOAD_ASSET_CALLBACK_URL
,
url
:
CMS
.
URL
.
UPLOAD_ASSET
,
title
:
this
.
model
.
escape
(
'title'
),
message
:
this
.
model
.
escape
(
'message'
),
selectedFile
:
selectedFile
,
...
...
cms/templates/textbooks.html
View file @
404c36b8
...
...
@@ -16,8 +16,8 @@
<
%
block
name=
"jsextra"
>
<script
type=
"text/javascript"
>
window
.
UPLOAD_ASSET_CALLBACK_URL
=
"${upload_asset_callback
_url}"
window
.
TEXTBOOK_URL
=
"${textbook_url}"
CMS
.
URL
.
UPLOAD_ASSET
=
"${upload_asset
_url}"
CMS
.
URL
.
TEXTBOOK
=
"${textbook_url}"
window
.
section
=
new
CMS
.
Models
.
Section
({
id
:
"${course.id}"
,
name
:
"${course.display_name_with_default | h}"
...
...
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