{% extends "templates/base.html" %} {% from "www/macros/livecode.html" import LiveCodeEditorJS, LiveCodeEditor with context %} {% block title %} {{ lesson.title }} - {{ course.title }} {% endblock %} {% block head_include %} {% include "public/icons/symbol-defs.svg" %} {% for ext in page_extensions %} {{ ext.render_header() }} {% endfor %} {% endblock %} {% block content %}
{{ BreadCrumb(course, lesson) }}
{{ widgets.CourseOutline(course=course, membership=membership) }}
{{ LessonContent(lesson) }} {% if membership %} {{ pagination(prev_url, next_url) }} {% endif %}
{{ Discussions() }}
{% endblock %} {% macro BreadCrumb(course, lesson) %} {% endmacro %} {% macro LessonContent(lesson) %} {% set instructors = get_instructors(course.name) %} {% set is_instructor = is_instructor(course.name) %}
{{ lesson.title }}
COMPLETED {% if is_instructor %} {{ _("Edit") }} {% endif %}
{% set ins_len = instructors | length %} {% for instructor in instructors %} {% if ins_len > 1 and loop.index == 1 %}
{% endif %} {{ widgets.Avatar(member=instructor, avatar_class="avatar-small") }} {% if ins_len > 1 and loop.index == ins_len %}
{% endif %} {% endfor %} {% if ins_len == 1 %} {{ instructors[0].full_name }} {% else %} {% set suffix = "other" if ins_len - 1 == 1 else "others" %} {{ instructors[0].full_name.split(" ")[0] }} and {{ ins_len - 1 }} {{ suffix }} {% endif %}
{{ frappe.utils.format_date(lesson.creation, "medium") }}
{% if membership or lesson.include_in_preview or is_instructor %} {% if is_instructor and not lesson.include_in_preview %}
This lesson is not available for preview. As you are the Instructor of the course only you can see it. ×
{% endif %} {{ render_html(lesson.body) }} {% else %}
Start Learning
This lesson is not available for preview. Please join the course to access it.
{% endif %}
{% endmacro %} {% macro pagination(prev_url, next_url) %}
{% if prev_url %} {% endif %}
{% if not is_mentor(course.name, frappe.session.user) and membership %} {% set progress = get_progress(course.name, lesson.name) %}
Mark as Incomplete
{% endif %}
{% if course.enable_certification %}
Get Certificate
{% endif %}
{% endmacro %} {% macro Discussions() %} {% set is_instructor = frappe.session.user == course.instructor %} {% set condition = is_instructor if is_instructor else membership %} {% set doctype, docname = "Course Lesson", lesson.name %} {% set title = "Questions" %} {% set cta_title = "Ask a Question" %} {% set button_name = "Start Learning" %} {% set redirect_to = "/courses/" + course.name %} {% set empty_state_title = "Have a doubt?" %} {% set empty_state_subtitle = "Post it here, our mentors will help you out." %} {% include "frappe/templates/discussions/discussions_section.html" %} {% endmacro %} {%- block script %} {{ super() }} {% for ext in page_extensions %} {{ ext.render_footer() }} {% endfor %} {%- endblock %}