fix: course outline, discussion, lms batch
This commit is contained in:
@@ -6,15 +6,10 @@
|
|||||||
"engine": "InnoDB",
|
"engine": "InnoDB",
|
||||||
"field_order": [
|
"field_order": [
|
||||||
"course",
|
"course",
|
||||||
"telegram_link",
|
|
||||||
"code",
|
|
||||||
"column_break_3",
|
|
||||||
"title",
|
|
||||||
"video_call_link",
|
|
||||||
"batch_schedule_section",
|
|
||||||
"start_date",
|
"start_date",
|
||||||
"start_time",
|
"start_time",
|
||||||
"column_break_10",
|
"column_break_3",
|
||||||
|
"title",
|
||||||
"sessions_on",
|
"sessions_on",
|
||||||
"end_time",
|
"end_time",
|
||||||
"section_break_5",
|
"section_break_5",
|
||||||
@@ -35,13 +30,6 @@
|
|||||||
"label": "Course",
|
"label": "Course",
|
||||||
"options": "LMS Course"
|
"options": "LMS Course"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "code",
|
|
||||||
"fieldtype": "Data",
|
|
||||||
"label": "Code",
|
|
||||||
"read_only": 1,
|
|
||||||
"unique": 1
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "title",
|
"fieldname": "title",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
@@ -122,25 +110,6 @@
|
|||||||
"fieldtype": "Time",
|
"fieldtype": "Time",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "End Time"
|
"label": "End Time"
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "telegram_link",
|
|
||||||
"fieldtype": "Data",
|
|
||||||
"label": "Telegram Link"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "video_call_link",
|
|
||||||
"fieldtype": "Data",
|
|
||||||
"label": "Video Call Link"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "batch_schedule_section",
|
|
||||||
"fieldtype": "Section Break",
|
|
||||||
"label": "Batch Schedule"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "column_break_10",
|
|
||||||
"fieldtype": "Column Break"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
@@ -151,7 +120,7 @@
|
|||||||
"link_fieldname": "batch"
|
"link_fieldname": "batch"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"modified": "2021-05-25 18:28:01.718521",
|
"modified": "2021-05-26 16:43:57.399747",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Batch",
|
"name": "LMS Batch",
|
||||||
|
|||||||
@@ -12,22 +12,15 @@ from community.query import find, find_all
|
|||||||
class LMSBatch(Document):
|
class LMSBatch(Document):
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.validate_if_mentor()
|
self.validate_if_mentor()
|
||||||
if not self.code:
|
|
||||||
self.generate_code()
|
|
||||||
|
|
||||||
def validate_if_mentor(self):
|
def validate_if_mentor(self):
|
||||||
course = frappe.get_doc("LMS Course", self.course)
|
course = frappe.get_doc("LMS Course", self.course)
|
||||||
if not course.is_mentor(frappe.session.user) and self.is_new():
|
if not course.is_mentor(frappe.session.user):
|
||||||
frappe.throw(_("You are not a mentor of the course {0}").format(course.title))
|
frappe.throw(_("You are not a mentor of the course {0}").format(course.title))
|
||||||
|
|
||||||
def after_insert(self):
|
def after_insert(self):
|
||||||
create_membership(batch=self.name, member_type="Mentor")
|
create_membership(batch=self.name, member_type="Mentor")
|
||||||
|
|
||||||
def generate_code(self):
|
|
||||||
short_code = frappe.db.get_value("LMS Course", self.course, "short_code")
|
|
||||||
course_batches = frappe.get_all("LMS Batch",{"course":self.course})
|
|
||||||
self.code = short_code + str(len(course_batches) + 1)
|
|
||||||
|
|
||||||
def get_mentors(self):
|
def get_mentors(self):
|
||||||
memberships = frappe.get_all(
|
memberships = frappe.get_all(
|
||||||
"LMS Batch Membership",
|
"LMS Batch Membership",
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class LMSBatchMembership(Document):
|
|||||||
|
|
||||||
for membership in previous_membership:
|
for membership in previous_membership:
|
||||||
batch_course = frappe.db.get_value("LMS Batch", membership.batch, "course")
|
batch_course = frappe.db.get_value("LMS Batch", membership.batch, "course")
|
||||||
if self.name != membership.name and batch_course == course and (membership.member_type == "Student" or self.member_type == "Student"):
|
if batch_course == course and (membership.member_type == "Student" or self.member_type == "Student"):
|
||||||
member_name = frappe.db.get_value("User", self.member, "full_name")
|
member_name = frappe.db.get_value("User", self.member, "full_name")
|
||||||
frappe.throw(_("{0} is already a {1} of {2} course through {3} batch").format(member_name, membership.member_type, course, membership.batch))
|
frappe.throw(_("{0} is already a {1} of {2} course through {3} batch").format(member_name, membership.member_type, course, membership.batch))
|
||||||
|
|
||||||
|
|||||||
@@ -46,9 +46,9 @@ class LMSMessage(Document):
|
|||||||
<div class="font-weight-bold">
|
<div class="font-weight-bold">
|
||||||
{{ message.author_name }}
|
{{ message.author_name }}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-muted">
|
<small class="">
|
||||||
{{ message.message_time }}
|
{{ message.message_time }}
|
||||||
</div>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-5">
|
<div class="mt-5">
|
||||||
{{ message.message }}
|
{{ message.message }}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div class="mt-5 font-weight-bold course-title">
|
<div class="mt-5">
|
||||||
<a class="anchor_style" href="/courses">Courses</a> /{% if course.is_mentor(frappe.session.user) %} <a class="anchor_style" href="/courses/{{ course.name }}"> {{ course.title }}</a> {% else %} <span class="text-muted"> {{ course.title }}</span> {% endif %}
|
<a class="anchor_style" href="/courses">Courses</a> /{% if course.is_mentor(frappe.session.user) %} <a class="anchor_style" href="/courses/{{ course.name }}"> {{ course.title }}</a> {% else %} <span class="text-muted"> {{ course.title }}</span> {% endif %}
|
||||||
</div>
|
</div>
|
||||||
<ul class="nav nav-tabs mt-4">
|
<ul class="nav nav-tabs mt-4">
|
||||||
|
|||||||
@@ -165,13 +165,16 @@ a:hover {
|
|||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.anchor_style:hover {
|
||||||
|
text-decoration: underline
|
||||||
|
}
|
||||||
|
|
||||||
section {
|
section {
|
||||||
padding: 5rem 0 5rem 0;
|
padding: 5rem 0 5rem 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.messages-container {
|
.messages-container {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
background: url("/assets/community/images/wallpaper.png");
|
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +199,12 @@ section {
|
|||||||
.messages li.ours {
|
.messages li.ours {
|
||||||
align-self: flex-end;
|
align-self: flex-end;
|
||||||
margin: 2px 0 2px 8px;
|
margin: 2px 0 2px 8px;
|
||||||
background: #EBEEC7;
|
background: var(--primary-color);
|
||||||
|
color: #fff
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-para {
|
||||||
|
font-size: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.batch-header {
|
.batch-header {
|
||||||
|
|||||||
@@ -284,9 +284,7 @@ section.lightgray {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.lesson-teaser {
|
.lesson-teaser {
|
||||||
font-weight: bold;
|
line-height: 35px;
|
||||||
color: black;
|
|
||||||
padding-left: 20px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#hero h1 {
|
#hero h1 {
|
||||||
|
|||||||
@@ -24,16 +24,16 @@
|
|||||||
|
|
||||||
{% macro Messages(messages) %}
|
{% macro Messages(messages) %}
|
||||||
{% for message in 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="d-flex justify-content-between">
|
||||||
<div class="font-weight-bold">
|
<div class="font-weight-bold">
|
||||||
{{ message.author_name }}
|
{{ message.author_name }}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-muted">
|
<small class="">
|
||||||
{{ frappe.utils.format_datetime(message.creation, "dd-mm-yyyy HH:mm") }}
|
{{ frappe.utils.format_datetime(message.creation, "dd-mm-yyyy HH:mm") }}
|
||||||
|
</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="message-para">
|
||||||
<div class="mt-5">
|
|
||||||
{{ message.message }}
|
{{ message.message }}
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{% extends "templates/base.html" %}
|
{% extends "templates/base.html" %}
|
||||||
{% block title %}About{% endblock %}
|
{% block title %}Batch{% endblock %}
|
||||||
{% block head_include %}
|
{% block head_include %}
|
||||||
<meta name="description" content="Courses" />
|
<meta name="description" content="Courses" />
|
||||||
<meta name="keywords" content="" />
|
<meta name="keywords" content="" />
|
||||||
@@ -20,7 +20,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<h2>Batch Details</h2>
|
<h2>Batch Details</h2>
|
||||||
{{ frappe.utils.md_to_html(batch.description) }}
|
{{ frappe.utils.md_to_html(batch.description) }}
|
||||||
{{ ConnectWithBatch(batch) }}
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -45,13 +44,3 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% 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 %}
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="course-header">
|
<div class="course-header">
|
||||||
<div class="mb-5">
|
<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>
|
</div>
|
||||||
<h1 id="course-title" data-course="{{course.name}}">{{course.title}}</h1>
|
<h1 id="course-title" data-course="{{course.name}}">{{course.title}}</h1>
|
||||||
<div class="course-short-intro">{{ course.short_introduction }}</div>
|
<div class="course-short-intro">{{ course.short_introduction }}</div>
|
||||||
@@ -41,12 +41,7 @@
|
|||||||
{% macro CourseVideo(course) %}
|
{% macro CourseVideo(course) %}
|
||||||
{% if course.video_link %}
|
{% if course.video_link %}
|
||||||
<div class="preview-video">
|
<div class="preview-video">
|
||||||
<iframe
|
<iframe width="560" height="315" src="{{course.video_link}}" title="YouTube video player" frameborder="0"
|
||||||
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"
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||||
allowfullscreen></iframe>
|
allowfullscreen></iframe>
|
||||||
</div>
|
</div>
|
||||||
@@ -74,7 +69,8 @@
|
|||||||
<div class="batch-details">
|
<div class="batch-details">
|
||||||
<div>Session every {{batch.sessions_on}}</div>
|
<div>Session every {{batch.sessions_on}}</div>
|
||||||
<div>{{frappe.utils.format_time(batch.start_time, "short")}} -
|
<div>{{frappe.utils.format_time(batch.start_time, "short")}} -
|
||||||
{{frappe.utils.format_time(batch.end_time, "short")}}</div>
|
{{frappe.utils.format_time(batch.end_time, "short")}}
|
||||||
|
</div>
|
||||||
<div>Starting {{frappe.utils.format_date(batch.start_date, "medium")}}</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 class="course-type" style="color: #888; padding: 10px 0px;">mentors</div>
|
||||||
|
|
||||||
@@ -88,7 +84,7 @@
|
|||||||
<div class="cta">
|
<div class="cta">
|
||||||
<div class="">
|
<div class="">
|
||||||
{% if can_manage %}
|
{% 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 %}
|
{% 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>
|
data-course="{{ course.name | urlencode }}">Join this Batch</button>
|
||||||
@@ -102,9 +98,9 @@
|
|||||||
<h2>Your Batches</h2>
|
<h2>Your Batches</h2>
|
||||||
|
|
||||||
{% if mentor_batches %}
|
{% if mentor_batches %}
|
||||||
<div class="alert alert-secondary">
|
<!-- <div class="alert alert-secondary">
|
||||||
You are a mentor for this course. Manage your batches or create a new batch from here.
|
You are a mentor for this course. Manage your batches or create a new batch from here.
|
||||||
</div>
|
</div> -->
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% for batch in mentor_batches %}
|
{% for batch in mentor_batches %}
|
||||||
@@ -114,7 +110,8 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</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>
|
<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 %}
|
{% else %}
|
||||||
<div class="mentor_message">
|
<div class="mentor_message">
|
||||||
<p> You are a mentor for this course. </p>
|
<p> You are a mentor for this course. </p>
|
||||||
@@ -124,6 +121,7 @@
|
|||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro BatchSectionForStudents(course, upcoming_batches) %}
|
{% macro BatchSectionForStudents(course, upcoming_batches) %}
|
||||||
|
{% if upcoming_batches %}
|
||||||
<h2>Upcoming Batches</h2>
|
<h2>Upcoming Batches</h2>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -133,4 +131,5 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
{% endfor %}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|||||||
@@ -31,12 +31,14 @@
|
|||||||
|
|
||||||
{% macro course_card(course) %}
|
{% macro course_card(course) %}
|
||||||
<div class="col-sm-4 mb-4 text-left">
|
<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 h-100">
|
||||||
<div class='card-body'>
|
<div class='card-body'>
|
||||||
<h5 class='card-title'>{{ course.title }}</h5>
|
<h5 class='card-title'>{{ course.title }}</h5>
|
||||||
{% if course.description %}
|
{% 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 %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user