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.
This commit is contained in:
Anand Chitipothu
2021-07-02 23:53:16 +05:30
parent 67708325ae
commit 9caf44cdbd
2 changed files with 11 additions and 0 deletions

View File

@@ -61,6 +61,11 @@
{%- block script %}
{{ super() }}
<script type="text/javascript">
var page_context = {{ page_context | tojson }};
</script>
{% for ext in page_extensions %}
{{ ext.render_footer() }}
{% endfor %}

View File

@@ -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