fix: course page created by administrator

This commit is contained in:
pateljannat
2021-04-21 12:58:17 +05:30
parent b09ec1e29d
commit 3405de9394
3 changed files with 13 additions and 2 deletions

View File

@@ -96,7 +96,7 @@
<button class="btn btn-dark btn-enroll float-right" data-course="{{ course.name }}">Enroll</button> <button class="btn btn-dark btn-enroll float-right" data-course="{{ course.name }}">Enroll</button>
{% endif %} --> {% endif %} -->
<h2 class="course-title" data-course={{ course.name | urlencode }}>{{ course.title }}</h2> <h2 class="course-title" data-course={{ course.name | urlencode }}>{{ course.title }}</h2>
{{course.short_introduction}} {% if course.short_introduction %} {{course.short_introduction}} {% endif %}
</div> </div>
{% if course.video_link %} {% if course.video_link %}
<div> <div>
@@ -192,10 +192,12 @@
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% if course.description %}
<div> <div>
<h4 class="margin-bottom mt-5">About the Course</h4> <h4 class="margin-bottom mt-5">About the Course</h4>
<div class="p-5"> {{frappe.utils.md_to_html(course.description)}} </div> <div class="p-5"> {{frappe.utils.md_to_html(course.description)}} </div>
</div> </div>
{% endif %}
<div class="margin-bottom"> <div class="margin-bottom">
<h4 class="margin-bottom">Instructor</h4> <h4 class="margin-bottom">Instructor</h4>
<div class="d-flex align-items-center"> <div class="d-flex align-items-center">
@@ -208,6 +210,7 @@
</div> </div>
</div> </div>
</div> </div>
{% if mentors %}
<div class="margin-bottom"> <div class="margin-bottom">
<h4 class="margin-bottom">Mentors</h4> <h4 class="margin-bottom">Mentors</h4>
<div class="d-flex"> <div class="d-flex">
@@ -229,6 +232,7 @@
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
{% endif %}
{% if not is_mentor %} {% if not is_mentor %}
<div class="pt-5 mentor-request"> <div class="pt-5 mentor-request">
Interested to mentor this course? <span class="apply-now" data-course={{course.name | urlencode}} Interested to mentor this course? <span class="apply-now" data-course={{course.name | urlencode}}

View File

@@ -65,7 +65,12 @@ def get_membership(batches):
return memberships return memberships
def get_instructor(owner): def get_instructor(owner):
instructor = frappe.get_doc("Community Member", {"email": owner}) instructor = frappe._dict()
try:
instructor = frappe.get_doc("Community Member", {"email": owner})
except frappe.DoesNotExistError:
instructor.full_name = owner
instructor.abbr = ("").join([ s[0] for s in owner.split() ])
instructor.course_count = len(frappe.get_all("LMS Course", {"owner": owner})) instructor.course_count = len(frappe.get_all("LMS Course", {"owner": owner}))
return instructor return instructor

View File

@@ -27,7 +27,9 @@
<div class="card mb-5 w-100"> <div class="card mb-5 w-100">
<div class="card-body"> <div class="card-body">
<h5 class="card-title"><a href="/courses/{{course.slug}}">{{course.title}}</a></h5> <h5 class="card-title"><a href="/courses/{{course.slug}}">{{course.title}}</a></h5>
{% if course.description %}
<p class="card-text">{{ frappe.utils.md_to_html(course.description[:250]) }}</p> <p class="card-text">{{ frappe.utils.md_to_html(course.description[:250]) }}</p>
{% endif %}
<a href="/courses/{{course.slug}}" class="card-link">See more &rarr;</a> <a href="/courses/{{course.slug}}" class="card-link">See more &rarr;</a>
</div> </div>
</div> </div>