From 43ba835b521d6470cd706449c948dcc9618c7db9 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Fri, 6 Jan 2023 18:27:04 +0530 Subject: [PATCH] fix: renamed community to people --- lms/hooks.py | 1 + lms/lms/widgets/MemberCard.html | 46 +++++++++++++------ lms/overrides/user.py | 2 +- lms/patches.txt | 1 + lms/patches/v0_0/rename_community_to_users.py | 7 +++ lms/public/css/style.css | 8 +--- lms/www/{community => people}/__init__.py | 0 lms/www/{community => people}/index.html | 2 +- lms/www/{community => people}/index.js | 0 lms/www/{community => people}/index.py | 2 +- 10 files changed, 45 insertions(+), 24 deletions(-) create mode 100644 lms/patches/v0_0/rename_community_to_users.py rename lms/www/{community => people}/__init__.py (100%) rename lms/www/{community => people}/index.html (96%) rename lms/www/{community => people}/index.js (100%) rename lms/www/{community => people}/index.py (92%) diff --git a/lms/hooks.py b/lms/hooks.py index d6b93393..b3b065dd 100644 --- a/lms/hooks.py +++ b/lms/hooks.py @@ -179,6 +179,7 @@ website_route_rules = [ website_redirects = [ {"source": "/update-profile", "target": "/edit-profile"}, {"source": "/dashboard", "target": "/courses"}, + {"source": "/community", "target": "/people"}, ] update_website_context = [ diff --git a/lms/lms/widgets/MemberCard.html b/lms/lms/widgets/MemberCard.html index 8d699b4f..9b38800e 100644 --- a/lms/lms/widgets/MemberCard.html +++ b/lms/lms/widgets/MemberCard.html @@ -1,20 +1,38 @@ {% set color = get_palette(member.full_name) %} -
- {{ widgets.Avatar(member=member, avatar_class=avatar_class) }} -
- {{ member.full_name }} -
+
+
+ {{ widgets.Avatar(member=member, avatar_class=avatar_class) }} - {% if member.headline %} -
{{ member.headline }}
- {% endif %} +
+
+ {{ member.full_name }} +
- {% set course_count = get_authored_courses(member.name, True) | length %} - {% if show_course_count and course_count > 0 %} - {% set suffix = "Courses" if course_count > 1 else "Course" %} -
- Created {{ course_count }} {{ suffix }} + {% if member.headline %} +
{{ member.headline }}
+ {% endif %} + + {% if member.looking_for_job %} +
{{ _("Open Network") }}
+ {% endif %} + + {% set course_count = get_authored_courses(member.name, True) | length %} + {% set suffix = "Courses" if course_count > 1 else "Course" %} + + {% if show_course_count and course_count > 0 %} +
+ Created {{ course_count }} {{ suffix }} +
+ {% endif %}
- {% endif %}
+ + + + + + + + +
diff --git a/lms/overrides/user.py b/lms/overrides/user.py index 8b948237..1f2a7c2a 100644 --- a/lms/overrides/user.py +++ b/lms/overrides/user.py @@ -345,7 +345,7 @@ def get_user_details(users): details = frappe.db.get_value( "User", user, - ["name", "username", "full_name", "user_image", "headline"], + ["name", "username", "full_name", "user_image", "headline", "looking_for_job"], as_dict=True, ) user_details.append(Widgets().MemberCard(member=details, avatar_class="avatar-large")) diff --git a/lms/patches.txt b/lms/patches.txt index 473d1f7b..b33979c2 100644 --- a/lms/patches.txt +++ b/lms/patches.txt @@ -45,3 +45,4 @@ lms.patches.v0_0.change_course_creation_settings #12-12-2022 lms.patches.v0_0.check_onboarding_status #21-12-2022 lms.patches.v0_0.assignment_file_type lms.patches.v0_0.user_singles_issue #23-11-2022 +lms.patches.v0_0.rename_community_to_users #06-01-2023 diff --git a/lms/patches/v0_0/rename_community_to_users.py b/lms/patches/v0_0/rename_community_to_users.py new file mode 100644 index 00000000..3eb12324 --- /dev/null +++ b/lms/patches/v0_0/rename_community_to_users.py @@ -0,0 +1,7 @@ +import frappe + + +def execute(): + doc = frappe.db.exists("Top Bar Item", {"url": "/community"}) + if doc: + frappe.db.set_value("Top Bar Item", doc, {"url": "/people", "label": "People"}) diff --git a/lms/public/css/style.css b/lms/public/css/style.css index e3cb1581..eca5c053 100644 --- a/lms/public/css/style.css +++ b/lms/public/css/style.css @@ -445,8 +445,7 @@ input[type=checkbox] { .member-card { display: flex; flex-direction: column; - align-items: center; - padding: 2rem 1rem; + padding: 1rem; font-size: var(--text-base); } @@ -1954,12 +1953,7 @@ select { margin: 0 !important; } -.member-card .standard-image { - border: 5px solid #FFFFFF; -} - .member-card-title { color: var(--gray-900); font-weight: 500; - margin-top: 1rem; } diff --git a/lms/www/community/__init__.py b/lms/www/people/__init__.py similarity index 100% rename from lms/www/community/__init__.py rename to lms/www/people/__init__.py diff --git a/lms/www/community/index.html b/lms/www/people/index.html similarity index 96% rename from lms/www/community/index.html rename to lms/www/people/index.html index 3c30bffc..0bbb80bc 100644 --- a/lms/www/community/index.html +++ b/lms/www/people/index.html @@ -32,7 +32,7 @@ {% endfor %}
- {% if user_count > user_details | length %} + {% if user_count > users | length %}
{{ _("Load More") }} diff --git a/lms/www/community/index.js b/lms/www/people/index.js similarity index 100% rename from lms/www/community/index.js rename to lms/www/people/index.js diff --git a/lms/www/community/index.py b/lms/www/people/index.py similarity index 92% rename from lms/www/community/index.py rename to lms/www/people/index.py index 1000378e..4fcefd8c 100644 --- a/lms/www/community/index.py +++ b/lms/www/people/index.py @@ -6,7 +6,7 @@ def get_context(context): context.users = frappe.get_all( "User", filters={"enabled": True}, - fields=["name", "username", "full_name", "user_image", "headline"], + fields=["name", "username", "full_name", "user_image", "headline", "looking_for_job"], start=0, page_length=24, order_by="creation desc",