From 9caf44cdbdbd5cb2a4778fa37e88fb5fd8c8b410 Mon Sep 17 00:00:00 2001 From: Anand Chitipothu Date: Fri, 2 Jul 2021 23:53:16 +0530 Subject: [PATCH] feat: make it possible to enable tracking for livecode execution Tracking of livecode execution is made possible by making the page context with course, batch and lesson available in js. Added a global page_context variable in js and the data for that gets initialzied in the learn.py. --- community/www/batch/learn.html | 5 +++++ community/www/batch/learn.py | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/community/www/batch/learn.html b/community/www/batch/learn.html index a9c08b02..81631fda 100644 --- a/community/www/batch/learn.html +++ b/community/www/batch/learn.html @@ -61,6 +61,11 @@ {%- block script %} {{ super() }} + + + {% for ext in page_extensions %} {{ ext.render_footer() }} {% endfor %} diff --git a/community/www/batch/learn.py b/community/www/batch/learn.py index 0b145d23..e1ada5d8 100644 --- a/community/www/batch/learn.py +++ b/community/www/batch/learn.py @@ -35,6 +35,12 @@ def get_context(context): context.page_extensions = get_page_extensions() + context.page_context = { + "course": context.course.name, + "batch": context.get("batch") and context.batch.name, + "lesson": context.lesson.name + } + def get_chapter_title(course_name, lesson_number): if not lesson_number: return