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
30c42e72
Commit
30c42e72
authored
Feb 10, 2016
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure that window.course is avaiable before anyone accesses it.
TNL-4106
parent
85591696
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
26 deletions
+19
-26
cms/static/cms/js/build.js
+0
-1
cms/static/js/factories/base.js
+1
-1
cms/static/js/factories/course.js
+0
-6
cms/templates/base.html
+18
-18
No files found.
cms/static/cms/js/build.js
View file @
30c42e72
...
...
@@ -35,7 +35,6 @@
'js/factories/asset_index'
,
'js/factories/base'
,
'js/factories/container'
,
'js/factories/course'
,
'js/factories/course_create_rerun'
,
'js/factories/course_info'
,
'js/factories/edit_tabs'
,
...
...
cms/static/js/factories/base.js
View file @
30c42e72
define
([
'js/base'
,
'coffee/src/main'
,
'js/src/logger'
,
'datepair'
,
'accessibility'
,
'ieshim'
,
'tooltip_manager'
,
'lang_edx'
]);
'ieshim'
,
'tooltip_manager'
,
'lang_edx'
,
'js/models/course'
]);
cms/static/js/factories/course.js
deleted
100644 → 0
View file @
85591696
define
([
'js/models/course'
],
function
(
Course
)
{
'use strict'
;
return
function
(
courseInfo
)
{
window
.
course
=
new
Course
(
courseInfo
);
}
});
cms/templates/base.html
View file @
30c42e72
...
...
@@ -82,24 +82,24 @@ from openedx.core.djangolib.js_utils import (
<script
type=
"text/javascript"
>
require
([
'common/js/common_libraries'
],
function
()
{
require
([
'js/factories/base'
],
function
()
{
%
if
context_course
:
require
([
'js/factories/course'
],
function
(
CourseFactory
)
{
CourseFactory
({
id
:
"${context_course.id | n, js_escaped_string}"
,
name
:
"${context_course.display_name_with_default_escaped | h}"
,
url_name
:
"${context_course.location.name | h}"
,
org
:
"${context_course.location.org | h}"
,
num
:
"${context_course.location.course | h}"
,
display_course_number
:
"${context_course.display_coursenumber | n, js_escaped_string}"
,
revision
:
"${context_course.location.revision | h}"
,
self_paced
:
$
{
context_course
.
self_paced
|
n
,
dump_js_escaped_json
}
});
});
%
endif
%
if
user
.
is_authenticated
():
require
([
'js/sock'
]);
%
endif
<%
block
name
=
'requirejs'
><
/%block
>
require
([
'js/models/course'
],
function
(
Course
)
{
%
if
context_course
:
window
.
course
=
new
Course
({
id
:
"${context_course.id | n, js_escaped_string}"
,
name
:
"${context_course.display_name_with_default_escaped | h}"
,
url_name
:
"${context_course.location.name | h}"
,
org
:
"${context_course.location.org | h}"
,
num
:
"${context_course.location.course | h}"
,
display_course_number
:
"${context_course.display_coursenumber | n, js_escaped_string}"
,
revision
:
"${context_course.location.revision | h}"
,
self_paced
:
$
{
context_course
.
self_paced
|
n
,
dump_js_escaped_json
}
});
%
endif
%
if
user
.
is_authenticated
():
require
([
'js/sock'
]);
%
endif
<%
block
name
=
'requirejs'
><
/%block
>
});
});
});
</script>
...
...
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