Compare commits

..

3 Commits

Author SHA1 Message Date
pateljannat
37820c1e19 Merge branch 'redesign' of https://github.com/frappe/community into redesign 2021-07-13 15:15:29 +05:30
pateljannat
230fab3bb2 fix: responsive design 2021-07-13 15:15:23 +05:30
Jannat Patel
d292d2d093 Merge pull request #149 from fossunited/disable-exercises-for-non-members
feat: include membership info in page context
2021-07-12 10:59:28 +05:30
9 changed files with 167 additions and 177 deletions

View File

@@ -133,6 +133,8 @@ class LMSCourse(Document):
"status": "Complete" "status": "Complete"
}) })
precision = cint(frappe.db.get_default("float_precision")) or 3 precision = cint(frappe.db.get_default("float_precision")) or 3
if not lesson_count:
return 0
return flt(((completed_lessons/lesson_count) * 100), precision) return flt(((completed_lessons/lesson_count) * 100), precision)
def get_batch(self, batch_name): def get_batch(self, batch_name):

View File

@@ -93,11 +93,11 @@ class MacroInlineProcessor(InlineProcessor):
macro = m.group(1) macro = m.group(1)
arg = m.group(2) arg = m.group(2)
html = render_macro(macro, arg) html = render_macro(macro, arg)
html = sanitize_html(str(html)) html = sanitize_html(str(html), macro)
e = etree.fromstring(html) e = etree.fromstring(html)
return e, m.start(0), m.end(0) return e, m.start(0), m.end(0)
def sanitize_html(html): def sanitize_html(html, macro):
"""Sanotize the html using BeautifulSoup. """Sanotize the html using BeautifulSoup.
The markdown processor request the correct markup and crashes on The markdown processor request the correct markup and crashes on
@@ -106,4 +106,7 @@ def sanitize_html(html):
""" """
soup = BeautifulSoup(html, features="lxml") soup = BeautifulSoup(html, features="lxml")
nodes = soup.body.children nodes = soup.body.children
return "<div>" + "\n".join(str(node) for node in nodes) + "</div>" classname = ""
if macro == "YouTubeVideo":
classname = "lesson-video"
return "<div class='" + classname + "'>" + "\n".join(str(node) for node in nodes) + "</div>"

View File

@@ -1,5 +1,5 @@
<div class="common-card-style member-card {{dimension_class}} "> <div class="common-card-style member-card {{dimension_class}} ">
{% 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) }} {{ widgets.Avatar(member=member, avatar_class=avatar_class) }}
<div class="small-title member-card-title"> <div class="small-title member-card-title">
{{ member.full_name }} {{ member.full_name }}

View File

@@ -1,14 +1,14 @@
{% if course.get_reviews() | length %} {% if course.get_reviews() | length %}
<div class="reviews-parent"> <div class="reviews-parent col">
<div class="reviews-heading"> <div class="reviews-heading">
<div class="course-home-headings">Review</div> <div class="course-home-headings">Student Review</div>
{% if course.is_eligible_to_review(membership) %} {% if course.is_eligible_to_review(membership) %}
<a class="review-link" href=""> <a class="review-link" href="">
Provide your Feedback Provide your Feedback
</a> </a>
{% endif %} {% endif %}
</div> </div>
<div class="mentors-section"> <div class="reviews-section">
{% for review in course.get_reviews() %} {% for review in course.get_reviews() %}
<div class="review-card"> <div class="review-card">
<div class="common-card-style review-content small-title"> {{ review.review }} </div> <div class="common-card-style review-content small-title"> {{ review.review }} </div>
@@ -77,7 +77,7 @@
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<div class="button wide-button submit-review is-primary" data-course="{{ course.name | urlencode}}" id="submit-review">Submit</div> <div class="button submit-review is-primary" data-course="{{ course.name | urlencode}}" id="submit-review">Submit</div>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -98,7 +98,7 @@ def exercise_renderer(argument):
def youtube_video_renderer(video_id): def youtube_video_renderer(video_id):
return f""" return f"""
<iframe width="560" height="315" <iframe width="100%" height="315"
src="https://www.youtube.com/embed/{video_id}" src="https://www.youtube.com/embed/{video_id}"
title="YouTube video player" title="YouTube video player"
frameborder="0" frameborder="0"

View File

