diff --git a/community/fixtures/custom_field.json b/community/fixtures/custom_field.json index d3bb2124..e450d748 100644 --- a/community/fixtures/custom_field.json +++ b/community/fixtures/custom_field.json @@ -104,5 +104,270 @@ "translatable": 1, "unique": 0, "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "User", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "medium", + "fieldtype": "Data", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "github", + "label": "Medium ID", + "length": 0, + "mandatory_depends_on": null, + "modified": "2021-06-30 14:46:55.834145", + "name": "User-medium", + "no_copy": 0, + "non_negative": 0, + "options": null, + "parent": null, + "parentfield": null, + "parenttype": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "translatable": 1, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "User", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "city", + "fieldtype": "Data", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "mute_sounds", + "label": "City", + "length": 0, + "mandatory_depends_on": null, + "modified": "2021-06-30 14:46:55.834145", + "name": "User-city", + "no_copy": 0, + "non_negative": 0, + "options": null, + "parent": null, + "parentfield": null, + "parenttype": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "translatable": 1, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "User", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "college", + "fieldtype": "Data", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "city", + "label": "College Name", + "length": 0, + "mandatory_depends_on": null, + "modified": "2021-06-30 14:46:55.834145", + "name": "User-college", + "no_copy": 0, + "non_negative": 0, + "options": null, + "parent": null, + "parentfield": null, + "parenttype": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "translatable": 1, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "User", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "branch", + "fieldtype": "Data", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "college", + "label": "Branch", + "length": 0, + "mandatory_depends_on": null, + "modified": "2021-06-30 14:46:55.834145", + "name": "User-branch", + "no_copy": 0, + "non_negative": 0, + "options": null, + "parent": null, + "parentfield": null, + "parenttype": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "translatable": 1, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "User", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "profession", + "fieldtype": "Data", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "medium", + "label": "Profession", + "length": 0, + "mandatory_depends_on": null, + "modified": "2021-06-30 14:46:55.834145", + "name": "User-profession", + "no_copy": 0, + "non_negative": 0, + "options": null, + "parent": null, + "parentfield": null, + "parenttype": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "translatable": 1, + "unique": 0, + "width": null } ] diff --git a/community/hooks.py b/community/hooks.py index 61b681f5..691d75ee 100644 --- a/community/hooks.py +++ b/community/hooks.py @@ -167,7 +167,8 @@ whitelist = [ "/add-a-new-batch", "/new-sign-up", "/message", - "/about" + "/about", + "/edit-profile" ] whitelist_rules = [{"from_route": p, "to_route": p[1:]} for p in whitelist] @@ -178,6 +179,10 @@ profile_rules = [ website_route_rules = primary_rules + whitelist_rules + profile_rules +website_redirects = [ + {"source": "/update-profile", "target": "/edit-profile"}, +] + update_website_context = 'community.widgets.update_website_context' ## Specify the additional tabs to be included in the user profile page. diff --git a/community/lms/web_form/profile/profile.js b/community/lms/web_form/profile/profile.js index 699703c5..027cef49 100644 --- a/community/lms/web_form/profile/profile.js +++ b/community/lms/web_form/profile/profile.js @@ -1,3 +1,7 @@ -frappe.ready(function() { - // bind events here -}) \ No newline at end of file +frappe.ready(function () { + frappe.web_form.after_load = () => { + if (!frappe.utils.get_url_arg("name")) { + window.location.href = `/edit-profile?name=${frappe.session.user}`; + } + } +}) diff --git a/community/lms/web_form/profile/profile.json b/community/lms/web_form/profile/profile.json index c4962a94..4c3fcc7d 100644 --- a/community/lms/web_form/profile/profile.json +++ b/community/lms/web_form/profile/profile.json @@ -12,6 +12,7 @@ "breadcrumbs": "", "button_label": "Save", "creation": "2021-06-30 13:48:13.682851", + "custom_css": "[data-doctype=\"Web Form\"] {\n max-width: 720px;\n margin: 6rem auto;\n}", "doc_type": "User", "docstatus": 0, "doctype": "Web Form", @@ -19,14 +20,14 @@ "is_standard": 1, "login_required": 1, "max_attachment_size": 0, - "modified": "2021-06-30 15:53:20.967466", + "modified": "2021-07-14 17:15:15.424855", "modified_by": "Administrator", "module": "LMS", "name": "profile", "owner": "Administrator", "payment_button_label": "Buy Now", "published": 1, - "route": "profile", + "route": "edit-profile", "route_to_success_link": 0, "show_attachments": 0, "show_in_grid": 0, @@ -84,18 +85,6 @@ "reqd": 0, "show_in_filter": 0 }, - { - "allow_read_on_all_link_options": 0, - "fieldname": "username", - "fieldtype": "Data", - "hidden": 0, - "label": "Username", - "max_length": 0, - "max_value": 0, - "read_only": 0, - "reqd": 0, - "show_in_filter": 0 - }, { "allow_read_on_all_link_options": 0, "fieldname": "mobile_no", @@ -120,6 +109,91 @@ "read_only": 0, "reqd": 0, "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "fieldname": "linkedin", + "fieldtype": "Data", + "hidden": 0, + "label": "LinkedIn ID", + "max_length": 0, + "max_value": 0, + "read_only": 0, + "reqd": 0, + "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "fieldname": "github", + "fieldtype": "Data", + "hidden": 0, + "label": "Github ID", + "max_length": 0, + "max_value": 0, + "read_only": 0, + "reqd": 0, + "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "fieldname": "medium", + "fieldtype": "Data", + "hidden": 0, + "label": "Medium ID", + "max_length": 0, + "max_value": 0, + "read_only": 0, + "reqd": 0, + "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "fieldname": "city", + "fieldtype": "Data", + "hidden": 0, + "label": "City", + "max_length": 0, + "max_value": 0, + "read_only": 0, + "reqd": 0, + "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "fieldname": "college", + "fieldtype": "Data", + "hidden": 0, + "label": "College Name", + "max_length": 0, + "max_value": 0, + "read_only": 0, + "reqd": 0, + "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "depends_on": "college", + "fieldname": "branch", + "fieldtype": "Data", + "hidden": 0, + "label": "Branch", + "max_length": 0, + "max_value": 0, + "read_only": 0, + "reqd": 0, + "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "fieldname": "profession", + "fieldtype": "Data", + "hidden": 0, + "label": "Profession", + "max_length": 0, + "max_value": 0, + "read_only": 0, + "reqd": 0, + "show_in_filter": 0 } ] } \ No newline at end of file diff --git a/community/lms/widgets/ChapterTeaser.html b/community/lms/widgets/ChapterTeaser.html index 526e92fb..9f8afba0 100644 --- a/community/lms/widgets/ChapterTeaser.html +++ b/community/lms/widgets/ChapterTeaser.html @@ -25,7 +25,7 @@ {{ lesson.title }} {% if membership %} - {% endif %} diff --git a/community/lms/widgets/CourseCard.html b/community/lms/widgets/CourseCard.html index b45246bf..ba0250ee 100644 --- a/community/lms/widgets/CourseCard.html +++ b/community/lms/widgets/CourseCard.html @@ -29,12 +29,21 @@ {{ course.get_instructor().full_name }} - {% if course.get_students() | length %} - - {{ course.get_students() | length }} + {% if course.get_students() | length %} + + + {{ course.get_students() | length }} + + {% endif %} + {% set avg_rating = course.get_average_rating() %} + {% if avg_rating %} + + + {{ avg_rating }} + + {% endif %} - {% endif %} {% set membership = course.get_membership(frappe.session.user) %} @@ -61,3 +70,13 @@ {% endif %} + diff --git a/community/lms/widgets/MemberCard.html b/community/lms/widgets/MemberCard.html index 0ecc2d72..d780eb34 100644 --- a/community/lms/widgets/MemberCard.html +++ b/community/lms/widgets/MemberCard.html @@ -1,5 +1,5 @@
- {% set avatar_class = "avatar-large" if not dimension_class else "avatar-xl"%} + {% set avatar_class = "avatar-large" if not dimension_class else "avatar-large"%} {{ widgets.Avatar(member=member, avatar_class=avatar_class) }}
{{ member.full_name }} diff --git a/community/overrides/user.py b/community/overrides/user.py index 8588a350..91cd5abd 100644 --- a/community/overrides/user.py +++ b/community/overrides/user.py @@ -59,3 +59,12 @@ class CustomUser(User): filters["member_type"] = member_type return frappe.get_all("LMS Batch Membership", filters, ["name", "course"]) + + def get_mentored_courses(self): + """ Returns all courses mentored by this user """ + return frappe.get_all("LMS Course Mentor Mapping", + { + "mentor": self.name + }, + ["name", "course"] + ) diff --git a/community/public/css/style.css b/community/public/css/style.css index 9e60ccd6..77664d71 100644 --- a/community/public/css/style.css +++ b/community/public/css/style.css @@ -304,6 +304,11 @@ input[type=checkbox] { height: 45px; } +@media (max-width: 360px) { + .course-card-title { + font-size: 14px; + } +} .card-divider { border: 1px solid #F4F5F6; margin-bottom: 16px; @@ -863,11 +868,30 @@ div.custom-checkbox>label>input:checked+img { margin: 0; } -.avatar-xl { +.avatar-large { width: 88px; height: 88px; } +.avatar-xl { + width: 112px; + height: 112px; +} + +@media (max-width: 500px) { + .avatar-xl { + width: 88px; + height: 88px; + } +} + +@media (max-width: 375px) { + .avatar-xl { + width: 50px; + height: 50px; + } +} + .description-card { padding: 24px; flex-direction: column; @@ -1067,25 +1091,148 @@ div.custom-checkbox>label>input:checked+img { font-weight: bold; } -.lesson-progress-tick { - width: 16px; - height: 16px; - background: #4C5A67; - border-radius: 2px; - padding: 2px; - margin: 0px 4px 4px; +.profile-page { + max-width: 1150px; + margin: 0 auto; + padding-top: 1rem; + padding-bottom: 1rem; +} + +.profile-banner { + width: 100%; + height: 248px; + border-radius: 12px 12px 0px 0px; +} + +@media (max-width: 500px) { + .profile-banner { + height: 150px; + } +} + +.profile-info { + height: 68px; + background: #ffffff; + border-radius: 0px 0px 12px 12px; +} + +.profile-avatar { + position: relative; + top: 188px; + left: 40px; + display: flex; +} + +@media (max-width: 500px) { + .profile-avatar { + top: 95px; + left: 10px; + } +} + +@media (max-width: 375px) { + .profile-avatar { + top: 120px; + left: 10px; + } +} + +.profile-name { + color: #FFFFFF; + font-weight: 600; + font-size: 22px; + line-height: 156%; + letter-spacing: -0.0175em; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.64); + padding: 20px; +} + +@media (max-width: 375px) { + .profile-name { + font-size: 16px; + padding: 5px; + } +} + +.creator-badge { + background: #48BB74; + padding: 4px 6px; + color: #ffffff; + font-style: normal; + font-weight: bold; + font-size: 10px; + line-height: 120%; + text-align: center; + letter-spacing: 0.011em; + text-transform: uppercase; + height: fit-content; + box-shadow: 0px 1px 1px rgb(0 0 0 / 16%); + border-radius: 4px; + margin-top: 25px; +} + +@media (max-width: 375px) { + .creator-badge { + font-size: 8px; + margin: 8px 0px 0px; + } +} + +.profile-profession { + position: relative; + top: 16px; + left: 174px; + font-size: 12px; + line-height: 165%; +} + +@media (max-width: 500px) { + .profile-profession { + top: 10px; + left: 120px; + } +} + +@media (max-width: 375px) { + .profile-profession { + top: 5px; + left: 70px; + } +} + +.social-icons { + float: right; + margin: 16px; +} + +@media (max-width: 500px) { + .social-icons { + margin: 10px; + } +} + +@media (max-width: 375px) { + .social-icons { + margin: 5px; + } } .profile-courses { margin-top: 3rem; } -@media (max-width: 375px) { +@media (max-width: 500px) { .profile-courses { padding: 0px 24px 0px; } } +@media (max-width: 360px) { + .profile-courses { + padding: 0px 10px 0px; + } +} + .progress-text { font-size: 12px; line-height: 165%; @@ -1117,9 +1264,9 @@ div.custom-checkbox>label>input:checked+img { } } -@media (max-width: 375px) { +@media (max-width: 600px) { .progress-card { - width: 312px; + width: 100%; } } diff --git a/community/public/icons/github.svg b/community/public/icons/github.svg new file mode 100644 index 00000000..f946cae0 --- /dev/null +++ b/community/public/icons/github.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/community/public/icons/medium.svg b/community/public/icons/medium.svg new file mode 100644 index 00000000..df87d2cc --- /dev/null +++ b/community/public/icons/medium.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/community/public/images/linkedin.png b/community/public/images/linkedin.png new file mode 100644 index 00000000..89d8ab50 Binary files /dev/null and b/community/public/images/linkedin.png differ diff --git a/community/public/images/profile-banner.png b/community/public/images/profile-banner.png new file mode 100644 index 00000000..5d9443ba Binary files /dev/null and b/community/public/images/profile-banner.png differ diff --git a/community/www/courses/index.html b/community/www/courses/index.html index a1f74536..a41343c3 100644 --- a/community/www/courses/index.html +++ b/community/www/courses/index.html @@ -22,16 +22,3 @@
{% endblock %} - -{% block script %} - -{% endblock %} diff --git a/community/www/profiles/profile.html b/community/www/profiles/profile.html index 325565c6..29caa1c8 100644 --- a/community/www/profiles/profile.html +++ b/community/www/profiles/profile.html @@ -6,23 +6,57 @@ {% block content %}
-
- {{ widgets.MemberCard(member=member, show_course_count=True, dimension_class="member-card-xl") }} +
+ {{ ProfileBanner(member) }} {{ AboutOverviewSection(member) }} -
- {{ CoursesCreated(member) }} - {{ CoursesMentored(member) }} - {{ CoursesEnrolled(member) }} -
+ {{ CoursesCreated(member) }} + {{ CoursesMentored(member) }} + {{ CoursesEnrolled(member) }} {{ ProfileTabs(profile_tabs) }}
{% endblock %} +{% macro ProfileBanner(member) %} +
+
+
+ {{ widgets.Avatar(member=member, avatar_class="avatar-xl") }} +
{{ member.full_name }}
+ {% if member.get_authored_courses() | length %} +
Creator
+ {% endif %} +
+
+
+ {% if member.profession %} + {{ member.profession }} + {% endif %} + +
+
+{% endmacro %} + {% macro AboutOverviewSection(member) %}
{% if member.bio %} -
+
About
@@ -31,7 +65,7 @@
{% endif %} -
+
Overview
@@ -62,42 +96,48 @@ {% macro CoursesCreated(member) %} {% if member.get_authored_courses() | length %} -
- Courses Created -
-
- {% for course in member.get_authored_courses() %} - {% set course_details = frappe.get_doc("LMS Course", course) %} - {{ widgets.CourseCard(course=course_details) }} - {% endfor %} +
+
+ Courses Created +
+
+ {% for course in member.get_authored_courses() %} + {% set course_details = frappe.get_doc("LMS Course", course) %} + {{ widgets.CourseCard(course=course_details) }} + {% endfor %} +
{% endif %} {% endmacro %} {% macro CoursesMentored(member) %} -{% if member.get_course_membership("Mentor") | length %} -
- Courses Mentored -
-
- {% for membership in member.get_course_membership("Mentor") %} - {% set course_details = frappe.get_doc("LMS Course", membership.course) %} - {{ widgets.CourseCard(course=course_details) }} - {% endfor %} +{% if member.get_mentored_courses() | length %} +
+
+ Courses Mentored +
+
+ {% for mentorship in member.get_mentored_courses() %} + {% set course_details = frappe.get_doc("LMS Course", mentorship.course) %} + {{ widgets.CourseCard(course=course_details) }} + {% endfor %} +
{% endif %} {% endmacro %} {% macro CoursesEnrolled(member) %} {% if member.get_course_membership("Student") | length %} -
- Courses Enrolled -
-
- {% for membership in member.get_course_membership("Student") %} - {% set course_details = frappe.get_doc("LMS Course", membership.course) %} - {{ widgets.CourseCard(course=course_details) }} - {% endfor %} +
+
+ Courses Enrolled +
+
+ {% for membership in member.get_course_membership("Student") %} + {% set course_details = frappe.get_doc("LMS Course", membership.course) %} + {{ widgets.CourseCard(course=course_details) }} + {% endfor %} +
{% endif %} {% endmacro %}