Added preview and sections fields to LMS Topic
- The preview is used to show the details of the topic in the course page - the sections are used to show the different part of the topic, each could be of a different type Issue #8
This commit is contained in:
@@ -19,7 +19,30 @@
|
||||
|
||||
<h1>{{ topic.title }}</h1>
|
||||
|
||||
<div>{{ topic.description }}</div>
|
||||
{% for s in topic.sections %}
|
||||
<div class="section section-{{ s.type }}">
|
||||
{{ render_section(s) }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
{% macro render_section(s) %}
|
||||
{% if s.type == "text" %}
|
||||
{{ render_section_text(s) }}
|
||||
{% elif s.type == "code" %}
|
||||
{{ render_section_code(s) }}
|
||||
{% else %}
|
||||
<div>Unknown section type: {{s.type}}</div>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro render_section_text(s) %}
|
||||
{{ s.contents | markdown }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro render_section_code(s) %}
|
||||
<pre>{{s.code}}</pre>
|
||||
{% endmacro %}
|
||||
|
||||
Reference in New Issue
Block a user