@@ -226,24 +226,12 @@ input[type=checkbox] {
.course-image { .course-image {
height: 168px; height: 168px;
width: 352px; width: 100%;
border-top-left-radius: 8px; border-top-left-radius: 8px;
border-top-right-radius: 8px; border-top-right-radius: 8px;
background-size: 352px 168px; background-size: cover;
} background-position: center;
background-repeat: no-repeat;
@media (max-width: 768px) {
.course-image {
width: 336px;
}
}
@media (max-width: 375px) {
.course-image {
width: 312px;
background-size: cover;
background-repeat: no-repeat;
}
} }
.course-tags { .course-tags {
@@ -285,23 +273,7 @@ input[type=checkbox] {
.course-card { .course-card {
flex-direction: column; flex-direction: column;
width: 352px;
height: 380px; height: 380px;
margin: 0px 20px 32px 0px;
}
@media (max-width: 768px) {
.course-card {
margin: 0px 8px 32px 0px;
width: 336px;
}
}
@media (max-width: 375px) {
.course-card {
margin: 0px 0px 32px;
width: 312px;
}
} }
.muted-text { .muted-text {
@@ -371,13 +343,29 @@ input[type=checkbox] {
} }
.cards-parent { .cards-parent {
display: flex; display: grid;
flex-wrap: wrap; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
-moz-column-gap: 32px;
column-gap: 32px;
row-gap: 32px;
align-items: center;
}
@media (max-width: 767px) {
.cards-parent {
grid-template-columns: repeat(auto-fill, minmax(300px, 336px));
-moz-column-gap: 16px;
column-gap: 16px;
row-gap: 16px;
}
} }
@media (max-width: 375px) { @media (max-width: 375px) {
.cards-parent { .cards-parent {
justify-content: center; grid-template-columns: repeat(auto-fill, minmax(100%, 312px));
-moz-column-gap: 24px;
column-gap: 24px;
row-gap: 24px;
} }
} }
@@ -391,18 +379,21 @@ input[type=checkbox] {
} }
.course-top-section { .course-top-section {
margin: 0px 120px 0px; float: none;
margin: 0 auto;
max-width: 1150px;
padding-bottom: 2rem;
} }
@media (max-width: 768px) { @media (max-width: 768px) {
.course-top-section { .course-top-section {
margin: 0px 30px 0px; max-width: 720px;
} }
} }
@media (max-width: 375px) { @media (max-width: 600px) {
.course-top-section { .course-top-section {
margin: 0px 24px 0px; max-width: 342px;
} }
} }
@@ -421,30 +412,44 @@ input[type=checkbox] {
margin-left: 10px; margin-left: 10px;
} }
.reviews-section {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
-moz-column-gap: 32px;
column-gap: 32px;
row-gap: 32px;
}
@media (max-width: 768px) {
.reviews-section {
-moz-column-gap: 16px;
column-gap: 16px;
row-gap: 16px;
}
}
@media (max-width: 600px) {
.reviews-section {
grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
}
}
.reviews-heading { .reviews-heading {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
@media (max-width: 375px) {
.reviews-heading {
flex-direction: column;
margin-bottom: 1rem;
}
}
.review-card { .review-card {
width: 352px;
margin: 0px 20px 32px 0px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; height: 100%;
}
@media (max-width: 768px) {
.review-card {
width: 336px;
margin: 0px 8px 32px 0px;
}
}
@media (max-width: 375px) {
.review-card {
width: 312px;
}
} }
.review-card-footer { .review-card-footer {
@@ -486,7 +491,7 @@ div.custom-checkbox>label>input:checked+img {
} }
.course-card-wide { .course-card-wide {
height: 248px; height: fit-content;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
padding: 24px; padding: 24px;
@@ -497,14 +502,12 @@ div.custom-checkbox>label>input:checked+img {
@media (max-width: 768px) { @media (max-width: 768px) {
.course-card-wide { .course-card-wide {
height: 535px;
flex-direction: column; flex-direction: column;
} }
} }
@media (max-width: 375px) { @media (max-width: 600px) {
.course-card-wide { .course-card-wide {
height: 572px;
padding: 40px 24px 40px; padding: 40px 24px 40px;
border-radius: 0px; border-radius: 0px;
align-items: center; align-items: center;
@@ -512,55 +515,69 @@ div.custom-checkbox>label>input:checked+img {
} }
.course-image-wide { .course-image-wide {
width: 100%; width: 352px;
height: 200px; height: 200px;
background-size: 352px 200px; background-size: cover;
background-position: center;
background-repeat: no-repeat;
margin-right: 32px; margin-right: 32px;
border-radius: 5px; border-radius: 5px;
flex: 1;
} }
@media (max-width: 768px) { @media (max-width: 768px) {
.course-image-wide { .course-image-wide {
width: 640px; width: 100%;
height: 320px; height: 320px;
flex-direction: column; flex-direction: column;
background-size: 640px 320px;
margin: 0px; margin: 0px;
flex: none;
} }
} }
@media (max-width: 375px) { @media (max-width: 600px) {
.course-image-wide { .course-image-wide {
width: 312px;
height: 216px; height: 216px;
background-size: 312px 216px;
} }
} }
.course-home-page { .course-home-page {
padding: 0px 0px 80px; max-width: 1150px;
display: flex;
flex-direction: column;
max-width: 1120px;
margin: 0 auto; margin: 0 auto;
padding-bottom: 2rem;
} }
@media (max-width: 768px) { @media (max-width: 768px) {
.course-home-page { .course-home-page {
padding: 0px 0px 30px;
max-width: 688px; max-width: 688px;
} }
} }
@media (max-width: 375px) { @media (max-width: 600px) {
.course-home-page { .course-home-page {
width: 100%; width: 100%;
padding-left: 0px;
padding-right: 0px;
} }
} }
.course-card-wide-content { .course-card-wide-content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
flex: 2;
}
@media (max-width: 768px) {
.course-card-wide-content {
width: 100%;
}
}
@media (max-width: 600px) {
.course-card-wide-content {
width: 90%;
align-items: center;
}
} }
.course-card-wide-title { .course-card-wide-title {
@@ -574,15 +591,13 @@ div.custom-checkbox>label>input:checked+img {
@media (max-width: 768px) { @media (max-width: 768px) {
.course-card-wide-title { .course-card-wide-title {
width: 632px;
margin-top: 24px; margin-top: 24px;
font-size: 36px; font-size: 36px;
} }
} }
@media (max-width: 375px) { @media (max-width: 600px) {
.course-card-wide-title { .course-card-wide-title {
width: 264px;
margin-top: 16px; margin-top: 16px;
font-size: 28px; font-size: 28px;
} }
@@ -592,21 +607,9 @@ div.custom-checkbox>label>input:checked+img {
font-size: 16px; font-size: 16px;
line-height: 172%; line-height: 172%;
letter-spacing: -0.011em; letter-spacing: -0.011em;
width: 688px;
height: 80px;
margin-bottom: 16px; margin-bottom: 16px;
} display: flex;
flex-wrap: wrap;
@media (max-width: 768px) {
.course-card-wide-intro {
width: 632px;
}
}
@media (max-width: 375px) {
.course-card-wide-intro {
width: 264px;
}
} }
.button { .button {
@@ -631,7 +634,7 @@ div.custom-checkbox>label>input:checked+img {
line-height: 150%; line-height: 150%;
} }
@media (max-width: 375px) { @media (max-width: 600px) {
.wide-button { .wide-button {
width: 264px; width: 264px;
} }
@@ -646,7 +649,7 @@ div.custom-checkbox>label>input:checked+img {
color: inherit; color: inherit;
} }
@media (max-width: 375px) { @media (max-width: 600px) {
.video-preview { .video-preview {
margin-top: 16px; margin-top: 16px;
} }
@@ -663,22 +666,9 @@ div.custom-checkbox>label>input:checked+img {
} }
.course-home-outline { .course-home-outline {
width: 832px;
margin-top: 3rem; margin-top: 3rem;
} }
@media (max-width: 768px) {
.course-home-outline {
width: 424px;
}
}
@media (max-width: 375px) {
.course-home-outline {
width: 312px;
}
}
.small-title { .small-title {
letter-spacing: -0.011em; letter-spacing: -0.011em;
} }
@@ -705,10 +695,10 @@ div.custom-checkbox>label>input:checked+img {
justify-content: space-between; justify-content: space-between;
} }
@media (max-width: 375px) { @media (max-width: 600px) {
.course-outline-instructor-parent { .course-outline-instructor-parent {
flex-direction: column; flex-direction: column;
padding: 0px 24px 0px; padding: 0px 9px 0px;
} }
} }
@@ -716,7 +706,7 @@ div.custom-checkbox>label>input:checked+img {
margin-top: 3rem; margin-top: 3rem;
} }
@media (max-width: 375px) { @media (max-width: 600px) {
.course-home-mentors { .course-home-mentors {
padding: 0px 24px 0px; padding: 0px 24px 0px;
} }
@@ -726,7 +716,7 @@ div.custom-checkbox>label>input:checked+img {
margin-top: 3rem; margin-top: 3rem;
} }
@media (max-width: 375px) { @media (max-width: 600px) {
.reviews-parent { .reviews-parent {
padding: 0px 24px 0px; padding: 0px 24px 0px;
} }
@@ -780,7 +770,7 @@ div.custom-checkbox>label>input:checked+img {
display: flex; display: flex;
} }
@media (max-width: 375px) { @media (max-width: 600px) {
.course-buttons { .course-buttons {
flex-direction: column; flex-direction: column;
} }
@@ -804,9 +794,9 @@ div.custom-checkbox>label>input:checked+img {
} }
} }
@media (max-width: 375px) { @media (max-width: 600px) {
.member-card-large { .member-card-large {
width: 312px; width: 100%;
} }
} }
@@ -879,22 +869,9 @@ div.custom-checkbox>label>input:checked+img {
.description-card { .description-card {
padding: 24px; padding: 24px;
width: 832px;
flex-direction: column; flex-direction: column;
} }
@media (max-width: 768px) {
.description-card {
width: 424px;
}
}
@media (max-width: 375px) {
.description-card {
width: 312px;
}
}
.overview-card { .overview-card {
padding: 8px 24px 8px; padding: 8px 24px 8px;
width: 256px; width: 256px;
@@ -907,15 +884,28 @@ div.custom-checkbox>label>input:checked+img {
} }
} }
@media (max-width: 375px) { @media (max-width: 600px) {
.overview-card { .overview-card {
width: 312px; padding: 8px 9px 8px;
width: 100%;
} }
} }
.mentors-section { .mentors-section {
display: flex; display: grid;
flex-wrap: wrap; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
-moz-column-gap: 32px;
column-gap: 32px;
row-gap: 32px;
}
@media (max-width: 600px) {
.mentors-section {
grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
-moz-column-gap: 24px;
column-gap: 24px;
row-gap: 24px;
}
} }
.overtime-item { .overtime-item {
@@ -958,6 +948,12 @@ div.custom-checkbox>label>input:checked+img {
height: 70%; height: 70%;
} }
@media (max-width: 600px) {
.review-modl .modal-dialog {
width: auto;
}
}
.error-field { .error-field {
color: red; color: red;
} }
@@ -975,7 +971,7 @@ div.custom-checkbox>label>input:checked+img {
} }
.breadcrumb { .breadcrumb {
margin: 1rem 0.5rem 0; padding: 1rem 0.5rem 0;
display: flex; display: flex;
align-items: center; align-items: center;
} }
@@ -985,15 +981,9 @@ div.custom-checkbox>label>input:checked+img {
margin-top: 16px; margin-top: 16px;
} }
@media (max-width: 768px) { @media (max-width: 1025px) {
.course-details-outline { .course-details-outline {
width: 688px; width: 100%;
}
}
@media (max-width: 375px) {
.course-details-outline {
width: 312px;
} }
} }
@@ -1029,26 +1019,31 @@ div.custom-checkbox>label>input:checked+img {
margin-top: 16px; margin-top: 16px;
} }
@media (max-width: 768px) { @media (max-width: 1025px) {
.lesson-pagination-parent { .lesson-pagination-parent {
width: 690px; width: 100%;
} }
} }
@media (max-width: 375px) { .lesson-video {
.lesson-pagination-parent { width: 100%;
width: 312px;
}
} }
.course-details-page { .course-details-page {
padding: 0px 0px 80px; padding: 0px 0px 80px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 1120px; max-width: 1120px;
margin: 0 auto; margin: 0 auto;
} }
@media (max-width: 1025px) {
.course-details-page {
padding: 24px 0px 24px;
width: 80%;
}
}
@media (max-width: 768px) { @media (max-width: 768px) {
.course-details-page { .course-details-page {
padding: 24px 0px 24px; padding: 24px 0px 24px;
@@ -1056,12 +1051,6 @@ div.custom-checkbox>label>input:checked+img {
} }
} }
@media (max-width: 375px) {
.course-details-page {
width: 100%;
}
}
.active-lesson { .active-lesson {
background-color: #EBF5FF; background-color: #EBF5FF;
border-radius: 4px; border-radius: 4px;
@@ -1096,10 +1085,6 @@ div.custom-checkbox>label>input:checked+img {
} }
} }
.no-preview {
display: flex;
}
.progress-text { .progress-text {
font-size: 12px; font-size: 12px;
line-height: 165%; line-height: 165%;

View File

@@ -9,7 +9,7 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div class="common-page-style"> <div class="common-page-style">
<div class="course-home-page"> <div class="col course-home-page">
{{ widgets.BreadCrumb(course=course) }} {{ widgets.BreadCrumb(course=course) }}
{{ CourseCardWide(course) }} {{ CourseCardWide(course) }}
{{ CourseOutlineAndCreator(course) }} {{ CourseOutlineAndCreator(course) }}
@@ -88,10 +88,10 @@
{% macro CourseOutlineAndCreator(course) %} {% macro CourseOutlineAndCreator(course) %}
<div class="course-outline-instructor-parent"> <div class="course-outline-instructor-parent">
<div class="course-home-outline"> <div class="course-home-outline col">
{{ widgets.CourseOutline(course=course, membership=membership) }} {{ widgets.CourseOutline(course=course, membership=membership) }}
</div> </div>
<div class="course-creator-progress-parent"> <div class="course-creator-progress-parent col-sm-auto">
<div class="course-creator-section"> <div class="course-creator-section">
<div class="course-home-headings"> <div class="course-home-headings">
Creator Creator
@@ -134,14 +134,14 @@
</div> </div>
<div class="mentors-section"> <div class="mentors-section">
{% for mentor in course.get_mentors() %} {% for mentor in course.get_mentors() %}
{{ widgets.MemberCard(member=mentor, show_course_count=False, dimension_class="member-card-medium") }} {{ widgets.MemberCard(member=mentor, show_course_count=False, dimension_class="") }}
{% endfor %} {% endfor %}
<div class="view-all-mentors"> </div>
<span class="card-divider-dark flex-one"></span> <div class="view-all-mentors">
<span class="course-instructor"><span class="all-mentors-text">View all mentors</span> <img class="mentor-icon" <span class="card-divider-dark flex-one"></span>
src="/assets/community/icons/down-arrow.svg" /></span> <span class="course-instructor"><span class="all-mentors-text">View all mentors</span> <img class="mentor-icon"
<span class="card-divider-dark flex-one"></span> src="/assets/community/icons/down-arrow.svg" /></span>
</div> <span class="card-divider-dark flex-one"></span>
</div> </div>
</div> </div>
{% endif %} {% endif %}
@@ -151,7 +151,7 @@
{% macro CourseDescriptionAndOverview(course) %} {% macro CourseDescriptionAndOverview(course) %}
<div class="course-outline-instructor-parent"> <div class="course-outline-instructor-parent">
<div class="course-description-section"> <div class="course-description-section col">
<div class="course-home-headings"> <div class="course-home-headings">
Course Description Course Description
</div> </div>
@@ -161,7 +161,7 @@
</div> </div>
{% set avg_rating = course.get_average_rating() %} {% set avg_rating = course.get_average_rating() %}
{% if course.get_students() | length or avg_rating %} {% if course.get_students() | length or avg_rating %}
<div class="course-overview-section"> <div class="course-overview-section col-sm-auto">
<div class="course-home-headings"> <div class="course-home-headings">
Overview Overview
</div> </div>

View File

@@ -61,7 +61,7 @@ var check_mentor_request = () => {
var hide_wrapped_mentor_cards = () => { var hide_wrapped_mentor_cards = () => {
var offset_top_prev; var offset_top_prev;
$('.member-card-medium').each(function () { $(".mentors-section .member-card").each(function () {
var offset_top = $(this).offset().top; var offset_top = $(this).offset().top;
if (offset_top > offset_top_prev) { if (offset_top > offset_top_prev) {
$(this).addClass('wrapped').slideUp("fast"); $(this).addClass('wrapped').slideUp("fast");

View File

@@ -10,7 +10,7 @@
{% block content %} {% block content %}
<div class="common-page-style"> <div class="common-page-style">
<div class="course-top-section"> <div class="col course-top-section">
<div class="courses-header"> <div class="courses-header">
{{ 'All Courses' }} {{ 'All Courses' }}
</div> </div>