diff --git a/community/community/doctype/community_member/community_member.json b/community/community/doctype/community_member/community_member.json index f0cfdf5c..d7a4cc03 100644 --- a/community/community/doctype/community_member/community_member.json +++ b/community/community/doctype/community_member/community_member.json @@ -107,7 +107,7 @@ "has_web_view": 1, "index_web_pages_for_search": 1, "links": [], - "modified": "2021-04-12 17:32:36.211603", + "modified": "2021-04-14 09:36:27.813085", "modified_by": "Administrator", "module": "Community", "name": "Community Member", @@ -139,7 +139,9 @@ } ], "quick_entry": 1, + "search_fields": "full_name", "sort_field": "modified", "sort_order": "DESC", + "title_field": "full_name", "track_changes": 1 } \ No newline at end of file diff --git a/community/hooks.py b/community/hooks.py index 75d4d761..6fef77ca 100644 --- a/community/hooks.py +++ b/community/hooks.py @@ -156,7 +156,7 @@ whitelist_rules = [{"from_route": p, "to_route": p[1:]} for p in whitelist] # regex rule to match all profiles profile_rules = [ - {"from_route": "/", "to_route": "profiles/profile"}, + {"from_route": "/", "to_route": "profiles/profile"}, ] website_route_rules = primary_rules + whitelist_rules + profile_rules diff --git a/community/www/courses/course.html b/community/www/courses/course.html index 8b40e9cf..c51f98c3 100644 --- a/community/www/courses/course.html +++ b/community/www/courses/course.html @@ -38,7 +38,7 @@
-
{{ frappe.utils.md_to_html(course.description) }}
+
{{ frappe.utils.md_to_html(course.description) }}
{% for topic in course.topics %}
@@ -80,7 +80,7 @@
{% for message in discussions %}
-
{{ message.author }}
+
{{ message.author_name }}
{{ message.message }}
{{ message.creation }}
diff --git a/community/www/courses/course.js b/community/www/courses/course.js index 58177576..0e586f1c 100644 --- a/community/www/courses/course.js +++ b/community/www/courses/course.js @@ -35,9 +35,9 @@ frappe.ready(() => { } }) var add_message = (message, session_user = false) => { - var author = session_user ? "You" : message.author + var author_name = session_user ? "You" : message.author_name return `
-
${author}
+
${author_name}
${message.message}
${message.creation}
`; diff --git a/community/www/courses/course.py b/community/www/courses/course.py index 8cdfb3c9..d34eb3b5 100644 --- a/community/www/courses/course.py +++ b/community/www/courses/course.py @@ -57,9 +57,9 @@ def get_messages(batch): for message in messages: message.message = frappe.utils.md_to_html(message.message) message.creation = frappe.utils.format_datetime(message.creation, "medium") - member_email = frappe.db.get_value("Community Member", message.author, "email") + message.author_name, member_email = frappe.db.get_value("Community Member", message.author, ["full_name","email"]) if member_email == frappe.session.user: - message.author = "You" + message.author_name = "You" return messages @frappe.whitelist() diff --git a/community/www/dashboard/index.html b/community/www/dashboard/index.html index 733dc31f..4b89e6a0 100644 --- a/community/www/dashboard/index.html +++ b/community/www/dashboard/index.html @@ -145,7 +145,7 @@
-
+
Create a New Sketch
{% if sketches %} @@ -181,7 +181,9 @@ {% for course in courses %}
-
{{ course.name }}
+ +
{{ course.name }}
+
{% if course.member_type %}
{{ course.member_type }} diff --git a/community/www/dashboard/index.py b/community/www/dashboard/index.py index 4e8a0076..7f78ef39 100644 --- a/community/www/dashboard/index.py +++ b/community/www/dashboard/index.py @@ -9,7 +9,7 @@ def get_context(context): context.courses = get_courses(context.memberships) context.activity = get_activity(context.memberships) context.sketches = list(filter(lambda x: x.owner == frappe.session.user, get_recent_sketches())) - print(context) + def get_memberships(member): return frappe.get_all("LMS Batch Membership", {"member": member}, ["batch", "member_type", "creation"]) diff --git a/community/www/profiles/profile.html b/community/www/profiles/profile.html index e793d529..0a789e2c 100644 --- a/community/www/profiles/profile.html +++ b/community/www/profiles/profile.html @@ -1,9 +1,143 @@ {% extends "templates/web.html" %} {% from "www/macros/profile.html" import profile %} +{% block head_include %} + + + +{% endblock %} {% block page_content %}
-
- {{ profile(member.photo, member.full_name, abbr, "large")}} +
+
+ {{ profile(member.photo, member.full_name, abbr, "large")}} +
+
+
+ {{member.full_name}} +
+
+ +
+
+
+
+
+ Create a New Sketch +
+ {% if sketches %} + {% for sketch in sketches %} +
+
+ + +
+
+ {% endfor %} + {% else %} +

You have not created any sketches.

+ {% endif %} +
+
+
+
+
+
{% endblock %} diff --git a/community/www/profiles/profile.py b/community/www/profiles/profile.py index 0f9f76e0..65f6d502 100644 --- a/community/www/profiles/profile.py +++ b/community/www/profiles/profile.py @@ -1,18 +1,9 @@ import frappe +from ...lms.doctype.lms_sketch.lms_sketch import get_recent_sketches def get_context(context): context.no_cache = 1 - - username = frappe.form_dict.get('username') - user = username and get_user(username) - if not user: - context.template = "www/404.html" - - user.abbr = "".join([s[0] for s in user.full_name.split()]) - context.user = user - -def get_user(username): - try: - return frappe.get_doc("Community Member", username) - except frappe.DoesNotExistError: - return + context.username = frappe.form_dict['username'] + context.member = frappe.get_doc("Community Member", {"username":context.username}) + context.abbr = "".join([s[0] for s in context.member.full_name.split()]) + context.sketches = list(filter(lambda x: x.owner == context.member.email, get_recent_sketches()))