From 230fab3bb2a238dc25ad3f4740ec75dbb5e96ffa Mon Sep 17 00:00:00 2001 From: pateljannat Date: Tue, 13 Jul 2021 15:15:23 +0530 Subject: [PATCH] fix: responsive design --- .../lms/doctype/lms_course/lms_course.py | 2 + community/lms/md.py | 9 +- community/lms/widgets/MemberCard.html | 2 +- community/lms/widgets/Reviews.html | 8 +- community/plugins.py | 2 +- community/public/css/style.css | 293 +++++++++--------- community/www/courses/course.html | 24 +- community/www/courses/course.js | 2 +- community/www/courses/index.html | 2 +- 9 files changed, 167 insertions(+), 177 deletions(-) diff --git a/community/lms/doctype/lms_course/lms_course.py b/community/lms/doctype/lms_course/lms_course.py index ac93ac86..73b1d5e3 100644 --- a/community/lms/doctype/lms_course/lms_course.py +++ b/community/lms/doctype/lms_course/lms_course.py @@ -133,6 +133,8 @@ class LMSCourse(Document): "status": "Complete" }) precision = cint(frappe.db.get_default("float_precision")) or 3 + if not lesson_count: + return 0 return flt(((completed_lessons/lesson_count) * 100), precision) def get_batch(self, batch_name): diff --git a/community/lms/md.py b/community/lms/md.py index 0658ca82..73be75d9 100644 --- a/community/lms/md.py +++ b/community/lms/md.py @@ -93,11 +93,11 @@ class MacroInlineProcessor(InlineProcessor): macro = m.group(1) arg = m.group(2) html = render_macro(macro, arg) - html = sanitize_html(str(html)) + html = sanitize_html(str(html), macro) e = etree.fromstring(html) return e, m.start(0), m.end(0) -def sanitize_html(html): +def sanitize_html(html, macro): """Sanotize the html using BeautifulSoup. The markdown processor request the correct markup and crashes on @@ -106,4 +106,7 @@ def sanitize_html(html): """ soup = BeautifulSoup(html, features="lxml") nodes = soup.body.children - return "
" + "\n".join(str(node) for node in nodes) + "
" + classname = "" + if macro == "YouTubeVideo": + classname = "lesson-video" + return "
" + "\n".join(str(node) for node in nodes) + "
" diff --git a/community/lms/widgets/MemberCard.html b/community/lms/widgets/MemberCard.html index 72f8fee3..0ecc2d72 100644 --- a/community/lms/widgets/MemberCard.html +++ b/community/lms/widgets/MemberCard.html @@ -1,5 +1,5 @@
- {% set avatar_class = "avatar-large" if dimension_class == "member-card-medium" else "avatar-xl"%} + {% set avatar_class = "avatar-large" if not dimension_class else "avatar-xl"%} {{ widgets.Avatar(member=member, avatar_class=avatar_class) }}
{{ member.full_name }} diff --git a/community/lms/widgets/Reviews.html b/community/lms/widgets/Reviews.html index 0b365ef0..aa46d7c1 100644 --- a/community/lms/widgets/Reviews.html +++ b/community/lms/widgets/Reviews.html @@ -1,14 +1,14 @@ {% if course.get_reviews() | length %} -
+
-
Review
+
Student Review
{% if course.is_eligible_to_review(membership) %} Provide your Feedback {% endif %}
-
+
{% for review in course.get_reviews() %}
{{ review.review }}
@@ -77,7 +77,7 @@
diff --git a/community/plugins.py b/community/plugins.py index eb9b74fc..4c3066fb 100644 --- a/community/plugins.py +++ b/community/plugins.py @@ -98,7 +98,7 @@ def exercise_renderer(argument): def youtube_video_renderer(video_id): return f""" -