- {% set avatar_class = "avatar-large" if not dimension_class else "avatar-large"%}
+ {% set avatar_class = "avatar-xl" if not dimension_class else "avatar-large"%}
{{ widgets.Avatar(member=member, avatar_class=avatar_class) }}
{{ member.full_name }}
diff --git a/school/overrides/user.py b/school/overrides/user.py
index 5b452e06..4b1fd9b6 100644
--- a/school/overrides/user.py
+++ b/school/overrides/user.py
@@ -1,6 +1,6 @@
import frappe
from frappe.core.doctype.user.user import User
-from frappe.utils import cint, escape_html, random_string
+from frappe.utils import cint, escape_html, random_string, unique
import hashlib
import random
import re
@@ -8,6 +8,7 @@ from frappe import _
from frappe.website.utils import is_signup_disabled
import requests
from frappe.geo.country_info import get_all
+from school.widgets import Widgets
class CustomUser(User):
@@ -237,3 +238,72 @@ def get_country_code():
pass
return {}
+
+@frappe.whitelist(allow_guest=True)
+def search_users(start=0, text=""):
+ or_filters = get_or_filters(text)
+ count = len(get_users(or_filters, 0, 900000000, text))
+ users = get_users(or_filters, start, 30, text)
+ user_details = get_user_details(users)
+
+ return {
+ "user_details": user_details,
+ "start": cint(start) + 30,
+ "count": count
+ }
+
+def get_or_filters(text):
+ user_fields = ["first_name", "last_name", "full_name", "email", "preferred_location", "dream_companies"]
+ education_fields = ["institution_name", "location", "degree_type", "major"]
+ work_fields = ["title", "company"]
+ certification_fields = ["certification_name", "organization"]
+
+ or_filters = []
+ if text:
+ for field in user_fields:
+ or_filters.append(f"u.{field} like '%{text}%'")
+ for field in education_fields:
+ or_filters.append(f"ed.{field} like '%{text}%'")
+ for field in work_fields:
+ or_filters.append(f"we.{field} like '%{text}%'")
+ for field in certification_fields:
+ or_filters.append(f"c.{field} like '%{text}%'")
+
+ or_filters.append(f"s.skill_name like '%{text}%'")
+ or_filters.append(f"pf.function like '%{text}%'")
+ or_filters.append(f"pi.industry like '%{text}%'")
+
+
+ return "AND {}".format(" OR ".join(or_filters)) if or_filters else ""
+
+def get_user_details(users):
+ user_details = []
+ for user in users:
+ details = frappe.get_doc("User", user)
+ user_details.append(Widgets().MemberCard(member=details))
+
+ return user_details
+
+def get_users(or_filters, start, page_length, text):
+
+ users = frappe.db.sql("""
+ SELECT DISTINCT u.name
+ FROM `tabUser` u
+ LEFT JOIN `tabEducation Detail` ed
+ ON u.name = ed.parent
+ LEFT JOIN `tabWork Experience` we
+ ON u.name = we.parent
+ LEFT JOIN `tabCertification` c
+ ON u.name = c.parent
+ LEFT JOIN `tabSkills` s
+ ON u.name = s.parent
+ LEFT JOIN `tabPreferred Function` pf
+ ON u.name = pf.parent
+ LEFT JOIN `tabPreferred Industry` pi
+ ON u.name = pi.parent
+ WHERE u.enabled = True {or_filters}
+ ORDER BY u.creation desc
+ LIMIT {start}, {page_length}
+ """.format(or_filters = or_filters, start=start, page_length=page_length), as_dict=1)
+
+ return users
diff --git a/school/public/css/style.css b/school/public/css/style.css
index cc9a22d9..1786a37d 100644
--- a/school/public/css/style.css
+++ b/school/public/css/style.css
@@ -546,7 +546,7 @@ input[type=checkbox] {
.profile-parent-section {
display: grid;
grid-gap: 2rem;
- grid-template-columns: 4fr 1fr;
+ grid-template-columns: 5fr 1.5fr;
}
@media (max-width: 768px) {
@@ -645,7 +645,7 @@ input[type=checkbox] {
display: flex;
flex-direction: column;
align-items: center;
- padding: 20px 0px 16px;
+ padding: 1rem 0;
}
.member-card .talk-title {
@@ -670,7 +670,8 @@ input[type=checkbox] {
}
.member-card-title {
- margin: 12px 0px 4px;
+ margin-top: 0.75rem;
+ text-align: center;
}
.member-card-large .member-card-title {
@@ -740,6 +741,11 @@ input[type=checkbox] {
height: 88px;
}
+.member-card .avatar-xl {
+ width: 150px;
+ height: 150px;
+}
+
.avatar-xl {
width: 112px;
height: 112px;
@@ -799,16 +805,16 @@ input[type=checkbox] {
}
}
-.mentors-section {
+.member-parent {
display: grid;
- grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
+ grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
-moz-column-gap: 32px;
column-gap: 32px;
row-gap: 32px;
}
@media (max-width: 600px) {
- .mentors-section {
+ .member-parent {
grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
-moz-column-gap: 24px;
column-gap: 24px;
@@ -1318,7 +1324,7 @@ pre {
margin-left: 1.5rem;
}
-.search-course {
+.search {
background-image: url(/assets/frappe/icons/timeless/search.svg);
border: 1px solid #C8CFD5;
box-sizing: border-box;
diff --git a/school/templates/search_course/search_course.html b/school/templates/search_course/search_course.html
index fd736d73..1590ffec 100644
--- a/school/templates/search_course/search_course.html
+++ b/school/templates/search_course/search_course.html
@@ -2,7 +2,7 @@
{% set search_placeholder = frappe.db.get_single_value("LMS Settings", "search_placeholder") %}
{% if show_search %}
-
+
{% set mentors = subgroup.get_mentors() %}
{% if mentors %}
-
+
{% for m in mentors %}
{{ widgets.MemberCard(member=m, show_course_count=False, dimension_class="") }}
{% endfor %}
@@ -68,7 +68,7 @@
{% macro render_students() %}
{% set students = subgroup.get_students() %}
{% if students %}
-
+
{% for student in students %}
{{ widgets.MemberCard(member=student, show_course_count=False, dimension_class="") }}
{% endfor %}
diff --git a/school/www/community/__init__.py b/school/www/community/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/school/www/community/index.html b/school/www/community/index.html
new file mode 100644
index 00000000..f8f15e09
--- /dev/null
+++ b/school/www/community/index.html
@@ -0,0 +1,32 @@
+{% extends "templates/base.html" %}
+{% from "www/hackathons/macros/card.html" import null_card %}
+{% block title %}{{ _('Community') }}{% endblock %}
+
+{% block content %}
+