diff --git a/frontend/src/components/UserDropdown.vue b/frontend/src/components/UserDropdown.vue
index 32ff7eb0..63e1b770 100644
--- a/frontend/src/components/UserDropdown.vue
+++ b/frontend/src/components/UserDropdown.vue
@@ -61,7 +61,7 @@ const props = defineProps({
const { logout, user } = sessionStore()
let { isLoggedIn } = sessionStore()
const userDropdownOptions = [
- {
+ /* {
icon: User,
label: 'My Profile',
onClick: () => {
@@ -70,7 +70,7 @@ const userDropdownOptions = [
condition: () => {
return isLoggedIn
},
- },
+ }, */
{
icon: LogOut,
label: 'Log out',
diff --git a/frontend/src/pages/Billing.vue b/frontend/src/pages/Billing.vue
index 327871c2..d44dfc00 100644
--- a/frontend/src/pages/Billing.vue
+++ b/frontend/src/pages/Billing.vue
@@ -155,7 +155,7 @@
:buttonLabel="
type == 'course' ? 'Checkout Courses' : 'Checkout Batches'
"
- :buttonLink="type == 'course' ? '/courses' : '/batches'"
+ :buttonLink="type == 'course' ? '/lms/courses' : '/lms/batches'"
/>
diff --git a/frontend/src/pages/Lesson.vue b/frontend/src/pages/Lesson.vue
index c93548c6..1d59b2c4 100644
--- a/frontend/src/pages/Lesson.vue
+++ b/frontend/src/pages/Lesson.vue
@@ -315,10 +315,6 @@ watch(
}
)
-const redirectToLogin = () => {
- window.location.href = `/login?redirect_to=/courses/${props.courseName}/learn/${route.params.chapterNumber}-${route.params.lessonNumber}`
-}
-
const allowDiscussions = () => {
return (
lesson.data?.membership ||
diff --git a/lms/hooks.py b/lms/hooks.py
index b2feb308..2b73b0cc 100644
--- a/lms/hooks.py
+++ b/lms/hooks.py
@@ -140,8 +140,25 @@ website_route_rules = [
website_redirects = [
{"source": "/update-profile", "target": "/edit-profile"},
- {"source": "/dashboard", "target": "/courses"},
- {"source": "/community", "target": "/people"},
+ {"source": "/courses", "target": "/lms/courses"},
+ {
+ "source": r"/courses/(.*)",
+ "target": "/lms/courses",
+ "match_with_query_string": True,
+ },
+ {"source": "/batches", "target": "/lms/batches"},
+ {
+ "source": r"/batches/(.*)",
+ "target": "/lms/batches",
+ "match_with_query_string": True,
+ },
+ {"source": "/job-openings", "target": "/lms/job-openings"},
+ {
+ "source": r"/job-openings/(.*)",
+ "target": "/lms/job-openings",
+ "match_with_query_string": True,
+ },
+ {"source": "/statistics", "target": "/lms/statistics"},
]
update_website_context = [
diff --git a/lms/install.py b/lms/install.py
index e77b577c..be100e99 100644
--- a/lms/install.py
+++ b/lms/install.py
@@ -16,11 +16,10 @@ def after_sync():
def add_pages_to_nav():
pages = [
{"label": "Explore", "idx": 1},
- {"label": "Courses", "url": "/courses", "parent": "Explore", "idx": 2},
- {"label": "Batches", "url": "/batches", "parent": "Explore", "idx": 3},
- {"label": "Statistics", "url": "/statistics", "parent": "Explore", "idx": 4},
- {"label": "Jobs", "url": "/job-openings", "parent": "Explore", "idx": 5},
- {"label": "People", "url": "/community", "parent": "Explore", "idx": 6},
+ {"label": "Courses", "url": "/lms/courses", "parent": "Explore", "idx": 2},
+ {"label": "Batches", "url": "/lms/batches", "parent": "Explore", "idx": 3},
+ {"label": "Statistics", "url": "/lms/statistics", "parent": "Explore", "idx": 4},
+ {"label": "Jobs", "url": "/lms/job-openings", "parent": "Explore", "idx": 5},
]
for page in pages:
diff --git a/lms/lms/doctype/cohort/cohort.py b/lms/lms/doctype/cohort/cohort.py
index 195b32d0..2d5c32ab 100644
--- a/lms/lms/doctype/cohort/cohort.py
+++ b/lms/lms/doctype/cohort/cohort.py
@@ -7,7 +7,7 @@ from frappe.model.document import Document
class Cohort(Document):
def get_url(self):
- return f"{frappe.utils.get_url()}/courses/{self.course}/cohorts/{self.slug}"
+ return f"{frappe.utils.get_url()}/lms/courses/{self.course}/cohorts/{self.slug}"
def get_subgroups(self, include_counts=False, sort_by=None):
names = frappe.get_all("Cohort Subgroup", filters={"cohort": self.name}, pluck="name")
diff --git a/lms/lms/doctype/cohort_subgroup/cohort_subgroup.py b/lms/lms/doctype/cohort_subgroup/cohort_subgroup.py
index f85db086..dd23d74a 100644
--- a/lms/lms/doctype/cohort_subgroup/cohort_subgroup.py
+++ b/lms/lms/doctype/cohort_subgroup/cohort_subgroup.py
@@ -13,13 +13,11 @@ class CohortSubgroup(Document):
def get_url(self):
cohort = frappe.get_doc("Cohort", self.cohort)
- return (
- f"{frappe.utils.get_url()}/courses/{self.course}/subgroups/{cohort.slug}/{self.slug}"
- )
+ return f"{frappe.utils.get_url()}/lms/courses/{self.course}/subgroups/{cohort.slug}/{self.slug}"
def get_invite_link(self):
cohort = frappe.get_doc("Cohort", self.cohort)
- return f"{frappe.utils.get_url()}/courses/{self.course}/join/{cohort.slug}/{self.slug}/{self.invite_code}"
+ return f"{frappe.utils.get_url()}/lms/courses/{self.course}/join/{cohort.slug}/{self.slug}/{self.invite_code}"
def has_student(self, email):
"""Check if given user is a student of this subgroup."""
diff --git a/lms/lms/doctype/lms_certificate/lms_certificate.js b/lms/lms/doctype/lms_certificate/lms_certificate.js
index 74cfeea8..9a469c6d 100644
--- a/lms/lms/doctype/lms_certificate/lms_certificate.js
+++ b/lms/lms/doctype/lms_certificate/lms_certificate.js
@@ -22,7 +22,7 @@ frappe.ui.form.on("LMS Certificate", {
refresh: (frm) => {
if (frm.doc.name)
frm.add_web_link(
- `/courses/${frm.doc.course}/${frm.doc.name}`,
+ `/lms/courses/${frm.doc.course}/${frm.doc.name}`,
"See on Website"
);
},
diff --git a/lms/lms/doctype/lms_course/lms_course.js b/lms/lms/doctype/lms_course/lms_course.js
index 71c6be3d..ab913d32 100644
--- a/lms/lms/doctype/lms_course/lms_course.js
+++ b/lms/lms/doctype/lms_course/lms_course.js
@@ -20,7 +20,7 @@ frappe.ui.form.on("LMS Course", {
});
},
refresh: (frm) => {
- frm.add_web_link(`/courses/${frm.doc.name}`, "See on Website");
+ frm.add_web_link(`/lms/courses/${frm.doc.name}`, "See on Website");
if (!frm.doc.currency)
frappe.db
diff --git a/lms/lms/doctype/lms_course/lms_course.py b/lms/lms/doctype/lms_course/lms_course.py
index 9065b639..b3520d9c 100644
--- a/lms/lms/doctype/lms_course/lms_course.py
+++ b/lms/lms/doctype/lms_course/lms_course.py
@@ -53,7 +53,7 @@ class LMSCourse(Document):
subject = self.title + " is available!"
args = {
"title": self.title,
- "course_link": f"/courses/{self.name}",
+ "course_link": f"/lms/courses/{self.name}",
"app_name": frappe.db.get_single_value("System Settings", "app_name"),
"site_url": frappe.utils.get_url(),
}
diff --git a/lms/lms/doctype/lms_mentor_request/lms_mentor_request.py b/lms/lms/doctype/lms_mentor_request/lms_mentor_request.py
index 95facc91..0e8c12a8 100644
--- a/lms/lms/doctype/lms_mentor_request/lms_mentor_request.py
+++ b/lms/lms/doctype/lms_mentor_request/lms_mentor_request.py
@@ -38,7 +38,7 @@ class LMSMentorRequest(Document):
email_template.response,
{
"member_name": frappe.db.get_value("User", frappe.session.user, "full_name"),
- "course_url": "/courses/" + course_details.slug,
+ "course_url": "/lms/courses/" + course_details.slug,
"course": course_details.title,
},
)
diff --git a/lms/lms/page/lms_home/lms_home.js b/lms/lms/page/lms_home/lms_home.js
index 4521b64d..35f91552 100644
--- a/lms/lms/page/lms_home/lms_home.js
+++ b/lms/lms/page/lms_home/lms_home.js
@@ -1,3 +1,3 @@
frappe.pages["lms-home"].on_page_load = function (wrapper) {
- window.location.href = "/courses";
+ window.location.href = "/lms/courses";
};
diff --git a/lms/lms/utils.py b/lms/lms/utils.py
index 85303ce0..0c309e28 100644
--- a/lms/lms/utils.py
+++ b/lms/lms/utils.py
@@ -290,7 +290,7 @@ def get_lesson_index(lesson_name):
def get_lesson_url(course, lesson_number):
if not lesson_number:
return
- return f"/courses/{course}/learn/{lesson_number}"
+ return f"/lms/courses/{course}/learn/{lesson_number}"
def get_batch(course, batch_name):
@@ -519,7 +519,7 @@ def first_lesson_exists(course):
def redirect_to_courses_list():
- frappe.local.flags.redirect_location = "/courses"
+ frappe.local.flags.redirect_location = "/lms/courses"
raise frappe.Redirect
@@ -1138,7 +1138,7 @@ def create_membership(course, payment):
{"member": frappe.session.user, "course": course, "payment": payment.name}
)
membership.save(ignore_permissions=True)
- return f"/courses/{course}/learn/1-1"
+ return f"/lms/courses/{course}/learn/1-1"
def add_student_to_batch(batchname, payment):
diff --git a/lms/lms/web_template/course_cards/course_cards.html b/lms/lms/web_template/course_cards/course_cards.html
index 6cf8974b..8eb3ab8a 100644
--- a/lms/lms/web_template/course_cards/course_cards.html
+++ b/lms/lms/web_template/course_cards/course_cards.html
@@ -11,7 +11,7 @@
{{ widgets.CourseCard(course=course, read_only=False) }}
{% endfor %}
-
+
{{ _("Explore More") }}
diff --git a/lms/patches.txt b/lms/patches.txt
index a9082ad4..a274046d 100644
--- a/lms/patches.txt
+++ b/lms/patches.txt
@@ -84,4 +84,5 @@ lms.patches.v1_0.batch_tabs_settings
execute:frappe.delete_doc("Notification", "Assignment Submission Notification")
lms.patches.v1_0.change_jobs_url #19-01-2024
lms.patches.v1_0.custom_perm_for_discussions #14-01-2024
-lms.patches.v1_0.rename_evaluator_role
\ No newline at end of file
+lms.patches.v1_0.rename_evaluator_role
+lms.patches.v1_0.change_navbar_urls
\ No newline at end of file
diff --git a/lms/patches/v1_0/change_navbar_urls.py b/lms/patches/v1_0/change_navbar_urls.py
new file mode 100644
index 00000000..8bded0fe
--- /dev/null
+++ b/lms/patches/v1_0/change_navbar_urls.py
@@ -0,0 +1,23 @@
+import frappe
+
+
+def execute():
+ rename_link("/courses", "/lms/courses")
+ rename_link("/batches", "/lms/batches")
+ rename_link("/statistics", "/lms/statistics")
+ rename_link("/job-openings", "/lms/job-openings")
+ delete_link("/people")
+
+
+def rename_link(source, target):
+ link = frappe.db.exists("Top Bar Item", {"url": source})
+
+ if link:
+ frappe.db.set_value("Top Bar Item", link, "url", target)
+
+
+def delete_link(source):
+ link = frappe.db.exists("Top Bar Item", {"url": source})
+
+ if link:
+ frappe.delete_doc("Top Bar Item", link)
diff --git a/lms/www/lms.py b/lms/www/lms.py
index 58c8f987..4272adc6 100644
--- a/lms/www/lms.py
+++ b/lms/www/lms.py
@@ -1,15 +1,18 @@
import frappe
from frappe.utils.telemetry import capture
from frappe import _
+import re
no_cache = 1
def get_context():
app_path = frappe.form_dict.get("app_path")
- print(app_path)
context = frappe._dict()
- context.meta = get_meta(app_path)
+ if app_path:
+ context.meta = get_meta(app_path)
+ else:
+ context.meta = {}
csrf_token = frappe.sessions.get_csrf_token()
frappe.db.commit()
context.csrf_token = csrf_token
@@ -26,6 +29,45 @@ def get_meta(app_path):
"description": "This page lists all the courses published on our website",
"keywords": "All Courses, Courses, Learn",
}
+
+ if re.match(r"^courses/.*$", app_path):
+ course_name = app_path.split("/")[1]
+ course = frappe.db.get_value(
+ "LMS Course",
+ course_name,
+ ["title", "image", "short_introduction", "tags"],
+ as_dict=True,
+ )
+ return {
+ "title": course.title,
+ "image": course.image,
+ "description": course.short_introduction,
+ "keywords": course.tags,
+ }
+
+ if app_path == "batches":
+ return {
+ "title": _("Batches"),
+ "image": frappe.db.get_single_value("Website Settings", "banner_image"),
+ "description": "This page lists all the batches published on our website",
+ "keywords": "All Batches, Batches, Learn",
+ }
+
+ if re.match(r"^batches/.*$", app_path):
+ batch_name = app_path.split("/")[2]
+ batch = frappe.db.get_value(
+ "LMS Batch",
+ batch_name,
+ ["title", "meta_image", "description", "category", "medium"],
+ as_dict=True,
+ )
+ return {
+ "title": batch.title,
+ "image": batch.meta_image,
+ "description": batch.description,
+ "keywords": f"{batch.category} {batch.medium}",
+ }
+
if app_path == "job-openings":
return {
"title": _("Job Openings"),
@@ -33,3 +75,25 @@ def get_meta(app_path):
"description": "This page lists all the job openings published on our website",
"keywords": "Job Openings, Jobs, Vacancies",
}
+
+ if re.match(r"^job-openings/.*$", app_path):
+ job_opening_name = app_path.split("/")[1]
+ job_opening = frappe.db.get_value(
+ "Job Opportunity",
+ job_opening_name,
+ ["job_title", "company_logo", "company_name"],
+ as_dict=True,
+ )
+ return {
+ "title": job_opening.title,
+ "image": job_opening.company_logo,
+ "description": job_opening.company_name,
+ }
+
+ if app_path == "statistics":
+ return {
+ "title": _("Statistics"),
+ "image": frappe.db.get_single_value("Website Settings", "banner_image"),
+ "description": "This page lists all the statistics of this platform",
+ "keywords": "Enrollment Count, Completion, Signups",
+ }