Merge branch 'style-fixes' of https://github.com/frappe/community into invite-based-membership
This commit is contained in:
@@ -136,6 +136,7 @@ primary_rules = [
|
||||
{"from_route": "/hackathons/<hackathon>/<project>", "to_route": "hackathons/project"},
|
||||
{"from_route": "/dashboard", "to_route": ""},
|
||||
{"from_route": "/add-a-new-batch", "to_route": "add-a-new-batch"},
|
||||
{"from_route": "/courses/<course>/<batch>/home", "to_route": "batch/home"},
|
||||
{"from_route": "/courses/<course>/<batch>/learn", "to_route": "batch/learn"},
|
||||
{"from_route": "/courses/<course>/<batch>/learn/<int:chapter>.<int:lesson>", "to_route": "batch/learn"},
|
||||
{"from_route": "/courses/<course>/<batch>/schedule", "to_route": "batch/schedule"},
|
||||
|
||||
@@ -14,7 +14,9 @@ class TestExercise(unittest.TestCase):
|
||||
course = frappe.get_doc({
|
||||
"doctype": "LMS Course",
|
||||
"name": "test-course",
|
||||
"title": "Test Course"
|
||||
"title": "Test Course",
|
||||
"short_introduction": "Test Course",
|
||||
"description": "Test Course"
|
||||
})
|
||||
course.insert()
|
||||
e = frappe.get_doc({
|
||||
|
||||
@@ -6,11 +6,10 @@
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"course",
|
||||
"title",
|
||||
"start_date",
|
||||
"start_time",
|
||||
"column_break_3",
|
||||
"code",
|
||||
"title",
|
||||
"sessions_on",
|
||||
"end_time",
|
||||
"section_break_5",
|
||||
@@ -31,13 +30,6 @@
|
||||
"label": "Course",
|
||||
"options": "LMS Course"
|
||||
},
|
||||
{
|
||||
"fieldname": "code",
|
||||
"fieldtype": "Data",
|
||||
"label": "Code",
|
||||
"read_only": 1,
|
||||
"unique": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "title",
|
||||
"fieldtype": "Data",
|
||||
@@ -84,7 +76,8 @@
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_5",
|
||||
"fieldtype": "Section Break"
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Batch Description"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_9",
|
||||
@@ -92,7 +85,8 @@
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_7",
|
||||
"fieldtype": "Section Break"
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Batch Settings"
|
||||
},
|
||||
{
|
||||
"fieldname": "start_date",
|
||||
@@ -126,7 +120,7 @@
|
||||
"link_fieldname": "batch"
|
||||
}
|
||||
],
|
||||
"modified": "2021-05-06 05:46:38.469120",
|
||||
"modified": "2021-05-26 16:43:57.399747",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "LMS Batch",
|
||||
|
||||
@@ -12,8 +12,6 @@ from community.query import find, find_all
|
||||
class LMSBatch(Document):
|
||||
def validate(self):
|
||||
self.validate_if_mentor()
|
||||
if not self.code:
|
||||
self.generate_code()
|
||||
|
||||
def validate_if_mentor(self):
|
||||
course = frappe.get_doc("LMS Course", self.course)
|
||||
@@ -23,11 +21,6 @@ class LMSBatch(Document):
|
||||
def after_insert(self):
|
||||
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):
|
||||
memberships = frappe.get_all(
|
||||
"LMS Batch Membership",
|
||||
@@ -87,6 +80,11 @@ class LMSBatch(Document):
|
||||
membership = self.get_membership(user)
|
||||
return membership and membership.current_lesson
|
||||
|
||||
def get_learn_url(self, lesson_number):
|
||||
if not lesson_number:
|
||||
return
|
||||
return f"/courses/{self.course}/{self.name}/learn/{lesson_number}"
|
||||
|
||||
@frappe.whitelist()
|
||||
def save_message(message, batch):
|
||||
doc = frappe.get_doc({
|
||||
|
||||
@@ -34,7 +34,7 @@ class LMSBatchMembership(Document):
|
||||
"member": self.member,
|
||||
"name": ["!=", self.name]
|
||||
},
|
||||
fields=["batch", "member_type"]
|
||||
fields=["batch", "member_type", "name"]
|
||||
)
|
||||
|
||||
for membership in previous_membership:
|
||||
|
||||
@@ -19,7 +19,9 @@ class TestLMSBatchMembership(unittest.TestCase):
|
||||
"doctype": "LMS Course",
|
||||
"name": "test-course",
|
||||
"title": "Test Course",
|
||||
"short_code": "XX"
|
||||
"short_code": "XX",
|
||||
"short_introduction": "Test Course",
|
||||
"description": "Test Course"
|
||||
})
|
||||
course.insert()
|
||||
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
{
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Markdown Editor",
|
||||
"label": "Description"
|
||||
"label": "Description",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
@@ -57,7 +58,8 @@
|
||||
{
|
||||
"fieldname": "short_introduction",
|
||||
"fieldtype": "Small Text",
|
||||
"label": "Short Introduction"
|
||||
"label": "Short Introduction",
|
||||
"reqd": 1
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
@@ -84,7 +86,7 @@
|
||||
"link_fieldname": "course"
|
||||
}
|
||||
],
|
||||
"modified": "2021-05-06 13:37:03.318829",
|
||||
"modified": "2021-05-23 18:14:32.602647",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "LMS Course",
|
||||
|
||||
@@ -15,7 +15,9 @@ class TestLMSCourse(unittest.TestCase):
|
||||
def new_course(self, title):
|
||||
doc = frappe.get_doc({
|
||||
"doctype": "LMS Course",
|
||||
"title": title
|
||||
"title": title,
|
||||
"short_introduction": title,
|
||||
"description": title
|
||||
})
|
||||
doc.insert()
|
||||
return doc
|
||||
|
||||
@@ -18,7 +18,7 @@ class LMSMessage(Document):
|
||||
template = self.get_message_template()
|
||||
message = frappe._dict({
|
||||
"author_name": self.author_name,
|
||||
"message_time": frappe.utils.pretty_date(self.creation),
|
||||
"message_time": frappe.utils.format_datetime(self.creation, "dd-mm-yyyy HH:mm"),
|
||||
"message": frappe.utils.md_to_html(self.message)
|
||||
})
|
||||
|
||||
@@ -32,26 +32,28 @@ class LMSMessage(Document):
|
||||
template = frappe.render_template(template, {{
|
||||
"message": message
|
||||
}})
|
||||
$(".message-section").append(template);
|
||||
$(".messages").append(template);
|
||||
var message_element = document.getElementsByClassName("messages")[0]
|
||||
message_element.scrollTo(0, message_element.scrollHeight);
|
||||
""".format(template, message, self.owner)
|
||||
|
||||
frappe.publish_realtime(event="eval_js", message=js, after_commit=True)
|
||||
|
||||
def get_message_template(self):
|
||||
return """
|
||||
<div class="discussion {% if message.is_author %} is-author {% 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="">
|
||||
{{ message.message_time }}
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-5">
|
||||
<div class="message-para">
|
||||
{{ message.message }}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
"""
|
||||
|
||||
def send_email(self):
|
||||
@@ -106,4 +108,3 @@ def send_daily_digest():
|
||||
},
|
||||
delayed = False
|
||||
)
|
||||
|
||||
|
||||
4
community/lms/widgets/BatchHeader.html
Normal file
4
community/lms/widgets/BatchHeader.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<div class="p-5 batch-header">
|
||||
<h3>{{batch_name}}</h3>
|
||||
<div class="text-muted">{{member_count}} members</div>
|
||||
</div>
|
||||
39
community/lms/widgets/BatchTabs.html
Normal file
39
community/lms/widgets/BatchTabs.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<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 %}
|
||||
</div>
|
||||
<ul class="nav nav-tabs mt-4">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="home" href="/courses/{{course.name}}/{{batch.name}}/home">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="learn" href="/courses/{{course.name}}/{{batch.name}}/learn">Learn</a>
|
||||
</li>
|
||||
<!-- <li class="nav-item">
|
||||
<a class="nav-link" id="schedule" href="/courses/{{course.name}}/{{batch.name}}/schedule">Schedule</a>
|
||||
</li> -->
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="members" href="/courses/{{course.name}}/{{batch.name}}/members">Members</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="discussion" href="/courses/{{course.name}}/{{batch.name}}/discuss">Discussion</a>
|
||||
</li>
|
||||
<!-- <li class="nav-item">
|
||||
<a class="nav-link" id="about" href="/courses/{{course.name}}/{{batch.name}}/about">About</a>
|
||||
</li> -->
|
||||
{% if batch.is_member(frappe.session.user, member_type="Mentor") %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="progress" href="/courses/{{course.name}}/{{batch.name}}/progress">Progress</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<script>
|
||||
frappe.ready(() => {
|
||||
var selector = document.querySelector(`a[href="${decodeURIComponent(window.location.pathname)}"]`)
|
||||
if (selector) {
|
||||
selector.classList.add('active');
|
||||
}
|
||||
else {
|
||||
$("#learn").addClass('active')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@@ -1,14 +1,14 @@
|
||||
<div class="chapter-teaser">
|
||||
<div class="teaser-body">
|
||||
<h3 class="chapter-title"><span class="chapter-number">{{index}}</span> {{ chapter.title }}</h3>
|
||||
<h3 class="chapter-title"><span class="mr-1">{{index}}.</span> {{ chapter.title }}</h3>
|
||||
<div class="chapter-description">
|
||||
{{ chapter.description or "" }}
|
||||
</div>
|
||||
<div class="chapter-lessons">
|
||||
{% for lesson in chapter.get_lessons() %}
|
||||
<div class="lesson-teaser">
|
||||
{{lesson.title}}
|
||||
</div>
|
||||
<div class="lesson-teaser">
|
||||
<a {% if show_link %} class="anchor_style" href="{{ batch.get_learn_url(course.get_lesson_index(lesson.name)) }}" {% endif %}>{{ lesson.title }}</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
5
community/lms/widgets/CourseOutline.html
Normal file
5
community/lms/widgets/CourseOutline.html
Normal file
@@ -0,0 +1,5 @@
|
||||
<h2>Course Outline</h2>
|
||||
|
||||
{% for chapter in course.get_chapters() %}
|
||||
{{ widgets.ChapterTeaser(index=loop.index, chapter=chapter, course=course, batch=batch, show_link=show_link)}}
|
||||
{% endfor %}
|
||||
5
community/lms/widgets/InstructorSection.html
Normal file
5
community/lms/widgets/InstructorSection.html
Normal file
@@ -0,0 +1,5 @@
|
||||
<h3>Instructor</h3>
|
||||
<div class="instructor">
|
||||
<div class="instructor-title">{{instructor.full_name}}</div>
|
||||
<div class="instructor-subtitle">Created {{instructor.get_course_count()}} courses</div>
|
||||
</div>
|
||||
@@ -97,14 +97,6 @@ body {
|
||||
border-top: 1px solid #ddc;
|
||||
}
|
||||
|
||||
.batch .cta button {
|
||||
background: var(--cta-color);
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
padding: 5px 10px;
|
||||
}
|
||||
|
||||
.batch .right {
|
||||
float: right;
|
||||
}
|
||||
@@ -127,44 +119,13 @@ img.profile-photo {
|
||||
max-width: 100%
|
||||
}
|
||||
|
||||
|
||||
/* override style of base */
|
||||
|
||||
.message {
|
||||
border: 1px dashed var(--text-color);
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.dashboard__profile {
|
||||
width: 150px;
|
||||
height: 155px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.dashboard__profileSmall {
|
||||
width: 59px;
|
||||
height: 57px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.dashboard__abbr {
|
||||
font-size: 50px;
|
||||
width: 155px;
|
||||
height: 155px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.dashboard__abbrSmall {
|
||||
font-size: 20px;
|
||||
width: 59px;
|
||||
height: 57px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.msger-inputarea {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
padding: 10px;
|
||||
@@ -182,37 +143,6 @@ img.profile-photo {
|
||||
flex: 1;
|
||||
background: #ddd;
|
||||
}
|
||||
.msger-send-btn {
|
||||
margin-left: 10px;
|
||||
background: var(--cta-color);
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
transition: background 0.23s;
|
||||
}
|
||||
|
||||
.discussion {
|
||||
border: 1px solid var(--text-color);
|
||||
padding: 10px;
|
||||
margin: 10px;
|
||||
border-radius: 10px;
|
||||
background: var(--received-message);
|
||||
width: 50%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.is-author {
|
||||
float: right;
|
||||
background: var(--send-message);
|
||||
}
|
||||
|
||||
.batch-header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
background: var(--bg);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.message-section {
|
||||
margin-left: 3%;
|
||||
@@ -227,6 +157,57 @@ img.profile-photo {
|
||||
}
|
||||
|
||||
.anchor_style {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.anchor_style:hover {
|
||||
text-decoration: underline
|
||||
}
|
||||
|
||||
section {
|
||||
padding: 5rem 0 5rem 0;
|
||||
}
|
||||
|
||||
.messages-container {
|
||||
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;
|
||||
}
|
||||
|
||||
.messages li {
|
||||
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
|
||||
}
|
||||
|
||||
.message-para {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.batch-header {
|
||||
background: #eee;
|
||||
border: 2px solid #ddd;
|
||||
}
|
||||
|
||||
@@ -179,11 +179,8 @@ section.lightgray {
|
||||
.chapter-number {
|
||||
background: var(--text-color);
|
||||
color: white;
|
||||
border-radius: 50%;
|
||||
height: 24px;
|
||||
min-width: 24px;
|
||||
align-items: center;
|
||||
padding: 5px 8px 2px 8px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
@@ -288,9 +285,7 @@ section.lightgray {
|
||||
}
|
||||
|
||||
.lesson-teaser {
|
||||
font-weight: bold;
|
||||
color: black;
|
||||
padding-left: 20px;
|
||||
line-height: 35px;
|
||||
}
|
||||
|
||||
#hero h1 {
|
||||
|
||||
BIN
community/public/images/wallpaper.png
Normal file
BIN
community/public/images/wallpaper.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 922 B |
@@ -1,7 +1,4 @@
|
||||
{% 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" />
|
||||
@@ -11,48 +8,33 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{{ Sidebar(course, batch) }}
|
||||
|
||||
<div class="container">
|
||||
{{ CourseBasicDetail(course)}}
|
||||
{{ InstructorsSection(course.get_instructor()) }}
|
||||
{{ BatchDetails(batch)}}
|
||||
{{ widgets.BatchTabs(course=course, batch=batch) }}
|
||||
<div class="tab-content" id="about">
|
||||
{{ CourseBasicDetail(course)}}
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="col-lg-4 col-md-12">
|
||||
<div class="sidebar">
|
||||
{{ widgets.InstructorSection(instructor=course.get_instructor()) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% macro CourseBasicDetail(course) %}
|
||||
<h2>{{course.title}}</h2>
|
||||
<div class="course-description">
|
||||
{{course.short_introduction}}
|
||||
{{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>
|
||||
<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(batch) %}
|
||||
<h2>About the Batch</h2>
|
||||
|
||||
<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>
|
||||
|
||||
{% 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 %}
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
@@ -3,5 +3,3 @@ from . import utils
|
||||
|
||||
def get_context(context):
|
||||
utils.get_common_context(context)
|
||||
|
||||
print("context", context)
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
{% extends "templates/base.html" %}
|
||||
{% from "www/macros/sidebar.html" import Sidebar %}
|
||||
{% from "www/macros/common_macro.html" import BatchHearder %}
|
||||
|
||||
{% block title %}Discuss{% endblock %}
|
||||
{% block head_include %}
|
||||
@@ -11,16 +9,14 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{{ Sidebar(course, batch) }}
|
||||
|
||||
<div class="">
|
||||
<div class="batch-header">
|
||||
{{ BatchHearder(course.title, member_count) }}
|
||||
</div>
|
||||
<div class="messages">
|
||||
<div class="message-section">
|
||||
<div class="container">
|
||||
{{ widgets.BatchTabs(course=course, batch=batch) }}
|
||||
<div class="messages-container mt-5">
|
||||
{{ widgets.BatchHeader(batch_name=batch.title, member_count=member_count)}}
|
||||
<ol class="messages">
|
||||
{{ Messages(messages) }}
|
||||
</div>
|
||||
</ol>
|
||||
{{ TextArea() }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -28,25 +24,25 @@
|
||||
|
||||
{% macro Messages(messages) %}
|
||||
{% for message in messages %}
|
||||
<div class="discussion {% if message.is_author %} is-author {% 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">
|
||||
{{ frappe.utils.pretty_date(message.creation) }}
|
||||
</div>
|
||||
<small class="">
|
||||
{{ frappe.utils.format_datetime(message.creation, "dd-mm-yyyy HH:mm") }}
|
||||
</small>
|
||||
</div>
|
||||
<div class="mt-5">
|
||||
<div class="message-para">
|
||||
{{ message.message }}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro TextArea() %}
|
||||
<form class="msger-inputarea">
|
||||
<form class="msger-inputarea mb-1">
|
||||
<input type="text" class="msger-input" placeholder="Write your message...">
|
||||
<button type="submit" class="msger-send-btn" data-batch="{{batch.name | urlencode }}">Send</button>
|
||||
<button type="submit" class="btn btn-primary msger-send-btn" data-batch="{{batch.name | urlencode }}">Send</button>
|
||||
</form>
|
||||
{% endmacro %}
|
||||
|
||||
@@ -11,7 +11,9 @@ frappe.ready(() => {
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
window.scrollTo(0, document.body.scrollHeight);
|
||||
var message_element = document.getElementsByClassName("messages")[0]
|
||||
message_element.scrollTo(0, message_element.scrollHeight);
|
||||
document.getElementsByClassName("messages-container")[0].scrollIntoView({block: "center"})
|
||||
}, 300);
|
||||
|
||||
$(".msger-send-btn").click((e) => {
|
||||
|
||||
46
community/www/batch/home.html
Normal file
46
community/www/batch/home.html
Normal file
@@ -0,0 +1,46 @@
|
||||
{% extends "templates/base.html" %}
|
||||
{% block title %}Batch{% endblock %}
|
||||
{% block head_include %}
|
||||
<meta name="description" content="Courses" />
|
||||
<meta name="keywords" content="" />
|
||||
|
||||
<link rel="stylesheet" href="/assets/frappe/css/font-awesome.css">
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container mt-5">
|
||||
{{ widgets.BatchTabs(course=course, batch=batch) }}
|
||||
<h1 class="mt-5">{{ batch.title }}</h1>
|
||||
<div class="course-details">
|
||||
{{ widgets.CourseOutline(course=course, batch=batch, show_link=True) }}
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-12">
|
||||
<h2>Batch Schedule</h2>
|
||||
{{ BatchDetails(batch) }}
|
||||
</div>
|
||||
<h2>Batch Details</h2>
|
||||
{{ frappe.utils.md_to_html(batch.description) }}
|
||||
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% macro BatchDetails(batch) %}
|
||||
<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>
|
||||
|
||||
{% 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 %}
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
5
community/www/batch/home.py
Normal file
5
community/www/batch/home.py
Normal file
@@ -0,0 +1,5 @@
|
||||
import frappe
|
||||
from . import utils
|
||||
|
||||
def get_context(context):
|
||||
utils.get_common_context(context)
|
||||
@@ -1,17 +1,17 @@
|
||||
{% extends "templates/base.html" %}
|
||||
{% from "www/macros/sidebar.html" import Sidebar %}
|
||||
{% from "www/macros/livecode.html" import LiveCodeEditorJS, LiveCodeEditor with context %}
|
||||
{% block title %}{{ lesson.title }}{% endblock %}
|
||||
|
||||
{% block head_include %}
|
||||
<meta name="description" content="{{lesson.title}} - {{course.title}}" />
|
||||
<meta name="keywords" content="{{lesson.title}} - {{course.title}}" />
|
||||
<style>
|
||||
</style>
|
||||
<meta name="description" content="{{lesson.title}} - {{course.title}}" />
|
||||
<meta name="keywords" content="{{lesson.title}} - {{course.title}}" />
|
||||
<style>
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" href="/assets/frappe/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="{{ livecode_url }}/static/codemirror/lib/codemirror.css">
|
||||
<link rel="stylesheet" href="/assets/css/lms.css">
|
||||
<link rel="stylesheet" href="/assets/frappe/css/hljs-night-owl.css">
|
||||
|
||||
<script src="{{ livecode_url }}/static/codemirror/lib/codemirror.js"></script>
|
||||
<script src="{{ livecode_url }}/static/codemirror/mode/python/python.js"></script>
|
||||
@@ -23,11 +23,10 @@
|
||||
|
||||
|
||||
{% block content %}
|
||||
{{ Sidebar(course, batch) }}
|
||||
|
||||
<div class="container">
|
||||
{{ widgets.BatchTabs(course=course, batch=batch) }}
|
||||
<div class="lesson-page">
|
||||
{{ pagination(prev_url, next_url) }}
|
||||
|
||||
<h2>{{ lesson.title }}</h2>
|
||||
|
||||
@@ -37,52 +36,55 @@
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{{ pagination(prev_url, next_url) }}
|
||||
|
||||
{{ pagination(prev_chap, prev_url, next_chap, next_url) }}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% macro render_section(s) %}
|
||||
{% if s.type == "text" %}
|
||||
{{ render_section_text(s) }}
|
||||
{% elif s.type == "example" or s.type == "code" %}
|
||||
{{ LiveCodeEditor(s.name,
|
||||
{% if s.type == "text" %}
|
||||
{{ render_section_text(s) }}
|
||||
{% elif s.type == "example" or s.type == "code" %}
|
||||
{{ LiveCodeEditor(s.name,
|
||||
code=s.get_latest_code_for_user(),
|
||||
reset_code=s.contents,
|
||||
is_exercise=False)
|
||||
}}
|
||||
{% elif s.type == "exercise" %}
|
||||
{{ widgets.Exercise(exercise=s.get_exercise())}}
|
||||
{% else %}
|
||||
<div>Unknown section type: {{s.type}}</div>
|
||||
{% endif %}
|
||||
{% elif s.type == "exercise" %}
|
||||
{{ widgets.Exercise(exercise=s.get_exercise())}}
|
||||
{% else %}
|
||||
<div>Unknown section type: {{s.type}}</div>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro render_section_text(s) %}
|
||||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
{{ frappe.utils.md_to_html(s.contents) }}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
{{ frappe.utils.md_to_html(s.contents) }}
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro pagination(prev_url, next_url) %}
|
||||
<div class="lesson-pagination">
|
||||
{% if prev_url %}
|
||||
<a href="{{prev_url}}" class="btn">← Prev</a>
|
||||
{% endif %}
|
||||
{% if next_url %}
|
||||
<a href="{{next_url}}" class="btn pull-right">Next →</a>
|
||||
{% endif %}
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
{% macro pagination(prev_chap, prev_url, next_chap, next_url) %}
|
||||
<div class="lesson-pagination">
|
||||
{% if prev_url %}
|
||||
<span>
|
||||
Prev: <a href="{{prev_url}}">{{prev_chap}}</a>
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if next_url %}
|
||||
<span class="pull-right">
|
||||
Next: <a href="{{next_url}}">{{next_chap}}</a>
|
||||
</span>
|
||||
{% endif %}
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{%- block script %}
|
||||
{{ super() }}
|
||||
{{ LiveCodeEditorJS() }}
|
||||
{{ super() }}
|
||||
{{ LiveCodeEditorJS() }}
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from re import I
|
||||
import frappe
|
||||
from . import utils
|
||||
|
||||
@@ -9,11 +10,10 @@ def get_context(context):
|
||||
lesson_number = f"{chapter_index}.{lesson_index}"
|
||||
|
||||
course_name = context.course.name
|
||||
batch_name = context.batch.name
|
||||
|
||||
if not chapter_index or not lesson_index:
|
||||
index_ = get_lesson_index(context.course, context.batch, frappe.session.user) or "1.1"
|
||||
frappe.local.flags.redirect_location = get_learn_url(course_name, batch_name, index_)
|
||||
frappe.local.flags.redirect_location = context.batch.get_learn_url(index_)
|
||||
raise frappe.Redirect
|
||||
|
||||
context.lesson = context.course.get_lesson(chapter_index, lesson_index)
|
||||
@@ -21,15 +21,22 @@ def get_context(context):
|
||||
context.chapter_index = chapter_index
|
||||
|
||||
outline = context.course.get_outline()
|
||||
next_ = outline.get_next(lesson_number)
|
||||
prev_ = outline.get_prev(lesson_number)
|
||||
context.next_url = get_learn_url(course_name, batch_name, next_)
|
||||
context.prev_url = get_learn_url(course_name, batch_name, prev_)
|
||||
next_ = outline.get_next(lesson_number)
|
||||
context.prev_chap = get_chapter_title(course_name, prev_)
|
||||
context.next_chap = get_chapter_title(course_name, next_)
|
||||
context.next_url = context.batch.get_learn_url(next_)
|
||||
context.prev_url = context.batch.get_learn_url(prev_)
|
||||
|
||||
def get_learn_url(course_name, batch_name, lesson_number):
|
||||
|
||||
|
||||
def get_chapter_title(course_name, lesson_number):
|
||||
if not lesson_number:
|
||||
return
|
||||
return f"/courses/{course_name}/{batch_name}/learn/{lesson_number}"
|
||||
chapter_index = lesson_number.split(".")[0]
|
||||
lesson_index = lesson_number.split(".")[1]
|
||||
chapter_name = frappe.db.get_value("Chapter", {"course": course_name, "index_": chapter_index}, "name")
|
||||
return frappe.db.get_value("Lesson", {"chapter": chapter_name, "index_": lesson_index}, "title")
|
||||
|
||||
def get_lesson_index(course, batch, user):
|
||||
lesson = batch.get_current_lesson(user)
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
{% extends "templates/base.html" %}
|
||||
{% from "www/macros/sidebar.html" import Sidebar %}
|
||||
{% from "www/macros/common_macro.html" import BatchHearder %}
|
||||
|
||||
{% block title %}Members{% endblock %}
|
||||
{% block head_include %}
|
||||
@@ -10,10 +8,9 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{{ Sidebar(course, batch) }}
|
||||
|
||||
<div class="container">
|
||||
{{ BatchHearder(course.title, member_count)}}
|
||||
{{ widgets.BatchTabs(course=course, batch=batch) }}
|
||||
{{ MembersList(members)}}
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -22,18 +19,29 @@
|
||||
{% macro MembersList(members) %}
|
||||
<div class="mt-5">
|
||||
{% for member in members %}
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="row mb-5">
|
||||
<div>
|
||||
{{ widgets.Avatar(member=member, avatar_class="avatar-medium") }}
|
||||
{{ widgets.Avatar(member=member, avatar_class="avatar-large") }}
|
||||
</div>
|
||||
<div class="ml-5 mr-5">
|
||||
<a href="/{{member.username}}">{{ member.full_name }}</a>
|
||||
<div class="col">
|
||||
<div class="row ml-1">
|
||||
<a class="anchor_style" href="/{{member.username}}">
|
||||
<h3>{{ member.full_name }}</h3>
|
||||
</a>
|
||||
{% if course.is_mentor(member.name) %}
|
||||
<div class="ml-2">
|
||||
<div class="badge badge-success">Mentor</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if member.bio %}
|
||||
<i>{{member.bio}}</i>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if course.is_mentor(member.name) %}
|
||||
<div class="badge badge-success">Mentor</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if loop.index != member_count %}
|
||||
<hr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
@@ -3,3 +3,4 @@ from . import utils
|
||||
|
||||
def get_context(context):
|
||||
utils.get_common_context(context)
|
||||
print(context.members[0].bio)
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
{% extends "templates/base.html" %}
|
||||
{% from "www/macros/sidebar.html" import Sidebar %}
|
||||
{% from "www/macros/livecode.html" import LiveCodeEditorJS, LiveCodeEditor with context %}
|
||||
{% block title %}{{ course.title }} - Batch Dashboard{% endblock %}
|
||||
{% block title %}{{ course.title }} - Batch Dashboard{% endblock %}
|
||||
|
||||
{% block head_include %}
|
||||
<meta name="description" content="{{course.title}} - Batch Dashboard" />
|
||||
<meta name="keywords" content="{{course.title}} - Batch Dashboard" />
|
||||
<style>
|
||||
</style>
|
||||
<meta name="description" content="{{course.title}} - Batch Dashboard" />
|
||||
<meta name="keywords" content="{{course.title}} - Batch Dashboard" />
|
||||
<style>
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" href="/assets/frappe/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="{{ livecode_url }}/static/codemirror/lib/codemirror.css">
|
||||
@@ -23,23 +22,23 @@
|
||||
|
||||
|
||||
{% block content %}
|
||||
{{ Sidebar(course, batch) }}
|
||||
|
||||
<div class="container">
|
||||
{{ widgets.BatchTabs(course=course, batch=batch) }}
|
||||
<div class="mentor-dashboard">
|
||||
<h1>Batch Progress</h1>
|
||||
{% for exercise in report.exercises %}
|
||||
<div class="exercise-submissions">
|
||||
<h2>{{exercise.title}}</h2>
|
||||
{% for s in report.get_submissions_of_exercise(exercise.name) %}
|
||||
<div class="submission">
|
||||
<h4><a href="/{{s.owner.username}}">{{s.owner.full_name}}</a></h4>
|
||||
<div class="livecode-editor-small">
|
||||
{{ LiveCodeEditor(name=s.name, code=s.solution, reset_code=s.solution) }}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="exercise-submissions">
|
||||
<h2>{{exercise.title}}</h2>
|
||||
{% for s in report.get_submissions_of_exercise(exercise.name) %}
|
||||
<div class="submission">
|
||||
<h4><a href="/{{s.owner.username}}">{{s.owner.full_name}}</a></h4>
|
||||
<div class="livecode-editor-small">
|
||||
{{ LiveCodeEditor(name=s.name, code=s.solution, reset_code=s.solution) }}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
@@ -47,6 +46,6 @@
|
||||
|
||||
|
||||
{%- block script %}
|
||||
{{ super() }}
|
||||
{{ LiveCodeEditorJS() }}
|
||||
{{ super() }}
|
||||
{{ LiveCodeEditorJS() }}
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{% extends "templates/base.html" %}
|
||||
{% from "www/macros/sidebar.html" import Sidebar %}
|
||||
{% block title %}Schedule{% endblock %}
|
||||
|
||||
{% block head_include %}
|
||||
<meta name="description" content="Courses" />
|
||||
<meta name="keywords" content="" />
|
||||
@@ -8,7 +8,10 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{{ Sidebar(course, batch) }}
|
||||
<div class="container">
|
||||
{{ widgets.BatchTabs(course=course, batch=batch) }}
|
||||
<h3>
|
||||
Schedule
|
||||
</h3>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{% extends "templates/base.html" %}
|
||||
{% from "www/macros/common_macro.html" import InstructorsSection, MentorsSection %}
|
||||
{% from "www/macros/common_macro.html" import MentorsSection %}
|
||||
{% block title %}{{ course.title }}{% endblock %}
|
||||
{% block head_include %}
|
||||
<meta name="description" content="Courses" />
|
||||
@@ -9,24 +9,26 @@
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<div class="course-header">
|
||||
<div class="course-type">course</div>
|
||||
<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">
|
||||
<div class="course-details">
|
||||
{{ CourseVideo(course) }}
|
||||
|
||||
{{ CourseDescription(course) }}
|
||||
{{ BatchSection(course) }}
|
||||
{{ CourseOutline(course) }}
|
||||
{{ widgets.CourseOutline(course=course, show_link=False) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-12">
|
||||
<div class="sidebar">
|
||||
{{ InstructorsSection(course.get_instructor()) }}
|
||||
{{ widgets.InstructorSection(instructor=course.get_instructor()) }}
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
{{ MentorsSection(course.get_mentors(), course.is_mentor(frappe.session.user), course.name) }}
|
||||
@@ -37,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-secondary">Manage</a>
|
||||
<a href="/courses/{{course.name}}/{{batch.name}}/home" class="btn btn-primary">Manage</a>
|
||||
{% else %}
|
||||
<button class="join-batch" 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>
|
||||
@@ -97,46 +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="btn btn-primary 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="btn btn-primary" 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>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro CourseOutline(course) %}
|
||||
<h2>Course Outline</h2>
|
||||
|
||||
{% for chapter in course.get_chapters() %}
|
||||
{{ widgets.ChapterTeaser(index=loop.index, chapter=chapter)}}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
{% extends "templates/base.html" %}
|
||||
{% from "www/hackathons/macros/card.html" import null_card %}
|
||||
{% block title %}{{ 'Courses' }}{% endblock %}
|
||||
{% block head_include %}
|
||||
<meta name="description" content="{{ 'Courses' }}" />
|
||||
<meta name="keywords" content="Courses" />
|
||||
<style>
|
||||
</style>
|
||||
<meta name="description" content="{{ 'Courses' }}" />
|
||||
<meta name="keywords" content="Courses" />
|
||||
<style>
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
@@ -15,8 +16,13 @@
|
||||
<div class='container'>
|
||||
<div class="row mt-5">
|
||||
{% for course in courses %}
|
||||
{{ course_card(course) }}
|
||||
{{ course_card(course) }}
|
||||
{% endfor %}
|
||||
{% if courses %}
|
||||
{% for n in range( (3 - (courses|length)) %3) %}
|
||||
{{ null_card() }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -24,13 +30,18 @@
|
||||
|
||||
|
||||
{% macro course_card(course) %}
|
||||
<div class="card mb-5 w-100">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title"><a href="/courses/{{course.name}}">{{course.title}}</a></h5>
|
||||
{% if course.description %}
|
||||
<p class="card-text">{{ frappe.utils.md_to_html(course.description[:250]) }}</p>
|
||||
{% endif %}
|
||||
<a href="/courses/{{course.name}}" class="card-link">See more →</a>
|
||||
</div>
|
||||
<div class="col-sm-4 mb-4 text-left">
|
||||
<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 %}
|
||||
<div class="mt-4">
|
||||
{{ frappe.utils.md_to_html(course.description[:200]) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
@@ -126,4 +126,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
{% macro InstructorsSection(instructor) %}
|
||||
<h3>Instructor</h3>
|
||||
<div class="instructor">
|
||||
<div class="instructor-title">{{instructor.full_name}}</div>
|
||||
<div class="instructor-subtitle">Created {{instructor.get_course_count()}} courses</div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro MentorsSection(mentors, is_mentor, course_name) %}
|
||||
<h3>Mentors</h3>
|
||||
{% for m in mentors %}
|
||||
@@ -27,11 +19,3 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
{% macro BatchHearder(course_name, member_count) %}
|
||||
<div class="border p-3">
|
||||
<h3>{{course_name}}</h3>
|
||||
<div class="text-muted">{{member_count}} members</div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
{% macro Sidebar(course, batch, is_mentor=False) %}
|
||||
<div class="sidebar-batch">
|
||||
<a href=""><i class="fa fa-bars fa-lg"></i></a>
|
||||
<br>
|
||||
<a href="/courses/{{course.name}}/{{batch.name}}/learn"><i class="fa fa-book fa-lg"></i></a>
|
||||
<a href="/courses/{{course.name}}/{{batch.name}}/schedule"><i class="fa fa-calendar fa-lg"></i></a>
|
||||
<a href="/courses/{{course.name}}/{{batch.name}}/members"><i class="fa fa-users fa-lg"></i></a>
|
||||
<a href="/courses/{{course.name}}/{{batch.name}}/discuss"><i class="fa fa-comments fa-lg"></i></a>
|
||||
<a href="/courses/{{course.name}}/{{batch.name}}/about"><i class="fa fa-info-circle fa-lg"></i></a>
|
||||
{% if batch.is_member(frappe.session.user, member_type="Mentor") %}
|
||||
<a href="/courses/{{course.name}}/{{batch.name}}/progress"><i class="fa fa-flag-checkered fa-lg"></i></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
Reference in New Issue
Block a user