Move the context course and sock into require_page compatible forms
This commit is contained in:
committed by
Ari Rizzitano
parent
6998b311fe
commit
970bc6a50d
@@ -1,2 +1,6 @@
|
||||
define(['js/base', 'cms/js/main', 'js/src/logger', 'datepair', 'accessibility',
|
||||
'ieshim', 'tooltip_manager', 'lang_edx', 'js/models/course']);
|
||||
'ieshim', 'tooltip_manager', 'lang_edx', 'js/models/course'],
|
||||
function() {
|
||||
'use strict';
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
define(
|
||||
(function(define) {
|
||||
'use strict';
|
||||
|
||||
define(
|
||||
['js/models/course'],
|
||||
function(ContextCourse) {
|
||||
window.course = new ContextCourse(window.pageFactoryArguments.ContextCourse[0]);
|
||||
}
|
||||
);
|
||||
}).call(this, define || RequireJS.define);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
define(
|
||||
['js/factories/login', 'common/js/utils/page_factory'],
|
||||
['js/factories/login', 'common/js/utils/page_factory', 'js/factories/base'],
|
||||
function(LoginFactory, invokePageFactory) {
|
||||
'use strict';
|
||||
invokePageFactory('LoginFactory', LoginFactory);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
require(['domReady', 'jquery', 'jquery.smoothScroll'],
|
||||
define(['domReady', 'jquery', 'jquery.smoothScroll'],
|
||||
function(domReady, $) {
|
||||
'use strict';
|
||||
|
||||
var toggleSock = function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -33,4 +35,5 @@ require(['domReady', 'jquery', 'jquery.smoothScroll'],
|
||||
// toggling footer additional support
|
||||
$('.cta-show-sock').bind('click', toggleSock);
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
@@ -121,39 +121,39 @@ from openedx.core.djangolib.markup import HTML
|
||||
<%block name="modal_placeholder"></%block>
|
||||
|
||||
<%block name="jsextra"></%block>
|
||||
<%block name="page_bundle">
|
||||
<script type="text/javascript">
|
||||
if (typeof window.pageFactoryArguments == "undefined") {
|
||||
|
||||
% if context_course:
|
||||
<script type="text/javascript">
|
||||
if (typeof window.pageFactoryArguments == "undefined") {
|
||||
window.pageFactoryArguments = {};
|
||||
}
|
||||
% if context_course:
|
||||
window.pageFactoryArguments['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}",
|
||||
org: "${context_course.location.org | n, js_escaped_string}",
|
||||
num: "${context_course.location.course | n, js_escaped_string}",
|
||||
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 }
|
||||
}
|
||||
% endif
|
||||
}
|
||||
|
||||
|
||||
require(['js/factories/base'], function () {
|
||||
require(['js/models/course'], function(Course) {
|
||||
% if context_course:
|
||||
window.course = new Course(
|
||||
window.pageFactoryArguments['ContextCourse']
|
||||
);
|
||||
% endif
|
||||
% if user.is_authenticated():
|
||||
require(['js/sock']);
|
||||
% endif
|
||||
<%block name='requirejs'></%block>
|
||||
});
|
||||
});
|
||||
</script>
|
||||
window.pageFactoryArguments['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}",
|
||||
org: "${context_course.location.org | n, js_escaped_string}",
|
||||
num: "${context_course.location.course | n, js_escaped_string}",
|
||||
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'/>
|
||||
% 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>
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</%block>
|
||||
<%include file="widgets/segment-io-footer.html" />
|
||||
<div class="modal-cover"></div>
|
||||
|
||||
Reference in New Issue
Block a user