From 90be80e645d9adf26b67a4ecfc512f0bcf08ca70 Mon Sep 17 00:00:00 2001 From: Kyle McCormick Date: Thu, 25 Feb 2021 15:54:03 -0500 Subject: [PATCH] fix: assign $$course_id in to fix course-team-authored JS (#26745) Course-team-authored JS expects $$course_id to be defined in the global scope. This has worked fine in Legacy courseware, but due to some differences in page loading (which I don't understand) between Legacy and Chromeless (ie New/MFE) XBlock rendering templates, $$course_id wasn't being assigned before course-team-authored JS was run, causing the scripts to break on the undefined variable. The fix here is to assign $$course_id in the , guaranteeing that the variable is assigned before any other JS is run. TNL-7993 --- lms/templates/courseware/courseware-chromeless.html | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lms/templates/courseware/courseware-chromeless.html b/lms/templates/courseware/courseware-chromeless.html index 929b002cb5..efb614c81a 100644 --- a/lms/templates/courseware/courseware-chromeless.html +++ b/lms/templates/courseware/courseware-chromeless.html @@ -51,6 +51,14 @@ ${static.get_page_title_breadcrumbs(course_name())} ## in this iframe to navigate the parent window. %endif + +## Expose the $$course_id variable for course-team-authored JS. +## We assign it in the so that it will definitely be +## assigned before any in-XBlock JS is run. + + <%block name="js_extra"> @@ -66,10 +74,6 @@ ${static.get_page_title_breadcrumbs(course_name())} <%include file="xqa_interface.html"/> % endif - - ${HTML(fragment.foot_html())}