From c3fac64280bf558fcbab9ece48aea6514904e2a9 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Mon, 21 Feb 2022 14:55:20 +0530 Subject: [PATCH 1/2] fix: translations and sidebar --- school/public/css/style.css | 8 ++++---- school/templates/quiz.html | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/school/public/css/style.css b/school/public/css/style.css index 8118bd51..e992eb61 100644 --- a/school/public/css/style.css +++ b/school/public/css/style.css @@ -466,10 +466,6 @@ input[type=checkbox] { align-items: center; } -.chapter-title[aria-expanded="true"] { - background: var(--gray-100); -} - .chapter-description { margin: 0.75rem 3rem 1rem; } @@ -1715,3 +1711,7 @@ pre { .reviews-parent .progress-bar { background-color: var(--gray-600); } + +.body-content { + +} diff --git a/school/templates/quiz.html b/school/templates/quiz.html index 640f0569..3c3dd490 100644 --- a/school/templates/quiz.html +++ b/school/templates/quiz.html @@ -11,9 +11,9 @@

{{ frappe.utils.md_to_html(question.question) }}

{% if question.multiple %} - Choose all answers that apply: + {{ _("Choose all answers that apply:") }} {% else %} - Choose 1 answer: + {{ _("Choose 1 answer:") }} {% endif %}
@@ -47,12 +47,12 @@ -
Try Again
+
{{ _("Try Again") }}

From 6c64181bf4061cecd1a71b02aa946116735b806f Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Tue, 22 Feb 2022 11:15:02 +0530 Subject: [PATCH 2/2] fix: overlay position when related courses --- school/lms/widgets/CourseOutline.html | 2 +- school/public/css/style.css | 33 +++++++++++++-------------- school/www/batch/learn.py | 1 - school/www/courses/course.html | 32 ++++++++++++++------------ school/www/courses/course.js | 30 ++++++++++++++++++++++++ 5 files changed, 64 insertions(+), 34 deletions(-) diff --git a/school/lms/widgets/CourseOutline.html b/school/lms/widgets/CourseOutline.html index 970de9ed..e4144d62 100644 --- a/school/lms/widgets/CourseOutline.html +++ b/school/lms/widgets/CourseOutline.html @@ -4,7 +4,7 @@ {{ _("Course Content") }} {% for chapter in get_chapters(course.name) %} -
+
diff --git a/school/www/courses/course.js b/school/www/courses/course.js index e5f8c8ab..80068c4a 100644 --- a/school/www/courses/course.js +++ b/school/www/courses/course.js @@ -41,6 +41,12 @@ frappe.ready(() => { create_certificate(e); }); + $(document).scroll(function() { + let timer; + clearTimeout(timer); + timer = setTimeout(() => { handle_overlay_display.apply(this, arguments); }, 500); + }); + }) var check_mentor_request = () => { @@ -226,3 +232,27 @@ const create_certificate = (e) => { } }) }; + + +const element_not_in_viewport = (el) => { + const rect = el.getBoundingClientRect(); + return rect.bottom < 0 || rect.right < 0 || rect.left > window.innerWidth || rect.top > window.innerHeight; +} + +const handle_overlay_display = () => { + const element = $(".related-courses").length && $(".related-courses")[0]; + if (element && element_not_in_viewport(element)) { + $(".course-overlay-card").css({ + "position": "fixed", + "top": "30%", + "bottom": "inherit" + }); + } + else if (element && !element_not_in_viewport(element)) { + $(".course-overlay-card").css({ + "position": "absolute", + "top": "inherit", + "bottom": "5%" + }); + } +}