diff --git a/community/hooks.py b/community/hooks.py index eca23eac..5666dd53 100644 --- a/community/hooks.py +++ b/community/hooks.py @@ -187,6 +187,10 @@ update_website_context = 'community.widgets.update_website_context' ## subclass of community.community.plugins.PageExtension # community_lesson_page_extension = None +community_lesson_page_extensions = [ + "community.plugins.LiveCodeExtension" +] + ## Markdown Macros for Lessons community_markdown_macro_renderers = { "Exercise": "community.plugins.exercise_renderer", diff --git a/community/lms/doctype/exercise_submission/exercise_submission.json b/community/lms/doctype/exercise_submission/exercise_submission.json index bd662b11..125af148 100644 --- a/community/lms/doctype/exercise_submission/exercise_submission.json +++ b/community/lms/doctype/exercise_submission/exercise_submission.json @@ -6,12 +6,17 @@ "engine": "InnoDB", "field_order": [ "exercise", - "solution", + "status", + "batch", + "column_break_4", "exercise_title", "course", - "batch", "lesson", - "image" + "section_break_8", + "solution", + "image", + "test_results", + "comments" ], "fields": [ { @@ -21,12 +26,6 @@ "label": "Exercise", "options": "Exercise" }, - { - "fieldname": "solution", - "fieldtype": "Code", - "in_list_view": 1, - "label": "Solution" - }, { "fetch_from": "exercise.title", "fieldname": "exercise_title", @@ -61,11 +60,41 @@ "fieldtype": "Code", "label": "Image", "read_only": 1 + }, + { + "fieldname": "status", + "fieldtype": "Select", + "label": "Status", + "options": "Correct\nIncorrect" + }, + { + "fieldname": "test_results", + "fieldtype": "Small Text", + "label": "Test Results" + }, + { + "fieldname": "comments", + "fieldtype": "Small Text", + "label": "Comments" + }, + { + "fieldname": "solution", + "fieldtype": "Code", + "in_list_view": 1, + "label": "Solution" + }, + { + "fieldname": "column_break_4", + "fieldtype": "Column Break" + }, + { + "fieldname": "section_break_8", + "fieldtype": "Section Break" } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2021-05-21 11:28:45.833018", + "modified": "2021-06-24 16:22:50.570845", "modified_by": "Administrator", "module": "LMS", "name": "Exercise Submission", diff --git a/community/plugins.py b/community/plugins.py index 76cfd4d0..eb9b74fc 100644 --- a/community/plugins.py +++ b/community/plugins.py @@ -67,6 +67,25 @@ class ProfileTab: """ raise NotImplementedError() +class LiveCodeExtension(PageExtension): + def render_header(self): + livecode_url = frappe.get_value("LMS Settings", None, "livecode_url") + context = { + "livecode_url": livecode_url + } + return frappe.render_template( + "templates/livecode/extension_header.html", + context) + + def render_footer(self): + livecode_url = frappe.get_value("LMS Settings", None, "livecode_url") + context = { + "livecode_url": livecode_url + } + return frappe.render_template( + "templates/livecode/extension_footer.html", + context) + def quiz_renderer(quiz_name): quiz = frappe.get_doc("LMS Quiz", quiz_name) context = dict(quiz=quiz) diff --git a/community/templates/livecode/extension_footer.html b/community/templates/livecode/extension_footer.html new file mode 100644 index 00000000..7079acb2 --- /dev/null +++ b/community/templates/livecode/extension_footer.html @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + + + diff --git a/community/templates/livecode/extension_header.html b/community/templates/livecode/extension_header.html new file mode 100644 index 00000000..1499d750 --- /dev/null +++ b/community/templates/livecode/extension_header.html @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/community/www/macros/livecode.html b/community/www/macros/livecode.html index a4ec142f..9714b313 100644 --- a/community/www/macros/livecode.html +++ b/community/www/macros/livecode.html @@ -1,4 +1,3 @@ - {% macro LiveCodeEditorLarge(name, code) %}