Update to use generic studioContext configuration
This commit is contained in:
@@ -56,15 +56,17 @@
|
||||
<div class="content">
|
||||
<div class="content-primary">
|
||||
% if waffle_flag_enabled:
|
||||
<%static:studiofrontend page="AssetsPage" lang="fr">
|
||||
{
|
||||
"id": "${context_course.id | n, js_escaped_string}",
|
||||
"name": "${context_course.display_name_with_default | n, js_escaped_string}",
|
||||
"url_name": "${context_course.location.name | 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.revision | n, js_escaped_string}"
|
||||
<%static:studiofrontend page="AssetsPage" lang="en">
|
||||
{
|
||||
"course": {
|
||||
"id": "${context_course.id | n, js_escaped_string}",
|
||||
"name": "${context_course.display_name_with_default | n, js_escaped_string}",
|
||||
"url_name": "${context_course.location.name | 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.revision | n, js_escaped_string}"
|
||||
}
|
||||
}
|
||||
</%static:studiofrontend>
|
||||
% else:
|
||||
|
||||
@@ -101,25 +101,18 @@ source, template_path = Loader(engine).load_template_source(path)
|
||||
from webpack_loader.exceptions import WebpackLoaderBadStatsError
|
||||
import json
|
||||
|
||||
def _convert_dict_to_json(input_dict):
|
||||
output_json = "{"
|
||||
for key in input_dict:
|
||||
output_json = "{}{}:\"{}\",".format(output_json, key, input_dict[key])
|
||||
output_json += "}"
|
||||
return output_json
|
||||
|
||||
body = capture(caller.body)
|
||||
body_dict = json.loads(body)
|
||||
body_dict['lang'] = lang
|
||||
return Template("""
|
||||
<script type="text/javascript" id='courseContext'>
|
||||
var courseContext = {% autoescape off %}{{ body }}{% endautoescape %};
|
||||
<script type="text/javascript" id='studioContext'>
|
||||
var studioContext = {% autoescape off %}{{ body }}{% endautoescape %};
|
||||
</script>
|
||||
<div id="root"></div>
|
||||
{% load render_bundle from webpack_loader %}
|
||||
{% render_bundle page %}
|
||||
""").render(Context({
|
||||
'body': _convert_dict_to_json(body_dict),
|
||||
'body': json.dumps(body_dict),
|
||||
'page': page
|
||||
}))
|
||||
%>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"dependencies": {
|
||||
"@edx/edx-bootstrap": "^0.4.1",
|
||||
"@edx/paragon": "^0.2.0",
|
||||
"@edx/studio-frontend": "^0.3.0",
|
||||
"@edx/studio-frontend": "^0.4.0",
|
||||
"babel-core": "^6.23.0",
|
||||
"babel-loader": "^6.4.0",
|
||||
"babel-plugin-transform-class-properties": "^6.24.1",
|
||||
|
||||
Reference in New Issue
Block a user