diff --git a/lms/lms/doctype/cohort/cohort.json b/lms/lms/doctype/cohort/cohort.json
index 2efa1428..33b33549 100644
--- a/lms/lms/doctype/cohort/cohort.json
+++ b/lms/lms/doctype/cohort/cohort.json
@@ -61,6 +61,7 @@
"fieldtype": "Data",
"in_list_view": 1,
"label": "Slug",
+ "reqd": 1,
"unique": 1
},
{
@@ -105,7 +106,7 @@
"link_fieldname": "cohort"
}
],
- "modified": "2021-12-16 14:44:25.406301",
+ "modified": "2022-10-13 15:46:32.322926",
"modified_by": "Administrator",
"module": "LMS",
"name": "Cohort",
@@ -127,5 +128,6 @@
],
"sort_field": "modified",
"sort_order": "DESC",
+ "states": [],
"track_changes": 1
}
\ No newline at end of file
diff --git a/lms/lms/doctype/lms_course/lms_course.py b/lms/lms/doctype/lms_course/lms_course.py
index e5080bcd..44de5bae 100644
--- a/lms/lms/doctype/lms_course/lms_course.py
+++ b/lms/lms/doctype/lms_course/lms_course.py
@@ -137,7 +137,7 @@ class LMSCourse(Document):
def get_cohorts(self):
- return frappe.get_all("Cohort", {"course": self.name}, order_by="creation")
+ return frappe.get_all("Cohort", {"course": self.name}, ["name", "slug"], order_by="creation")
def get_cohort(self, cohort_slug):
diff --git a/lms/www/cohorts/cohort.html b/lms/www/cohorts/cohort.html
index 007e5d70..e1f54b5d 100644
--- a/lms/www/cohorts/cohort.html
+++ b/lms/www/cohorts/cohort.html
@@ -2,22 +2,25 @@
{% block title %}Manage {{ course.title }}{% endblock %}
{% block page_content %}
-
{{cohort.title}} Cohort
+
+ {{ cohort.title }}
+
{% set stats = cohort.get_stats() %}
- {{ stats.subgroups }} Subgroups
- | {{ stats.mentors }} Mentors
- | {{ stats.students }} students
- | {{ stats.join_requests }} join requests
+ {{ stats.subgroups }} {{ _("Subgroups")}}
+ | {{ stats.mentors }} {{ _("Mentors") }}
+ | {{ stats.students }} {{ _("Students") }}
+ | {{ stats.join_requests }} {{ _("Join Requests") }}
{% if is_mentor %}
-
- {% set sg = mentor.get_subgroup() %}
-
You are a mentor of {{sg.title}} subgroup.
-
Visit Your Subgroup →
+{% set sg = mentor.get_subgroup() %}
+
{% endif %}
@@ -40,38 +43,36 @@
{% endblock %}
{% macro render_subgroups() %}
-
+
{% endmacro %}
{% macro render_navitem(title, link, page, count=-1) %}
-
- {{title}}
- {% if count != -1 %}
- {{count}}
- {% endif %}
-
-
+
+
+ {{ title }}
+ {% if count != -1 %}
+
+ {{ count }}
+
+ {% endif %}
+
+
{% endmacro %}
diff --git a/lms/www/cohorts/index.py b/lms/www/cohorts/index.py
index 2d1f648b..54efbf83 100644
--- a/lms/www/cohorts/index.py
+++ b/lms/www/cohorts/index.py
@@ -1,5 +1,6 @@
import frappe
from .utils import get_course, add_nav
+from frappe.utils import get_url
def get_context(context):
context.no_cache = 1
@@ -14,7 +15,7 @@ def get_context(context):
context.cohorts = get_cohorts(context.course)
if len(context.cohorts) == 1:
- frappe.local.flags.redirect_location = context.cohorts[0].get_url()
+ frappe.local.flags.redirect_location = f"{get_url()}/courses/{context.course.name}/cohorts/{context.cohorts[0].slug}"
raise frappe.Redirect
add_nav(context, "All Courses", "/courses")
diff --git a/lms/www/cohorts/subgroup.html b/lms/www/cohorts/subgroup.html
index 2b61c052..af105cca 100644
--- a/lms/www/cohorts/subgroup.html
+++ b/lms/www/cohorts/subgroup.html
@@ -2,10 +2,9 @@
{% block title %} Subgroup {{subgroup.title}} - {{ course.title }} {% endblock %}
{% block page_content %}
-
{{subgroup.title}} Subgroup
+
+ {{subgroup.title}}
+
{{ render_navitem("Mentors", "/mentors", stats.mentors, page=="mentors")}}
@@ -51,31 +50,30 @@
{% endmacro %}
{% macro render_mentors() %}
- Mentors
{% set mentors = subgroup.get_mentors() %}
{% if mentors %}
{% for m in mentors %}
- {{ widgets.MemberCard(member=m, show_course_count=False) }}
+ {{ widgets.MemberCard(member=m, avatar_class="avatar-medium", show_course_count=False) }}
{% endfor %}
{% else %}
- None found.
+ None found.
{% endif %}
{% endmacro %}
{% macro render_students() %}
- {% set students = subgroup.get_students() %}
- {% if students %}
-
- {% for student in students %}
- {{ widgets.MemberCard(member=student, show_course_count=False) }}
- {% endfor %}
-
- {% else %}
- None found.
- {% endif %}
+ {% set students = subgroup.get_students() %}
+ {% if students %}
+
+ {% for student in students %}
+ {{ widgets.MemberCard(member=student, avatar_class="avatar-medium", show_course_count=False) }}
+ {% endfor %}
+
+ {% else %}
+ None found.
+ {% endif %}
{% endmacro %}
@@ -110,7 +108,7 @@
{% endfor %}
{% else %}
- There are no pending join requests.
+ {{ _("There are no pending join requests.") }}
{% endif %}
{% set rejected_requests = subgroup.get_join_requests(status="Rejected") %}
diff --git a/lms/www/courses/course.html b/lms/www/courses/course.html
index 2ac40742..be5fac09 100644
--- a/lms/www/courses/course.html
+++ b/lms/www/courses/course.html
@@ -315,7 +315,7 @@
{% elif is_cohort_staff(course.name, frappe.session.user) %}
- {{ _("Manage the course") }}
+ {{ _("Manage Cohorts") }}
{% elif membership %}
diff --git a/lms/www/dashboard/__init__.py b/lms/www/dashboard/__init__.py
new file mode 100644
index 00000000..e69de29b