feat: course header wide

This commit is contained in:
pateljannat
2021-07-02 15:43:21 +05:30
parent ee8273fd30
commit 45d88bdc08
13 changed files with 503 additions and 387 deletions

View File

@@ -5,6 +5,7 @@
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from ...utils import slugify
class Chapter(Document):
def get_lessons(self):
@@ -13,3 +14,6 @@ class Chapter(Document):
fields='name',
order_by="index_")
return [frappe.get_doc('Lesson', row['name']) for row in rows]
def get_slugified_chapter_title(self):
return slugify(self.title)

View File

@@ -1,28 +1,42 @@
<div class="chapter-teaser">
<div class="teaser-body">
<div class="chapter-title mb-5 font-weight-bold"><span class="mr-1">{{index}}.</span> {{ chapter.title }}</div>
<div class="chapter-description">
{{ chapter.description or "" }}
<div>
<a data-target="#{{ chapter.get_slugified_chapter_title() }}" data-toggle="collapse" aria-expanded="false">
<img class="" src="/assets/community/icons/side-arrow.svg"/>
<span class="chapter-title">
{{ chapter.title }}
</span>
</a>
<div class="chapter-content collapse navbar-collapse" id="{{ chapter.get_slugified_chapter_title() }}">
<div class="course-card-meta">
{{ chapter.description }}
</div>
<div class="chapter-lessons">
<div class="lessons">
{% for lesson in chapter.get_lessons() %}
<div class="lesson-teaser">
{% if show_link or lesson.include_in_preview %}
<a class="" href="{{ course.get_learn_url(course.get_lesson_index(lesson.name)) }}{{course.query_parameter}}"
data-course="{{ course.name }}">{{ lesson.title }}</a>
{% else %}
<div class="no-preview" title="This lesson is not available for preview">
<span style="color: #2490ef;">
{{ lesson.title }}
</span>
<i class="fa fa-lock ml-2"></i>
<div class="lesson-info">
{% if show_link or lesson.include_in_preview %}
<a class="" href="{{ course.get_learn_url(course.get_lesson_index(lesson.name)) }}{{course.query_parameter}}" data-course="{{ course.name }}">
{{ loop.index }}.
{{ lesson.title }}</a>
{% else %}
<div title="This lesson is not available for preview">
<span class="">
{{ loop.index }}.
{{ lesson.title }}
</span>
<i class="fa fa-lock ml-2"></i>
</div>
{% endif %}
</div>
{% endif %}
{% if show_progress and not course.is_mentor(frappe.session.user) and lesson.get_progress() %}
<span class="ml-5 badge p-2 {{ lesson.get_slugified_class() }}"> {{ lesson.get_progress() }}</span>
{% endif %}
</div>
{% endfor %}
</div>
</div>
</div>
<script>
frappe.ready(() => {
var elements = $(".collapse")
elements.each((i, elem) => {
if (i <= 5) {
$(elem).addClass("show")
}
})
})
</script>

View File

@@ -1,7 +1,10 @@
<div class="mt-5">
<h3> Course Outline </h3>
{% for chapter in course.get_chapters() %}
{{ widgets.ChapterTeaser(index=loop.index, chapter=chapter, course=course, batch=batch, show_link=show_link, show_progress=show_progress)}}
{% endfor %}
<div class="">
<h3>
Course Outline
</h3>
<div class="coure-outline">
{% for chapter in course.get_chapters() %}
{{ widgets.ChapterTeaser(index=loop.index, chapter=chapter, course=course, batch=batch, show_link=show_link, show_progress=show_progress)}}
{% endfor %}
</div>
</div>

View File

