This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
{% extends "templates/base.html" %}
|
||||
{% from "www/macros/sidebar.html" import Sidebar %}
|
||||
{% from "www/macros/common_macro.html" import InstructorsSection, MentorsSection %}
|
||||
|
||||
{% block title %}About{% endblock %}
|
||||
{% block head_include %}
|
||||
<meta name="description" content="Courses" />
|
||||
@@ -7,7 +9,38 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{{ Sidebar(course, batch_code) }}
|
||||
{{ Sidebar(course_slug, batch_code) }}
|
||||
<div class="container">
|
||||
{{ CourseBasicDetail(course)}}
|
||||
{{ InstructorsSection(instructor) }}
|
||||
{% if batch.description %}
|
||||
{{ BatchDetails(batch.description) }}
|
||||
{% endif %}
|
||||
{{ MentorsSection(mentors, True) }}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% macro CourseBasicDetail(course) %}
|
||||
<h2>{{course.name}}</h2>
|
||||
<div class="course-description">
|
||||
{{course.short_introduction}}
|
||||
</div>
|
||||
{% 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 %}
|
||||
<h2>About the Course</h2>
|
||||
<div>{{frappe.utils.md_to_html(course.description)}}</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro BatchDetails(description) %}
|
||||
<div class="mt-5">
|
||||
<h3>About the Batch</h3>
|
||||
<div>
|
||||
{{ frappe.utils.md_to_html(description) }}
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
@@ -1,8 +1,23 @@
|
||||
import frappe
|
||||
from community.www.courses.utils import redirect_if_not_a_member
|
||||
from community.www.courses.utils import redirect_if_not_a_member, get_course, get_instructor, get_batch
|
||||
|
||||
def get_context(context):
|
||||
context.no_cache = 1
|
||||
context.course = frappe.form_dict["course"]
|
||||
context.course_slug = frappe.form_dict["course"]
|
||||
context.course = get_course(context.course_slug)
|
||||
context.batch_code = frappe.form_dict["batch"]
|
||||
redirect_if_not_a_member(context.course, context.batch_code)
|
||||
redirect_if_not_a_member(context.course_slug, context.batch_code)
|
||||
|
||||
context.instructor = get_instructor(context.course.owner)
|
||||
context.batch = get_batch(context.batch_code)
|
||||
context.mentors = get_mentors(context.batch.name)
|
||||
print(context.mentors)
|
||||
|
||||
def get_mentors(batch):
|
||||
mentors = []
|
||||
memberships = frappe.get_all("LMS Batch Membership", {"batch": batch, "member_type": "Mentor"}, ["member"])
|
||||
for membership in memberships:
|
||||
member = frappe.db.get_value("Community Member", membership.member, ["name","full_name"], as_dict=True)
|
||||
member.batch_count = len(frappe.get_all("LMS Batch Membership", {"member": member.name, "member_type": "Mentor"}))
|
||||
mentors.append(member)
|
||||
return mentors
|
||||
Reference in New Issue
Block a user