{% extends "templates/base.html" %} {% from "www/macros/livecode.html" import LiveCodeEditorJS, LiveCodeEditor with context %} {% block title %} {% if lesson.title %} {{ lesson.title }} - {{ course.title }} {% else %} {{ _("New Lesson") }} {% endif %} {% 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 not lesson.edit_mode %} {{ Discussions() }} {% endif %}
{% endblock %} {% macro BreadCrumb(course, lesson) %} {% endmacro %} {% macro LessonContent(lesson) %} {% set instructors = get_instructors(course.name) %} {% set is_instructor = is_instructor(course.name) %}
{% if lesson.title %}{{ lesson.title }}{% endif %}
{{ _("COMPLETED") }} {% if is_instructor and not lesson.edit_mode %} {% 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 and not lesson.edit_mode %}
{{ _("This lesson is not available for preview. As you are the Instructor of the course only you can see it.") }} ×
{% endif %} {% if lesson.edit_mode %} {{ EditLesson(lesson) }} {% else %} {{ render_html(lesson.body) }} {% endif %} {% else %}
{{ _("Start Learning") }}
{{ _("This lesson is not available for preview. Please join the course to access it.") }}
{% endif %}
{% if not lesson.edit_mode %} {{ pagination(prev_url, next_url) }} {% 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 %}
{% endmacro %} {% macro EditLesson(lesson) %}
{% if lesson.name %} {% endif %} {{ _("Create a Quiz") }}
{{ _("Upload Attachments") }}
{{ HelpArticle() }} {% endmacro %} {% macro HelpArticle() %}

{{ _("Help Article") }}

{{ _("You can add additional content to the lesson using a special syntax.The table below mentions all types of dynamic content that you can add to the lessons and the syntax for the same.") }}

{{ _("Content Type") }} {{ _("Syntax") }}
{{ _("Video") }} {% raw %} {{ Video("url_of_source") }} {% endraw %}
{{ _("YouTube Video") }} {% raw %} {{ YouTubeVideo("unique_embed_id") }} {% endraw %}
{{ _("Quiz") }} {% raw %} {{ Quiz("lms_quiz_name") }} {% endraw %}
{% endmacro %} {% macro Discussions() %} {% set topics_count = frappe.db.count("Discussion Topic", {"reference_doctype": "Course Lesson", "reference_docname": lesson.name}) %} {% 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" if topics_count else "" %} {% 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() }} {{ include_script('controls.bundle.js') }} {% for ext in page_extensions %} {{ ext.render_footer() }} {% endfor %} {%- endblock %}