fix: overlay position when related courses
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
{{ _("Course Content") }}
|
{{ _("Course Content") }}
|
||||||
</div>
|
</div>
|
||||||
{% for chapter in get_chapters(course.name) %}
|
{% for chapter in get_chapters(course.name) %}
|
||||||
<div class="mb-2">
|
<div class="">
|
||||||
<div class="chapter-title" data-target="#{{ get_slugified_chapter_title(chapter.title) }}"
|
<div class="chapter-title" data-target="#{{ get_slugified_chapter_title(chapter.title) }}"
|
||||||
data-toggle="collapse" aria-expanded="false">
|
data-toggle="collapse" aria-expanded="false">
|
||||||
<img class="chapter-icon" src="/assets/school/icons/chevron-right.svg">
|
<img class="chapter-icon" src="/assets/school/icons/chevron-right.svg">
|
||||||
|
|||||||
@@ -475,7 +475,7 @@ input[type=checkbox] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.chapter-icon {
|
.chapter-icon {
|
||||||
margin: 0 1.25rem;
|
margin-right: 1.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.course-outline-instructor-parent {
|
.course-outline-instructor-parent {
|
||||||
@@ -539,14 +539,12 @@ input[type=checkbox] {
|
|||||||
|
|
||||||
.lesson-info {
|
.lesson-info {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
line-height: 250%;
|
|
||||||
letter-spacing: -0.011em;
|
letter-spacing: -0.011em;
|
||||||
margin-top: 0.5rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.lesson-links {
|
.lesson-links {
|
||||||
display: flex;
|
display: flex;
|
||||||
padding: 0 1rem;
|
padding: 0.75rem 1rem;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -557,16 +555,14 @@ input[type=checkbox] {
|
|||||||
border-radius: var(--border-radius-md);
|
border-radius: var(--border-radius-md);
|
||||||
}
|
}
|
||||||
|
|
||||||
.course-content-parent .lesson-links {
|
.course-content-parent .chapter-title {
|
||||||
padding: 0.5rem 1rem;
|
font-size: var(--text-md);
|
||||||
margin-bottom: 0.75rem;
|
|
||||||
font-size: 0.85rem;
|
|
||||||
line-height: 200%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.chapter-content {
|
.course-content-parent .lesson-links {
|
||||||
margin: 0;
|
padding: 0.5rem 1rem;
|
||||||
margin-left: .875rem;
|
font-size: var(--text-md);
|
||||||
|
line-height: 200%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.course-outline {
|
.course-outline {
|
||||||
@@ -575,7 +571,7 @@ input[type=checkbox] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.lessons {
|
.lessons {
|
||||||
margin-left: 2rem;
|
margin-left: 2.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.course-buttons {
|
.course-buttons {
|
||||||
@@ -1376,6 +1372,8 @@ pre {
|
|||||||
.related-courses {
|
.related-courses {
|
||||||
background: var(--gray-50);
|
background: var(--gray-50);
|
||||||
padding: 5rem 0;
|
padding: 5rem 0;
|
||||||
|
position: relative;
|
||||||
|
z-index: 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.carousel-indicators {
|
.carousel-indicators {
|
||||||
@@ -1570,10 +1568,11 @@ pre {
|
|||||||
box-shadow: var(--shadow-sm);
|
box-shadow: var(--shadow-sm);
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
position: absolute;
|
position: fixed;
|
||||||
top: 40%;
|
top: 40%;
|
||||||
right: 7%;
|
right: 7%;
|
||||||
max-width: 400px;
|
max-width: 400px;
|
||||||
|
z-index: 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
@@ -1627,8 +1626,8 @@ pre {
|
|||||||
.overlay-student-count {
|
.overlay-student-count {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
|
||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1.5rem;
|
||||||
|
margin-top: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.course-creators-card {
|
.course-creators-card {
|
||||||
@@ -1712,6 +1711,6 @@ pre {
|
|||||||
background-color: var(--gray-600);
|
background-color: var(--gray-600);
|
||||||
}
|
}
|
||||||
|
|
||||||
.body-content {
|
.course-home-top-container {
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ def get_context(context):
|
|||||||
"lesson": context.lesson.name,
|
"lesson": context.lesson.name,
|
||||||
"is_member": context.membership is not None
|
"is_member": context.membership is not None
|
||||||
}
|
}
|
||||||
print(context)
|
|
||||||
|
|
||||||
def get_current_lesson_details(lesson_number, context):
|
def get_current_lesson_details(lesson_number, context):
|
||||||
details_list = list(filter(lambda x: cstr(x.number) == lesson_number, context.lessons))
|
details_list = list(filter(lambda x: cstr(x.number) == lesson_number, context.lessons))
|
||||||
|
|||||||
@@ -6,13 +6,15 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="common-page-style pt-0">
|
<div class="common-page-style pt-0">
|
||||||
{{ CourseHomeHeader(course) }}
|
<div class="course-home-top-container">
|
||||||
<div class="container course-home-page">
|
{{ CourseHomeHeader(course) }}
|
||||||
<div class="course-body-container">
|
{{ CourseHeaderOverlay(course) }}
|
||||||
{{ Description(course) }}
|
<div class="container course-home-page">
|
||||||
{{ widgets.CourseOutline(course=course, membership=membership) }}
|
<div class="course-body-container">
|
||||||
{{ CourseCreator(course) }}
|
{{ Description(course) }}
|
||||||
{{ widgets.Reviews(course=course, membership=membership) }}
|
{{ widgets.CourseOutline(course=course, membership=membership) }}
|
||||||
|
{{ widgets.Reviews(course=course, membership=membership) }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{ RelatedCourses(course) }}
|
{{ RelatedCourses(course) }}
|
||||||
@@ -26,7 +28,6 @@
|
|||||||
<div class="container pt-10 pb-10">
|
<div class="container pt-10 pb-10">
|
||||||
{{ BreadCrumb(course) }}
|
{{ BreadCrumb(course) }}
|
||||||
{{ CourseCardWide(course) }}
|
{{ CourseCardWide(course) }}
|
||||||
{{ CourseHeaderOverlay(course) }}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -125,6 +126,14 @@
|
|||||||
You have opted to be notified for this course. You will receive an email when the course becomes available.
|
You have opted to be notified for this course. You will receive an email when the course becomes available.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="course-home-headings"> {{ course.title }} </div>
|
||||||
|
{% if get_lessons(course.name) | length %}
|
||||||
|
<div class="mt-3">
|
||||||
|
<img class="mr-3" src="/assets/school/icons/book.svg">
|
||||||
|
{{ get_lessons(course.name) | length }} {{ _("Lessons") }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if get_students(course.name) | length %}
|
{% if get_students(course.name) | length %}
|
||||||
{% set initial_members = get_initial_members(course.name) %}
|
{% set initial_members = get_initial_members(course.name) %}
|
||||||
<div class="overlay-student-count">
|
<div class="overlay-student-count">
|
||||||
@@ -188,13 +197,6 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="overlay-heading"> {{ _("Course Include:") }} </div>
|
|
||||||
{% if get_lessons(course.name) | length %}
|
|
||||||
<div class="mt-3">
|
|
||||||
<img class="mr-3" src="/assets/school/icons/book.svg">
|
|
||||||
{{ get_lessons(course.name) | length }} {{ _("Lessons") }}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -41,6 +41,12 @@ frappe.ready(() => {
|
|||||||
create_certificate(e);
|
create_certificate(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).scroll(function() {
|
||||||
|
let timer;
|
||||||
|
clearTimeout(timer);
|
||||||
|
timer = setTimeout(() => { handle_overlay_display.apply(this, arguments); }, 500);
|
||||||
|
});
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
var check_mentor_request = () => {
|
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%"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user