@@ -1,461 +1,547 @@
:root {
--c1: #fefae0;
--c2: #264653;
--c3: #e9c46a;
--c4: #2a9d8f;
--c5: #f4a261;
--c6: #e76f51;
--c7: #ccd5ae;
--c8: #EEEEEE;
--bg: var(--c1);
--header-bg: var(--c2);
--header-color: var(--c3);
--tag-color: var(--c7);
--sidebar-bg: var(--c7);
--h-color: var(--c2);
--text-color: #192734;
--text-color-light: #ccc;
--cta-color: var(--c4);
--send-message: var(--c7);
--received-message: var(--c8);
--checkbox-size: 14px;
--control-bg: var(--gray-100);
--muted-text: #4C5A67;
--button-background: #EEF0F2;
--c1: #fefae0;
--c2: #264653;
--c3: #e9c46a;
--c4: #2a9d8f;
--c5: #f4a261;
--c6: #e76f51;
--c7: #ccd5ae;
--c8: #EEEEEE;
--bg: var(--c1);
--header-bg: var(--c2);
--header-color: var(--c3);
--tag-color: var(--c7);
--sidebar-bg: var(--c7);
--h-color: var(--c2);
--text-color: #192734;
--text-color-light: #ccc;
--cta-color: var(--c4);
--send-message: var(--c7);
--received-message: var(--c8);
--checkbox-size: 14px;
--control-bg: var(--gray-100);
--muted-text: #4C5A67;
--button-background: #EEF0F2;
}
body {
padding: 0px;
margin: 0px;
padding: 0px;
margin: 0px;
}
.chapter-plan {
border-radius: 10px;
margin: 20px 0px;
padding: 20px;
border: 1px solid #ddc;
background: white;
border-radius: 10px;
margin: 20px 0px;
padding: 20px;
border: 1px solid #ddc;
background: white;
}
.chapter-plan h3 {
font-size: 1.1em;
font-weight: bold;
}
.lessons {
padding-left: 20px;
}
.lessons .lesson {
margin: 5px 0px;
font-weight: bold;
font-size: 1.1em;
font-weight: bold;
}
.batch {
border-radius: 10px;
margin: 10px 0px;
background: white;
box-shadow: 0px 5px 10px rgb(0 0 0 / 10%);
border: 1px solid #ddc;
border-radius: 10px;
margin: 10px 0px;
background: white;
box-shadow: 0px 5px 10px rgb(0 0 0 / 10%);
border: 1px solid #ddc;
}
.batch-details {
padding: 20px;
padding: 20px;
}
.batch .cta {
margin-top: 10px;
padding: 10px;
min-height: 28px;
text-align: right;
border-top: 1px solid #ddc;
margin-top: 10px;
padding: 10px;
min-height: 28px;
text-align: right;
border-top: 1px solid #ddc;
}
.batch .right {
float: right;
float: right;
}
img.profile-photo {
width: 24px;
height: 24px;
border-radius: 50%;
width: 24px;
height: 24px;
border-radius: 50%;
}
.lesson-type {
padding-right: 5px;
padding-right: 5px;
}
.preview-video {
margin: 20px 0px;
margin: 20px 0px;
}
.preview-video iframe {
max-width: 100%
max-width: 100%
}
.message {
border: 1px dashed var(--text-color);
padding: 20px;
border-radius: 10px;
border: 1px dashed var(--text-color);
padding: 20px;
border-radius: 10px;
}
.msger-inputarea {
width: 100%;
display: flex;
padding: 10px;
border-top: 2px solid #ddd;
background: #eee;
z-index: 1;
width: 100%;
display: flex;
padding: 10px;
border-top: 2px solid #ddd;
background: #eee;
z-index: 1;
}
.msger-inputarea * {
padding: 10px;
border: none;
border-radius: 3px;
font-size: 1em;
padding: 10px;
border: none;
border-radius: 3px;
font-size: 1em;
}
.msger-input {
flex: 1;
background: #ddd;
flex: 1;
background: #ddd;
}
.message-section {
margin-left: 3%;
display: inline-block;
width: 95%;
margin-left: 3%;
display: inline-block;
width: 95%;
}
.display-4 {
color: #2D005A;
font-weight: 600;
line-height: 51px;
color: #2D005A;
font-weight: 600;
line-height: 51px;
}
section {
padding: 5rem 0 5rem 0;
padding: 5rem 0 5rem 0;
}
.messages-container {
margin: 0 auto;
border: 1px solid black;
margin: 0 auto;
border: 1px solid black;
}
.messages {
overflow: auto;
height: 450px;
display: flex;
flex-direction: column;
align-items: flex-start;
padding: 8px;
list-style-type: none;
height: 450px;
display: flex;
flex-direction: column;
align-items: flex-start;
padding: 8px;
list-style-type: none;
}
.messages li {
background: #F7F5F5;
border-radius: 8px;
padding: 8px;
margin: 2px 8px 2px 0;
width: 40%;
background: #F7F5F5;
border-radius: 8px;
padding: 8px;
margin: 2px 8px 2px 0;
width: 40%;
}
.messages li.ours {
align-self: flex-end;
margin: 2px 0 2px 8px;
background: var(--primary-color);
color: #fff
align-self: flex-end;
margin: 2px 0 2px 8px;
background: var(--primary-color);
color: #fff
}
.message-para {
font-size: 20px;
font-size: 20px;
}
.batch-header {
background: #eee;
border: 2px solid #ddd;
background: #eee;
border: 2px solid #ddd;
}
.page-card {
max-width: 360px;
padding: 15px;
margin: 70px auto;
border: 1px solid #d1d8dd;
border-radius: 4px;
background-color: #fff;
box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.1);
max-width: 360px;
padding: 15px;
margin: 70px auto;
border: 1px solid #d1d8dd;
border-radius: 4px;
background-color: #fff;
box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.1);
}
.page-card .page-card-head {
padding: 10px 15px;
margin: -15px;
margin-bottom: 15px;
border-bottom: 1px solid #d1d8dd;
padding: 10px 15px;
margin: -15px;
margin-bottom: 15px;
border-bottom: 1px solid #d1d8dd;
}
.page-card .page-card-head .indicator {
color: #36414C;
font-size: 14px;
color: #36414C;
font-size: 14px;
}
.page-card .page-card-head .indicator::before {
margin: 0 6px 0.5px 0px;
margin: 0 6px 0.5px 0px;
}
.page-card .btn {
margin-top: 30px;
margin-top: 30px;
}
input[type=checkbox] {
appearance: auto;
appearance: auto;
}
.partiallycomplete {
background: #FEF4E2;
color: #976417;
background: #FEF4E2;
color: #976417;
}
.partiallycomplete img {
background: #976417;
background: #976417;
}
.complete {
background: #EAF5EE;
color: #38A160;
background: #EAF5EE;
color: #38A160;
}
.complete img {
background: #38A160;
background: #38A160;
}
.incomplete {
background: #FEECEC;
color: #E24C4C;
background: #FEECEC;
color: #E24C4C;
}
.incomplete img {
background: #E24C4C;
background: #E24C4C;
}
.progress-image {
margin-right: 3px;
border-radius: 50px;
padding: 5px;
margin-right: 3px;
border-radius: 50px;
padding: 5px;
}
.course-image {
height: 168px;
width: 352px;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
background-size: 352px 168px;
height: 168px;
width: 352px;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
background-size: 352px 168px;
}
@media (max-width: 768px) {
.course-image {
width: 336px;
}
.course-image {
width: 336px;
}
}
@media (max-width: 375px) {
.course-image {
width: 312px;
background-size: cover;
background-repeat: no-repeat;
}
.course-image {
width: 312px;
background-size: cover;
background-repeat: no-repeat;
}
}
.course-tags {
display: flex;
position: relative;
top: 12px;
left: 12px;
height: 20px;
display: flex;
position: relative;
top: 12px;
left: 12px;
height: 20px;
}
.course-card-pills {
background: #ffffff;
margin: 0px 10px;
border-radius: 4px;
padding: 4px 6px;
font-size: 10px;
line-height: 120%;
text-align: center;
letter-spacing: 0.011em;
text-transform: uppercase;
color: #2C5477;
font-weight: bold;
box-shadow: 0px 5px 10px rgb(0 0 0 / 10%);
background: #ffffff;
margin: 0px 10px;
border-radius: 4px;
padding: 4px 6px;
font-size: 10px;
line-height: 120%;
text-align: center;
letter-spacing: 0.011em;
text-transform: uppercase;
color: #2C5477;
font-weight: bold;
box-shadow: 0px 5px 10px rgb(0 0 0 / 10%);
}
.common-page-style {
background: #F4F5F6;
background: #F4F5F6;
}
.common-card-style {
display: flex;
flex-direction: column;
align-items: flex-start;
background: #FFFFFF;
border-radius: 8px;
box-shadow: 0px 5px 10px rgb(0 0 0 / 10%);
position: relative;
display: flex;
align-items: flex-start;
background: #FFFFFF;
border-radius: 8px;
box-shadow: 0px 5px 10px rgb(0 0 0 / 10%);
position: relative;
}
.course-card {
width: 352px;
height: 380px;
margin: 0px 16px 32px;
flex-direction: column;
width: 352px;
height: 380px;
margin: 0px 16px 32px;
}
@media (max-width: 768px) {
.common-card-style {
width: 336px;
}
.common-card-style {
width: 336px;
}
}
@media (max-width: 375px) {
.common-card-style {
width: 312px;
}
.common-card-style {
width: 312px;
}
}
.course-card-meta {
font-size: 12px;
line-height: 135%;
margin: 16px 0px 8px;
color: var(--muted-text);
height: 15px;
font-size: 12px;
line-height: 135%;
margin: 16px 0px 8px;
color: var(--muted-text);
height: 15px;
}
.course-card-content {
width: 100%;
padding: 0px 24px 20px;
width: 100%;
padding: 0px 24px 20px;
}
.course-card-title {
font-weight: 600;
font-size: 18px;
line-height: 156%;
letter-spacing: -0.014em;
color: var(--text-color);
align-self: stretch;
margin-bottom: 16px;
height: 45px;
font-weight: 600;
font-size: 18px;
line-height: 156%;
letter-spacing: -0.014em;
color: var(--text-color);
align-self: stretch;
margin-bottom: 16px;
height: 45px;
}
.card-divider {
border: 1px solid #E2E6E9;
margin-bottom: 16px;
border: 1px solid #E2E6E9;
margin-bottom: 16px;
}
.course-card-meta-2 {
margin-bottom: 16px;
margin-bottom: 16px;
}
.course-instructor {
margin: 0px 8px;
font-size: 12px;
line-height: 135%;
color: var(--text-color);
margin: 0px 8px;
font-size: 12px;
line-height: 135%;
color: var(--text-color);
}
.course-student-count {
font-size: 12px;
line-height: 135%;
color: var(--muted-text);
float: right;
font-size: 12px;
line-height: 135%;
color: var(--muted-text);
float: right;
}
.view-course-link {
height: 32px;
background: var(--button-background);
border-radius: 4px;
font-size: 12px;
padding: 8px 0px 8px;
text-align: center;
line-height: 135%;
color: var(--text-color);
height: 32px;
background: var(--button-background);
border-radius: 4px;
font-size: 12px;
padding: 8px 0px 8px;
text-align: center;
line-height: 135%;
color: var(--text-color);
}
.cards-parent {
display: flex;
flex-wrap: wrap;
display: flex;
flex-wrap: wrap;
}
@media (max-width: 375px) {
.course-cards-parent {
justify-content: center;
}
.course-cards-parent {
justify-content: center;
}
}
.courses-header {
padding: 50px 30px 20px;
color: var(--text-color);
font-weight: 600;
font-size: 22px;
line-height: 145%;
letter-spacing: -0.0175em
padding: 50px 30px 20px;
color: var(--text-color);
font-weight: 600;
font-size: 22px;
line-height: 145%;
letter-spacing: -0.0175em
}
.course-top-section {
margin: 0px 140px 0px;
margin: 0px 140px 0px;
}
@media (max-width: 768px) {
.course-top-section {
margin: 0px 40px 0px;
}
.course-top-section {
margin: 0px 40px 0px;
}
}
@media (max-width: 375px) {
.course-top-section {
margin: 0px 24px 0px;
}
.course-top-section {
margin: 0px 24px 0px;
}
}
.is-primary {
background: var(--primary-color);
color: #FFFFFF;
background: var(--primary-color);
color: #FFFFFF;
}
.button-links:hover {
text-decoration: none;
text-decoration: none;
}
.icon-background {
border-radius: 50%;
padding: 3px;
width: 24px;
height: 24px;
border-radius: 50%;
padding: 3px;
width: 24px;
height: 24px;
}
.small-margin {
margin-left: 10px;
margin-left: 10px;
}
.reviews-heading {
display: flex;
justify-content: space-between;
display: flex;
justify-content: space-between;
}
.reviews-title {
font-weight: 600;
font-size: 22px;
line-height: 145%;
font-weight: 600;
font-size: 22px;
line-height: 145%;
}
.review-card {
width: 100%;
height: fit-content;
margin: 0px 16px 32px;
padding: 16px;
width: 100%;
height: fit-content;
margin: 0px 16px 32px;
padding: 16px;
}
.review-card-footer {
width: 100%;
display: flex;
width: 100%;
display: flex;
}
.review-content {
font-size: 15px;
line-height: 135%;
font-size: 15px;
line-height: 135%;
}
div.custom-checkbox>label>input {
visibility: hidden;
}
div.custom-checkbox>label>img {
height: 20px;
width: 20px;
border: 1px solid black;
border-radius: 5px;
}
div.custom-checkbox>label>input:checked+img {
background: url(/assets/community/images/Vector.png);
background-repeat: no-repeat;
background-position: center center;
background-size: 15px 15px;
object-fit: contain;
}
.course-card-wide {
width: 1120px;
height: 248px;
display: flex;
flex-direction: row;
padding: 24px;
background: #E2E6E9;
border-radius: 12px;
}
.course-image-wide {
width: 352px;
height: 200px;
background-size: 352px 200px;
margin-right: 32px;
border-radius: 5px;
}
.course-home-page {
padding: 80px;
}
.course-card-wide-content {
display: flex;
flex-direction: column;
}
.course-card-wide-title {
font-style: normal;
font-weight: 600;
font-size: 40px;
line-height: 120%;
color: #192734;
margin-bottom: 8px;
}
.course-card-wide-intro {
font-size: 16px;
line-height: 172%;
letter-spacing: -0.011em;
color: #4C5A67;
width: 688px;
height: 80px;
margin-bottom: 16px;
}
.wide-button {
box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.13), 0px 0px 0.5px rgba(0, 0, 0, 0.5);
border-radius: 6px;
padding: 12px 0px 12px 24px;
margin-right: 16px;
}
.start-learning {
background: var(--primary-color);
width: 185px;
height: 48px;
color: #FFFFFF;
}
.video-preview {
background: #FFFFFF;
width: 234px;
height: 48px;
}
.course-buttons {
display: flex;
}
* {
outline: 1px solid #f00 !important;
opacity: 1 !important;
visibility: visible !important;
}

