Commit 30c42e72 by cahrens

Ensure that window.course is avaiable before anyone accesses it.

TNL-4106
parent 85591696
......@@ -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',
......
define(['js/base', 'coffee/src/main', 'js/src/logger', 'datepair', 'accessibility',
'ieshim', 'tooltip_manager', 'lang_edx']);
'ieshim', 'tooltip_manager', 'lang_edx', 'js/models/course']);
define(['js/models/course'], function(Course) {
'use strict';
return function (courseInfo) {
window.course = new Course(courseInfo);
}
});
......@@ -82,9 +82,9 @@ from openedx.core.djangolib.js_utils import (
<script type="text/javascript">
require(['common/js/common_libraries'], function () {
require(['js/factories/base'], function () {
require(['js/models/course'], function(Course) {
% if context_course:
require(['js/factories/course'], function(CourseFactory) {
CourseFactory({
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}",
......@@ -94,7 +94,6 @@ from openedx.core.djangolib.js_utils import (
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']);
......@@ -102,6 +101,7 @@ from openedx.core.djangolib.js_utils import (
<%block name='requirejs'></%block>
});
});
});
</script>
<%include file="widgets/segment-io-footer.html" />
<div class="modal-cover"></div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment