feat: dashboard web templates

This commit is contained in:
Jannat Patel
2021-10-21 12:53:36 +05:30
parent 5ae5bab76b
commit bb62f626fd
10 changed files with 174 additions and 102 deletions

View File

@@ -0,0 +1,28 @@
{% set member = frappe.get_doc("User", frappe.session.user) %}
<div class="mt-10">
{% set enrolled = member.get_enrolled_courses().in_progress + member.get_enrolled_courses().completed %}
{% if enrolled | length %}
<div class="mt-8">
<div class="course-home-headings">
{{ _("Courses Enrolled") }}
</div>
<div class="cards-parent">
{% for course in enrolled %}
{{ widgets.CourseCard(course=course) }}
{% endfor %}
</div>
</div>
{% else %}
<div class="common-card-style thread-card">
<div class="w-25 text-center" style="margin: 0 auto;">
<span class="font-weight-bold"> No Enrolled Courses </span>
<div class="small">
You have not enrolled in any course yet.
</div>
<span class="button is-primary ml-auto mr-auto mt-3">
Explore Courses
</span>
</div>
</div>
{% endif %}
</div>

View File

@@ -0,0 +1,16 @@
{
"__unsaved": 1,
"creation": "2021-10-21 11:29:50.424865",
"docstatus": 0,
"doctype": "Web Template",
"fields": [],
"idx": 0,
"modified": "2021-10-21 12:02:23.837501",
"modified_by": "Administrator",
"module": "LMS",
"name": "Courses Enrolled",
"owner": "Administrator",
"standard": 1,
"template": "",
"type": "Section"
}

View File

@@ -0,0 +1,11 @@
{% set member = frappe.get_doc("User", frappe.session.user) %}
<div class="mt-10">
{% if member.get_mentored_courses() | length %}
<div class="course-home-headings"> {{ _("Courses Mentored") }} </div>
<div class="cards-parent">
{% for course in member.get_mentored_courses() %}
{{ widgets.CourseCard(course=course) }}
{% endfor %}
</div>
{% endif %}
</div>

View File

@@ -0,0 +1,16 @@
{
"__unsaved": 1,
"creation": "2021-10-21 11:32:57.411626",
"docstatus": 0,
"doctype": "Web Template",
"fields": [],
"idx": 0,
"modified": "2021-10-21 12:01:56.270656",
"modified_by": "Administrator",
"module": "LMS",
"name": "Courses Mentored",
"owner": "Administrator",
"standard": 1,
"template": "",
"type": "Section"
}

View File

@@ -2,26 +2,28 @@
{% set progress = frappe.utils.cint(membership.progress) %} {% set progress = frappe.utils.cint(membership.progress) %}
<div class="common-card-style course-card"> <div class="common-card-style course-card">
<div class="course-image {% if not course.image %}default-image{% endif %}" <div class="course-image {% if not course.image %}default-image{% endif %}" {% if course.image %}
{% if course.image %} style="background-image: url( {{ course.image }} );" {% endif %}> style="background-image: url( {{ course.image }} );" {% endif %}>
<div class="course-tags"> <div class="course-tags">
{% for tag in course.get_tags() %} {% for tag in course.get_tags() %}
<div class="course-card-pills">{{ tag }}</div> <div class="course-card-pills">{{ tag }}</div>
{% endfor %} {% endfor %}
{% if membership and not read_only %} {% if membership and not read_only %}
{% if progress < 100 %} {% if progress < 100 %}  <div class="course-card-pills dark-pills ml-auto">{{ frappe.utils.rounded(progress) }}%
 <div class="course-card-pills dark-pills ml-auto">{{ frappe.utils.rounded(progress) }}% {{ _("Completed") }}</div> {{ _("Completed") }}
</div>
{% else %} {% else %}
<div class="course-card-pills dark-pills ml-auto"> <img src="/assets/community/icons/check.svg"> {{ _("Completed") }}</div> <div class="course-card-pills dark-pills ml-auto"> <img src="/assets/community/icons/check.svg"> {{ _("Completed")
}}</div>
{% endif %} {% endif %}
{% endif %} {% endif %}
</div> </div>
{% if not course.image %} {% if not course.image %}
<div class="default-image-text">{{ course.title[0] }}</div> <div class="default-image-text">{{ course.title[0] }}</div>
{% endif %} {% endif %}
</div> </div>
<div class="course-card-content"> <div class="course-card-content">
<div class="course-card-meta muted-text"> <div class="course-card-meta muted-text">
{% if course.get_chapters() | length %} {% if course.get_chapters() | length %}
<span> <span>
@@ -110,7 +112,7 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
</div> </div>
</div> </div>
<script> <script>

View File

@@ -123,7 +123,8 @@ class CustomUser(User):
for map in mapping: for map in mapping:
if frappe.db.get_value("LMS Course", map.course, "is_published"): if frappe.db.get_value("LMS Course", map.course, "is_published"):
mentored_courses.append(map) course = frappe.get_doc("LMS Course", map.course)
mentored_courses.append(course)
return mentored_courses return mentored_courses

View File

@@ -739,7 +739,6 @@ input[type=checkbox] {
letter-spacing: -0.0175em; letter-spacing: -0.0175em;
color: #192734; color: #192734;
margin-bottom: 1rem; margin-bottom: 1rem;
padding: 0 1rem;
} }
.course-detail-headings { .course-detail-headings {

View File

@@ -130,9 +130,8 @@
Courses Mentored Courses Mentored
</div> </div>
<div class="cards-parent"> <div class="cards-parent">
{% for mentorship in member.get_mentored_courses() %} {% for course in member.get_mentored_courses() %}
{% set course_details = frappe.get_doc("LMS Course", mentorship.course) %} {{ widgets.CourseCard(course=course, read_only=read_only) }}
{{ widgets.CourseCard(course=course_details, read_only=read_only) }}
{% endfor %} {% endfor %}
</div> </div>
</div> </div>