{% 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 or has_course_moderator_role()) 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 }} {% elif ins_len == 2 %} {{ instructors[0].full_name.split(" ")[0] }} and {{ instructors[1].full_name.split(" ")[0] }} {% 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 show_lesson %} {% 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, lesson.youtube, lesson.quiz_id) }} {% endif %} {% else %} {% set course_link = "" + _('here') + "" %}
{{ _("There is no preview available for this lesson. Please join the course to access it. Click {0} to enroll.").format(course_link) }}
{% endif %}
{% if not lesson.edit_mode %} {{ pagination(prev_url, next_url) }} {% endif %}
{% endmacro %} {% macro pagination(prev_url, next_url) %}
{% if prev_url %} {% endif %}
{% set progress = get_progress(course.name, lesson.name) %} {% if not is_mentor(course.name, frappe.session.user) and membership %}
{% endif %}
{% if not is_mentor(course.name, frappe.session.user) and membership %}
{{ _("Mark as Incomplete") }}
{% endif %}
{% endmacro %} {% macro EditLesson(lesson) %}
{% if lesson.youtube %}{{ lesson.youtube }}{% endif %}
{% if lesson.quiz_id %}{{ lesson.quiz_id }}{% endif %}
{% if lesson.name %} {{ _("Create Quiz") }} {% endif %} {{ UploadAttachments() }}
{{ HelpArticle() }} {% endmacro %} {% macro UploadAttachments() %}
{{ _("Upload Attachments") }}
{% endmacro %} {% macro HelpArticle() %}

{{ _("Embed Components") }}

{{ _("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.") }}

  1. {{ _("YouTube Video") }}

    To get the YouTube Video ID, follow the steps mentioned below.

    • {{ _("Upload the video on youtube.") }}
    • {{ _("When you share a youtube video, it shows a URL") }}
    • {{ _("Copy the last parameter of the URL and paste it here.") }}
{% 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 %}