View File

@@ -0,0 +1,3 @@
<svg width="10" height="6" viewBox="0 0 10 6" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1 1L5 5L9 1" stroke="#4C5A67" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 213 B

View File

@@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 18L16 12L8 6" stroke="#4C5A67" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 237 B

View File

@@ -1,3 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 2L15.09 8.26L22 9.27L17 14.14L18.18 21.02L12 17.77L5.82 21.02L7 14.14L2 9.27L8.91 8.26L12 2Z" stroke="#192734" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M12 2L15.09 8.26L22 9.27L17 14.14L18.18 21.02L12 17.77L5.82 21.02L7 14.14L2 9.27L8.91 8.26L12 2Z" stroke="#192734" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 276 B

After

Width:  |  Height:  |  Size: 278 B

View File

@@ -0,0 +1,3 @@
<svg width="6" height="10" viewBox="0 0 6 10" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1 9L5 5L1 1" stroke="#4C5A67" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 190 B

View File

@@ -0,0 +1,3 @@
<svg class="icon">
<use href="#icon-tick"></use>
</svg>

After

Width:  |  Height:  |  Size: 58 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

After

Width:  |  Height:  |  Size: 200 B

View File

@@ -14,9 +14,12 @@
{% set options = [question.option_1, question.option_2, question.option_3, question.option_4] %}
{% for option in options %}
{% if option %}
<div class="checkbox mb-2">
<input {% if question.multiple %} type="checkbox" {% else %} type="radio"
name="{{ question.question | urlencode }}" {% endif %} class="option" value="{{ option | urlencode }}">
<div class="custom-checkbox mb-2">
<label>
<input {% if question.multiple %} type="checkbox" {% else %} type="radio"
name="{{ question.question | urlencode }}" {% endif %} class="option" value="{{ option | urlencode }}">
<img />
</label>
<span class="label-area">{{ option }}</span>
</div>
{% endif %}

