Convert webpackified factories to es6 modules with global exports, and remove the invoke_page_factory pattern

This commit is contained in:
Calen Pennington
2018-03-22 16:14:51 -04:00
parent 12a082cf83
commit ee6360543b
28 changed files with 219 additions and 303 deletions

View File

@@ -125,12 +125,9 @@ from openedx.core.release import RELEASE_LINE
<%block name="jsextra"></%block>
% if context_course:
<%static:webpack entry="js/factories/context_course"/>
<script type="text/javascript">
if (typeof window.pageFactoryArguments == "undefined") {
window.pageFactoryArguments = {};
}
window.pageFactoryArguments['ContextCourse'] = {
window.course = new ContextCourse({
id: "${context_course.id | n, js_escaped_string}",
name: "${context_course.display_name_with_default | n, js_escaped_string}",
url_name: "${context_course.location.block_id | n, js_escaped_string}",
@@ -139,21 +136,16 @@ from openedx.core.release import RELEASE_LINE
display_course_number: "${context_course.display_coursenumber | n, js_escaped_string}",
revision: "${context_course.location.branch | n, js_escaped_string}",
self_paced: ${ context_course.self_paced | n, dump_js_escaped_json }
}
});
</script>
% endif
% if user.is_authenticated:
<%static:invoke_page_bundle page_name='js/sock'/>
<%static:webpack entry='js/sock'/>
% endif
<%block name='page_bundle'>
<script type="text/javascript">
require(['js/factories/base'], function () {
require(['js/models/course'], function(Course) {
% if context_course:
window.course = new Course(window.pageFactoryArguments['ContextCourse']);
% endif
<%block name='requirejs'></%block>
});
<%block name='requirejs'></%block>
});
</script>
</%block>