fix: course outline, discussion, lms batch

This commit is contained in:
pateljannat
2021-05-26 17:16:00 +05:30
parent f327c6fb10
commit ab8546a121
11 changed files with 84 additions and 126 deletions

View File

@@ -24,16 +24,16 @@
{% macro Messages(messages) %}
{% for message in messages %}
<li class="discussion {% if message.is_author %} ours {% endif %}">
<li class="{% if message.is_author %} ours {% endif %}">
<div class="d-flex justify-content-between">
<div class="font-weight-bold">
{{ message.author_name }}
</div>
<div class="text-muted">
<small class="">
{{ frappe.utils.format_datetime(message.creation, "dd-mm-yyyy HH:mm") }}
</div>
</small>
</div>
<div class="mt-5">
<div class="message-para">
{{ message.message }}
</div>
</li>

View File

@@ -1,5 +1,5 @@
{% extends "templates/base.html" %}
{% block title %}About{% endblock %}
{% block title %}Batch{% endblock %}
{% block head_include %}
<meta name="description" content="Courses" />
<meta name="keywords" content="" />
@@ -20,7 +20,6 @@
</div>
<h2>Batch Details</h2>
{{ frappe.utils.md_to_html(batch.description) }}
{{ ConnectWithBatch(batch) }}
</div>
@@ -45,13 +44,3 @@
</div>
</div>
{% endmacro %}
{% macro ConnectWithBatch(batch)%}
<h2>Connect with your Batch</h2>
<p>
Reach out on <a href="{{ batch.telegram_link }}">Telegram</a>.
</p>
<p>
Join the <a href="{{ batch.video_call_link }}">Online Class</a>.
</p>
{% endmacro %}

View File

@@ -10,7 +10,7 @@
<div class="container">
<div class="course-header">
<div class="mb-5">
<a class="font-weight-bold anchor_style" href="/courses">Courses</a> / <span class="text-muted">{{ course.title }}</span>
<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>
@@ -18,7 +18,7 @@
<div class="row">
<div class="col-lg-8 col-md-12">
<div class="course-details">
<div class="course-details">
{{ CourseVideo(course) }}
{{ CourseDescription(course) }}
@@ -39,58 +39,54 @@
{% 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 %}
{% 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>
<h2>Course Description</h2>
<div class="course-description">
{{ frappe.utils.md_to_html(course.description) }}
</div>
<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 %}
{% 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 RenderBatch(batch, can_manage=False) %}
<div class="batch">
<div class="batch-details">
<div>Session every {{batch.sessions_on}}</div>
<div>{{frappe.utils.format_time(batch.start_time, "short")}} -
{{frappe.utils.format_time(batch.end_time, "short")}}</div>
<div>Starting {{frappe.utils.format_date(batch.start_date, "medium")}}</div>
<div class="course-type" style="color: #888; padding: 10px 0px;">mentors</div>
<div>Session every {{batch.sessions_on}}</div>
<div>{{frappe.utils.format_time(batch.start_time, "short")}} -
{{frappe.utils.format_time(batch.end_time, "short")}}
</div>
<div>Starting {{frappe.utils.format_date(batch.start_date, "medium")}}</div>
<div class="course-type" style="color: #888; padding: 10px 0px;">mentors</div>
{% for m in batch.get_mentors() %}
{% for m in batch.get_mentors() %}
<div>
{{ widgets.Avatar(member=m, avatar_class="avatar-medium" ) }}
<span class="instructor-title">{{m.full_name}}</span>
</div>
{% endfor %}
{% endfor %}
</div>
<div class="cta">
<div class="">
{% if can_manage %}
<a href="/courses/{{course.name}}/{{batch.name}}/about" class="btn btn-primary">Manage</a>
<a href="/courses/{{course.name}}/{{batch.name}}/home" class="btn btn-primary">Manage</a>
{% else %}
<button class="join-batch btn btn-primary" data-batch="{{ batch.name | urlencode }}"
<button class="join-batch btn btn-primary" data-batch="{{ batch.name | urlencode }}"
data-course="{{ course.name | urlencode }}">Join this Batch</button>
{% endif %}
</div>
@@ -99,38 +95,41 @@
{% endmacro %}
{% macro BatchSectionForMentors(course, mentor_batches) %}
<h2>Your Batches</h2>
<h2>Your Batches</h2>
{% if mentor_batches %}
<div class="alert alert-secondary">
{% 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> -->
<div class="row">
{% for batch in mentor_batches %}
<div class="col-lg-4 col-md-6">
{{ RenderBatch(batch, can_manage=True) }}
</div>
{% endfor %}
</div>
<div class="row">
{% for batch in mentor_batches %}
<div class="col-lg-4 col-md-6">
{{ RenderBatch(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 %}
<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) %}
<h2>Upcoming Batches</h2>
{% if upcoming_batches %}
<h2>Upcoming Batches</h2>
<div class="row">
{% for batch in upcoming_batches %}
<div class="col-lg-4 col-md-6">
{{ RenderBatch(batch, can_manage=False) }}
</div>
{% endfor %}
<div class="row">
{% for batch in upcoming_batches %}
<div class="col-lg-4 col-md-6">
{{ RenderBatch(batch, can_manage=False) }}
</div>
{% endfor %}
</div>
{% endfor %}
{% endmacro %}

View File

@@ -31,12 +31,14 @@
{% macro course_card(course) %}
<div class="col-sm-4 mb-4 text-left">
<a class="anchor_style" href="/courses/{{course.name}}">
<a class="card-links" style="color: inherit;" href="/courses/{{course.name}}">
<div class="card h-100">
<div class='card-body'>
<h5 class='card-title'>{{ course.title }}</h5>
{% if course.description %}
{{ frappe.utils.md_to_html(course.description[:250]) }}
<div class="mt-4">
{{ frappe.utils.md_to_html(course.description[:200]) }}
</div>
{% endif %}
</div>
</div>