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) %} -
+
- - {% set options = [question.option_1, question.option_2, question.option_3, question.option_4] %} {% for option in options %} {% if option %} @@ -46,11 +44,11 @@

diff --git a/school/www/batch/learn.py b/school/www/batch/learn.py index 29f27ebd..4c47ba53 100644 --- a/school/www/batch/learn.py +++ b/school/www/batch/learn.py @@ -37,7 +37,6 @@ def get_context(context): "lesson": context.lesson.name, "is_member": context.membership is not None } - print(context) def get_current_lesson_details(lesson_number, context): details_list = list(filter(lambda x: cstr(x.number) == lesson_number, context.lessons)) diff --git a/school/www/courses/course.html b/school/www/courses/course.html index 6412e64a..ee6a2d21 100644 --- a/school/www/courses/course.html +++ b/school/www/courses/course.html @@ -6,13 +6,15 @@ {% endblock %} {% block content %}
- {{ CourseHomeHeader(course) }} -
-
- {{ Description(course) }} - {{ widgets.CourseOutline(course=course, membership=membership) }} - {{ CourseCreator(course) }} - {{ widgets.Reviews(course=course, membership=membership) }} +
+ {{ CourseHomeHeader(course) }} + {{ CourseHeaderOverlay(course) }} +
+
+ {{ Description(course) }} + {{ widgets.CourseOutline(course=course, membership=membership) }} + {{ widgets.Reviews(course=course, membership=membership) }} +
{{ RelatedCourses(course) }} @@ -26,7 +28,6 @@
{{ BreadCrumb(course) }} {{ CourseCardWide(course) }} - {{ CourseHeaderOverlay(course) }}
@@ -125,6 +126,14 @@ You have opted to be notified for this course. You will receive an email when the course becomes available.
+
{{ course.title }}
+ {% if get_lessons(course.name) | length %} +
+ + {{ get_lessons(course.name) | length }} {{ _("Lessons") }} +
+ {% endif %} + {% if get_students(course.name) | length %} {% set initial_members = get_initial_members(course.name) %}
@@ -188,13 +197,6 @@
{% endif %} -
{{ _("Course Include:") }}
- {% if get_lessons(course.name) | length %} -
- - {{ get_lessons(course.name) | length }} {{ _("Lessons") }} -
- {% endif %}
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%" + }); + } +}