View File

@@ -20,19 +20,16 @@
<div class="mt-5">
{% for member in members %}
<div class="d-flex align-items-center">
{{ widgets.Avatar(member=member, avatar_class="avatar-large") }}
{{ widgets.Avatar(member=member, avatar_class="avatar-medium") }}
<div class="d-flex flex-column ml-2">
<div class="d-flex">
<a class="anchor_style ml-2" href="/{{member.username}}">
<h3>{{ member.full_name }}</h3>
<div class="review-content">{{ member.full_name }}</div>
</a>
{% if course.is_mentor(member.name) %}
<div class="badge badge-success ml-2 align-self-start">Mentor</div>
{% endif %}
</div>
{% if member.bio %}
<i class="ml-2">{{member.bio}}</i>
{% endif %}
</div>
</div>
{% if loop.index != member_count %}

View File

@@ -1,112 +1,109 @@
{% 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}}" />
<link rel="stylesheet" href="/assets/frappe/css/font-awesome.css">
{% block title %}{{ course.title }}
{% endblock %}
{% block head_include %}
<meta name="description" content="Courses"/>
<meta name="keywords" content="Courses {{course.title}}"/>
<link rel="stylesheet" href="/assets/frappe/css/font-awesome.css">
{% 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>
<div class="d-flex justify-content-between align-items-end">
<h2 id="course-title" data-course="{{course.name}}">{{course.title}}</h2>
{% if not course.disable_self_learning and not membership %}
<div>
<button class="btn btn-primary join-batch" data-course="{{ course.name | urlencode }}"> Start Learning </button>
<div class="common-page-style course-home-page">
<div class="common-card-style course-card-wide">
<div class="course-image-wide" style="background-image: url({{ course.image }});">
<div class="course-tags">
{% for tag in course.get_tags() %}
<div class="course-card-pills">{{ tag }}</div>
{% endfor %}
</div>
</div>
<div class="course-card-wide-content">
<div class="course-card-wide-title">
{{ course.title }}
</div>
<div class="course-card-wide-intro">
{{ course.short_introduction }}
</div>
<div class="course-buttons">
<div class="wide-button start-learning">
Start Learning
<img class="" src="/assets/community/icons/white-arrow.svg"/>
</div>
<div class="wide-button video-preview">
Watch Video Preview
<img class="" src="/assets/community/icons/play.svg"/>
</div>
</div>
</div>
</div>
<div class="course-home-outline">
{{ widgets.CourseOutline(course=course, show_link=membership) }}
</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="allowfullscreen"></iframe>
</div>
{% endif %}
{% endmacro %}
{% macro CourseDescription(course) %}
<div class="mt-5">
<h3>Course Description</h3>
<div class="course-description text-justify">
{{ frappe.utils.md_to_html(course.description) }}
</div>
</div>
{% endmacro %}
{% macro BatchSection(course) %}
<div class="row">
<div class="col-lg-8 col-md-12">
{% if course.is_mentor(frappe.session.user) %}
{{ BatchSectionForMentors(course, course.get_batches(mentor=frappe.session.user)) }}
{% else %}
{{ BatchSectionForStudents(course, course.get_upcoming_batches()) }}
{% endif %}
</div>
<div class="course-short-intro">{{ course.short_introduction }}</div>
</div>
{% endmacro %}
{% macro BatchSectionForMentors(course, mentor_batches) %}
<h2>Your Batches</h2>
<div class="">
<div class="">
<div class="course-details">
{{ CourseVideo(course) }}
{{ CourseDescription(course) }}
{{ widgets.InstructorSection(instructor=course.get_instructor()) }}
{{ BatchSection(course) }}
{{ widgets.CourseOutline(course=course, show_link=membership) }}
{{ widgets.Reviews(course=course, membership=membership) }}
</div>
{% if mentor_batches %}
<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>
</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 %}
<a class="add-batch margin-bottom" href="/add-a-new-batch?new=1&course={{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.name}}">Create your first batch</a>
</div>
{% endif %}
{% endmacro %}
{% macro CourseDescription(course) %}
<div class="mt-5">
<h3>Course Description</h3>
<div class="course-description text-justify">
{{ frappe.utils.md_to_html(course.description) }}
</div>
</div>
{% endmacro %}
{% macro BatchSection(course) %}
<div class="row">
<div class="col-lg-8 col-md-12">
{% if course.is_mentor(frappe.session.user) %}
{{ BatchSectionForMentors(course, course.get_batches(mentor=frappe.session.user)) }}
{% macro BatchSectionForStudents(course, upcoming_batches) %}
{% if upcoming_batches %}
<div class="mt-5">
<h3 class="upcoming">Upcoming Batches</h3>
<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>
{% else %}
{{ BatchSectionForStudents(course, course.get_upcoming_batches()) }}
<div class="mt-5 upcoming">There are no Upcoming Batches for this course currently.</div>
{% endif %}
</div>
</div>
{% endmacro %}
{% macro BatchSectionForMentors(course, mentor_batches) %}
<h2>Your Batches</h2>
{% if mentor_batches %}
<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.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.name}}">Create your first batch</a>
</div>
{% endif %}
{% endmacro %}
{% macro BatchSectionForStudents(course, upcoming_batches) %}
{% if upcoming_batches %}
<div class="mt-5">
<h3 class="upcoming">Upcoming Batches</h3>
<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>
{% else %}
<div class="mt-5 upcoming">There are no Upcoming Batches for this course currently.</div>
{% endif %}
</div>
{% endmacro %}