From 13030b0b9b6e507913f3b326567b0a1d6e6f65f6 Mon Sep 17 00:00:00 2001 From: Anand Chitipothu Date: Tue, 9 Mar 2021 11:51:09 +0000 Subject: [PATCH] Cleanup: moved LiveCodeEditor into a macro --- community/www/courses/topic.html | 25 ++----------------------- community/www/macros/livecode.html | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 23 deletions(-) create mode 100644 community/www/macros/livecode.html diff --git a/community/www/courses/topic.html b/community/www/courses/topic.html index 040b5a1c..0f3280cc 100644 --- a/community/www/courses/topic.html +++ b/community/www/courses/topic.html @@ -1,4 +1,5 @@ {% extends "templates/base.html" %} +{% from "www/macros/livecode.html" import LiveCodeEditor %} {% block title %}{{topic.title}} ({{course.title}}){% endblock %} {% block head_include %} @@ -43,7 +44,7 @@ {% if s.type == "text" %} {{ render_section_text(s) }} {% elif s.type == "code" %} - {{ render_section_code(s) }} + {{ LiveCodeEditor(s.name, s.code) }} {% else %}
Unknown section type: {{s.type}}
{% endif %} @@ -53,28 +54,6 @@ {{ s.contents | markdown }} {% endmacro %} -{% macro render_section_code(s) %} -
-
-
- -

Editor

-
- -
-
-
-

Output

-
-
- Dashed box -

-    
- -
-
-{% endmacro %} - {%- block script %} {{ super() }} diff --git a/community/www/macros/livecode.html b/community/www/macros/livecode.html new file mode 100644 index 00000000..8d6b99d3 --- /dev/null +++ b/community/www/macros/livecode.html @@ -0,0 +1,22 @@ + +{% macro LiveCodeEditor(name, code) %} +
+
+
+ +

Editor

+
+ +
+
+
+

Output

+
+
+ +

+    
+ +
+
+{% endmacro %}