Files
lms/community/www/courses/course.html
2021-05-28 13:53:34 +05:30

106 lines
3.2 KiB
HTML

{% extends "templates/base.html" %}
{% from "www/macros/common_macro.html" import MentorsSection %}
{% block title %}{{ course.title }}{% endblock %}
{% block head_include %}
<meta name="description" content="Courses" />
<meta name="keywords" content="Courses {{course.title}}" />
{% endblock %}
{% block content %}
<div class="container">
<div class="course-header">
<div class="mb-5">
<a class="anchor_style" href="/courses">Courses</a> / <span class="text-muted">{{ course.title }}</span>
</div>
<h1 id="course-title" data-course="{{course.name}}">{{course.title}}</h1>
<div class="course-short-intro">{{ course.short_introduction }}</div>
</div>
<div class="row">
<div class="col-lg-8 col-md-12">
<div class="course-details">
{{ CourseVideo(course) }}
{{ CourseDescription(course) }}
{{ BatchSection(course) }}
{{ widgets.CourseOutline(course=course, show_link=False) }}
</div>
</div>
<div class="col-lg-4 col-md-12">
<div class="sidebar">
{{ widgets.InstructorSection(instructor=course.get_instructor()) }}
</div>
<div class="sidebar">
{{ MentorsSection(course.get_mentors(), course.is_mentor(frappe.session.user), course.name) }}
</div>
</div>
</div>
</div>
{% endblock %}
{% macro CourseVideo(course) %}
{% if course.video_link %}
<div class="preview-video">
<iframe width="560" height="315" src="{{course.video_link}}" title="YouTube video player" frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen></iframe>
</div>
{% endif %}
{% endmacro %}
{% macro CourseDescription(course) %}
<h2>Course Description</h2>
<div class="course-description">
{{ frappe.utils.md_to_html(course.description) }}
</div>
{% endmacro %}
{% macro BatchSection(course) %}
{% if course.is_mentor(frappe.session.user) %}
{{ BatchSectionForMentors(course, course.get_batches(mentor=frappe.session.user)) }}
{% else %}
{{ BatchSectionForStudents(course, course.get_upcoming_batches()) }}
{% endif %}
{% endmacro %}
{% macro BatchSectionForMentors(course, mentor_batches) %}
<h2>Your Batches</h2>
{% if mentor_batches %}
<!-- <div class="alert alert-secondary">
You are a mentor for this course. Manage your batches or create a new batch from here.
</div> -->
<div class="row">
{% for batch in mentor_batches %}
<div class="col-lg-4 col-md-6">
{{ widgets.RenderBatch(course=course, batch=batch, can_manage=True) }}
</div>
{% endfor %}
</div>
<a class="add-batch margin-bottom" href="/add-a-new-batch?new=1&course={{course.title}}&slug={{course.name}}">Add a new
batch</a>
{% else %}
<div class="mentor_message">
<p> You are a mentor for this course. </p>
<a class="" href="/add-a-new-batch?new=1&course={{course.title}}&slug={{course.name}}">Create your first batch</a>
</div>
{% endif %}
{% endmacro %}
{% macro BatchSectionForStudents(course, upcoming_batches) %}
{% if upcoming_batches %}
<h2>Upcoming Batches</h2>
<div class="row">
{% for batch in upcoming_batches %}
<div class="col-lg-4 col-md-6">
{{ widgets.RenderBatch(course=course, batch=batch, can_join=True) }}
</div>
{% endfor %}
</div>
{% endif %}
{% endmacro %}