feat: integrated exercises into lessons

- an exercise can now be added to a lesson
- it is rendered using livecode editor with submit button
- remembers the submitted code and shows the submission time

Issue #90
This commit is contained in:
Anand Chitipothu
2021-05-19 20:04:20 +05:30
parent d61acb552a
commit 6f7011ca58
7 changed files with 99 additions and 8 deletions

View File

@@ -0,0 +1,14 @@
{% from "www/macros/livecode.html" import LiveCodeEditorJS, LiveCodeEditor with context %}
<div class="exercise">
<h2>{{ exercise.title }}</h2>
<div class="exercise-description">{{frappe.utils.md_to_html(exercise.description)}}</div>
{% set submission = exercise.get_user_submission() %}
{{ LiveCodeEditor(exercise.name,
code=exercise.code,
reset_code=exercise.code,
is_exercise=True,
last_submitted=submission and submission.creation) }}
</div>