From e395e7852199371c5997e99a4b37e4e09fe58bab Mon Sep 17 00:00:00 2001 From: Farhanah Sheets Date: Thu, 30 Nov 2017 15:04:44 -0500 Subject: [PATCH] Update to use generic studioContext configuration --- cms/templates/asset_index.html | 20 ++++++++++--------- .../templates/static_content.html | 13 +++--------- package.json | 2 +- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/cms/templates/asset_index.html b/cms/templates/asset_index.html index eaf351e519..68321a0bfd 100644 --- a/cms/templates/asset_index.html +++ b/cms/templates/asset_index.html @@ -56,15 +56,17 @@
% 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}" + } } % else: diff --git a/common/djangoapps/pipeline_mako/templates/static_content.html b/common/djangoapps/pipeline_mako/templates/static_content.html index 9767468c2a..2e0c5ca49e 100644 --- a/common/djangoapps/pipeline_mako/templates/static_content.html +++ b/common/djangoapps/pipeline_mako/templates/static_content.html @@ -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(""" -
{% 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 })) %> diff --git a/package.json b/package.json index 95818fd36b..bcac30cfe7 100644 --- a/package.json +++ b/package.json @@ -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",