From 56d738474ab688dc1deeaed794c4e9033df63955 Mon Sep 17 00:00:00 2001 From: Jan Doe Date: Fri, 10 Sep 2021 18:54:27 +0530 Subject: [PATCH] fix: course card buttons --- community/lms/widgets/CourseCard.html | 196 +++++++++++++++----------- community/public/css/style.css | 11 +- community/www/profiles/profile.py | 3 +- 3 files changed, 124 insertions(+), 86 deletions(-) diff --git a/community/lms/widgets/CourseCard.html b/community/lms/widgets/CourseCard.html index 03fd49ed..d1bc96f8 100644 --- a/community/lms/widgets/CourseCard.html +++ b/community/lms/widgets/CourseCard.html @@ -1,15 +1,19 @@ {% set membership = course.get_membership(frappe.session.user) %} - +{% set progress = course.get_course_progress() %}
+
{% for tag in course.get_tags() %}
{{ tag }}
{% endfor %} - {% set progress = course.get_course_progress() %} {% if membership and not read_only %} -
{{ frappe.utils.rounded(progress) }}%
+ {% if progress < 100 %} +  
{{ frappe.utils.rounded(progress) }}% Completed
+ {% else %} +
Completed
+ {% endif %} {% endif %}
{% if not course.image %} @@ -17,97 +21,121 @@ {% endif %}
-
- -
- {% if course.get_chapters() | length %} - - {{ course.get_chapters() | length }} Chapters - - {% endif %} - {% if course.get_chapters() | length and course.get_upcoming_batches() | length %} - . - {% endif %} - {% if course.get_upcoming_batches() | length %} - - {{ course.get_upcoming_batches() | length }} Open Batches - - {% endif %} -
- -
{{ course.title }}
- -
- - {{ widgets.Avatar(member=course.get_instructor(), avatar_class="avatar-small") }} - - - {{ course.get_instructor().full_name }} - - - - - {% if course.get_students() | length %} - - - {{ course.get_students() | length }} - - {% endif %} - {% set avg_rating = course.get_average_rating() %} - {% if avg_rating %} - - - {{ avg_rating }} - - {% endif %} - -
- - {% if not read_only %} - - {% set lesson_index = course.get_lesson_index(membership.current_lesson) if membership and - membership.current_lesson - else '1.1' %} - - {% set query_parameter = "?batch=" + membership.batch if membership and membership.batch else "" %} - - {% set certificate = course.is_certified() %} - {% if certificate and not read_only %} - - - - {% elif course.upcoming %} - - - - {% elif membership %} - - - - {% else %} - - +
+
+ {% if course.get_chapters() | length %} + + {{ course.get_chapters() | length }} Chapters + {% endif %} - + {% if course.get_chapters() | length and course.get_upcoming_batches() | length %} + . + {% endif %} + {% if course.get_upcoming_batches() | length %} + + {{ course.get_upcoming_batches() | length }} Open Batches + {% endif %} -
+
{{ course.title }}
+
+ + {{ widgets.Avatar(member=course.get_instructor(), avatar_class="avatar-small") }} + + + {{ course.get_instructor().full_name }} + + + + + {% if course.get_students() | length %} + + + {{ course.get_students() | length }} + {% endif %} + {% set avg_rating = course.get_average_rating() %} + {% if avg_rating %} + + + {{ avg_rating }} + + {% endif %} + +
+ + {% if not read_only %} + + {% set lesson_index = course.get_lesson_index(membership.current_lesson) if membership and + membership.current_lesson else '1.1' %} + {% set query_parameter = "?batch=" + membership.batch if membership and + membership.batch else "" %} + {% set certificate = course.is_certified() %} + + {% if certificate %} + + + + {% elif course.enable_certification and progress == 100 %} + + + {% elif progress == 100 %} + + + + {% elif course.upcoming %} + + + + {% elif membership %} + + + + {% else %} + + + + {% endif %} + {% endif %} +
diff --git a/community/public/css/style.css b/community/public/css/style.css index ef6b463a..e7e47d22 100644 --- a/community/public/css/style.css +++ b/community/public/css/style.css @@ -76,7 +76,6 @@ input[type=checkbox] { border-radius: 4px; padding: 4px 6px; font-size: 10px; - line-height: 120%; text-align: center; letter-spacing: 0.011em; text-transform: uppercase; @@ -85,6 +84,15 @@ input[type=checkbox] { box-shadow: 0px 5px 10px rgb(0 0 0 / 10%); } +.dark-pills { + background: rgba(25, 39, 52, 0.8); + color: #ffffff; +} +.dark-pills img { + width: 0.75rem; + height: 0.75rem; +} + .common-page-style { background: #F4F5F6; padding-bottom: 5rem; @@ -172,6 +180,7 @@ input[type=checkbox] { padding: 8px 0px 8px; text-align: center; line-height: 135%; + cursor: pointer; } .cards-parent { diff --git a/community/www/profiles/profile.py b/community/www/profiles/profile.py index 1498f215..73ea980f 100644 --- a/community/www/profiles/profile.py +++ b/community/www/profiles/profile.py @@ -1,4 +1,5 @@ import frappe +from community.page_renderers import get_profile_url_prefix def get_context(context): context.no_cache = 1 @@ -8,7 +9,7 @@ def get_context(context): except KeyError: username = frappe.db.get_value("User", frappe.session.user, ["username"]) if username: - frappe.local.flags.redirect_location = "/users/" + username + frappe.local.flags.redirect_location = get_profile_url_prefix() + username raise frappe.Redirect try: context.member = frappe.get_doc("User", {"username": username})