From 3070cbed3c40c8740e76bf2671baad95ddaed5fd Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Wed, 17 Jan 2024 11:00:31 +0530 Subject: [PATCH] fix: changed jobs route to job-openings --- lms/hooks.py | 3 ++- lms/install.py | 2 +- .../doctype/job_opportunity/job_opportunity.js | 2 +- .../web_form/job_opportunity/job_opportunity.js | 2 +- .../web_form/job_opportunity/job_opportunity.json | 4 ++-- lms/patches.txt | 3 ++- lms/patches/v1_0/change_jobs_url.py | 15 +++++++++++++++ lms/www/{jobs => jobs_openings}/__init__.py | 0 lms/www/{jobs => jobs_openings}/index.html | 2 +- lms/www/{jobs => jobs_openings}/index.py | 0 lms/www/{jobs => jobs_openings}/job.html | 4 ++-- lms/www/{jobs => jobs_openings}/job.js | 2 +- lms/www/{jobs => jobs_openings}/job.py | 2 +- 13 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 lms/patches/v1_0/change_jobs_url.py rename lms/www/{jobs => jobs_openings}/__init__.py (100%) rename lms/www/{jobs => jobs_openings}/index.html (96%) rename lms/www/{jobs => jobs_openings}/index.py (100%) rename lms/www/{jobs => jobs_openings}/job.html (97%) rename lms/www/{jobs => jobs_openings}/job.js (92%) rename lms/www/{jobs => jobs_openings}/job.py (89%) diff --git a/lms/hooks.py b/lms/hooks.py index 0e2b3adfb..f4cf919df 100644 --- a/lms/hooks.py +++ b/lms/hooks.py @@ -173,7 +173,8 @@ "to_route": "cohorts/join", }, {"from_route": "/users", "to_route": "profiles/profile"}, - {"from_route": "/jobs/", "to_route": "jobs/job"}, + {"from_route": "/job-openings", "to_route": "jobs_openings/index"}, + {"from_route": "/job-openings/", "to_route": "jobs_openings/job"}, { "from_route": "/batches//students/", "to_route": "/batches/progress", diff --git a/lms/install.py b/lms/install.py index cd74c28d3..e77b577cd 100644 --- a/lms/install.py +++ b/lms/install.py @@ -19,7 +19,7 @@ def add_pages_to_nav(): {"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": "/jobs", "parent": "Explore", "idx": 5}, + {"label": "Jobs", "url": "/job-openings", "parent": "Explore", "idx": 5}, {"label": "People", "url": "/community", "parent": "Explore", "idx": 6}, ] diff --git a/lms/job/doctype/job_opportunity/job_opportunity.js b/lms/job/doctype/job_opportunity/job_opportunity.js index e82daaa70..bfc6891fa 100644 --- a/lms/job/doctype/job_opportunity/job_opportunity.js +++ b/lms/job/doctype/job_opportunity/job_opportunity.js @@ -4,6 +4,6 @@ frappe.ui.form.on("Job Opportunity", { refresh: (frm) => { if (frm.doc.name) - frm.add_web_link(`/jobs/${frm.doc.name}`, "See on Website"); + frm.add_web_link(`/job-openings/${frm.doc.name}`, "See on Website"); }, }); diff --git a/lms/job/web_form/job_opportunity/job_opportunity.js b/lms/job/web_form/job_opportunity/job_opportunity.js index ac3bce91d..dca594ee9 100644 --- a/lms/job/web_form/job_opportunity/job_opportunity.js +++ b/lms/job/web_form/job_opportunity/job_opportunity.js @@ -1,7 +1,7 @@ frappe.ready(function () { frappe.web_form.after_save = () => { setTimeout(() => { - window.location.href = `/jobs`; + window.location.href = `/job-openings`; }); }; }); diff --git a/lms/job/web_form/job_opportunity/job_opportunity.json b/lms/job/web_form/job_opportunity/job_opportunity.json index f54dc5572..07800661b 100644 --- a/lms/job/web_form/job_opportunity/job_opportunity.json +++ b/lms/job/web_form/job_opportunity/job_opportunity.json @@ -20,7 +20,7 @@ "list_columns": [], "login_required": 1, "max_attachment_size": 0, - "modified": "2022-09-15 17:22:43.957184", + "modified": "2022-09-15 17:22:43.957185", "modified_by": "Administrator", "module": "Job", "name": "job-opportunity", @@ -32,7 +32,7 @@ "show_list": 1, "show_sidebar": 0, "success_message": "", - "success_url": "/jobs", + "success_url": "/job-openings", "title": "Job Opportunity", "web_form_fields": [ { diff --git a/lms/patches.txt b/lms/patches.txt index 4e9db7127..85d1485c8 100644 --- a/lms/patches.txt +++ b/lms/patches.txt @@ -81,4 +81,5 @@ lms.patches.v1_0.create_batch_source [post_model_sync] lms.patches.v1_0.batch_tabs_settings -execute:frappe.delete_doc("Notification", "Assignment Submission Notification") \ No newline at end of file +execute:frappe.delete_doc("Notification", "Assignment Submission Notification") +lms.patches.v1_0.change_jobs_url #17-01-2024 \ No newline at end of file diff --git a/lms/patches/v1_0/change_jobs_url.py b/lms/patches/v1_0/change_jobs_url.py new file mode 100644 index 000000000..c7b3c6736 --- /dev/null +++ b/lms/patches/v1_0/change_jobs_url.py @@ -0,0 +1,15 @@ +import frappe + + +def execute(): + jobs_link = frappe.db.exists( + "Top Bar Item", + { + "label": "Jobs", + "url": "/jobs", + "parent_label": "Explore", + }, + ) + + if jobs_link: + frappe.db.set_value("Top Bar Item", jobs_link, "url", "/job-openings") diff --git a/lms/www/jobs/__init__.py b/lms/www/jobs_openings/__init__.py similarity index 100% rename from lms/www/jobs/__init__.py rename to lms/www/jobs_openings/__init__.py diff --git a/lms/www/jobs/index.html b/lms/www/jobs_openings/index.html similarity index 96% rename from lms/www/jobs/index.html rename to lms/www/jobs_openings/index.html index da82e70fd..9f2fd5be2 100644 --- a/lms/www/jobs/index.html +++ b/lms/www/jobs_openings/index.html @@ -37,7 +37,7 @@
{{ frappe.utils.format_date(job.creation, "medium") }}
- + {% endfor %} diff --git a/lms/www/jobs/index.py b/lms/www/jobs_openings/index.py similarity index 100% rename from lms/www/jobs/index.py rename to lms/www/jobs_openings/index.py diff --git a/lms/www/jobs/job.html b/lms/www/jobs_openings/job.html similarity index 97% rename from lms/www/jobs/job.html rename to lms/www/jobs_openings/job.html index 9e1db41cc..488cf493c 100644 --- a/lms/www/jobs/job.html +++ b/lms/www/jobs_openings/job.html @@ -33,7 +33,7 @@ - {% set application_link = job.application_link if frappe.session.user != 'Guest' else '/login?redirect-to=/jobs/' + job.name %} + {% set application_link = job.application_link if frappe.session.user != 'Guest' else '/login?redirect-to=/job-openings/' + job.name %}
{{ _("Apply") }}
{{ _("Report") }}
@@ -94,7 +94,7 @@ {% macro BreadCrumb(job) %} diff --git a/lms/www/jobs/job.js b/lms/www/jobs_openings/job.js similarity index 92% rename from lms/www/jobs/job.js rename to lms/www/jobs_openings/job.js index 19a81e52d..b776adbb6 100644 --- a/lms/www/jobs/job.js +++ b/lms/www/jobs_openings/job.js @@ -11,7 +11,7 @@ frappe.ready(() => { const open_report_dialog = (e) => { e.preventDefault(); if (frappe.session.user == "Guest") { - window.location.href = `/login?redirect-to=/jobs/${$( + window.location.href = `/login?redirect-to=/job-openings/${$( e.currentTarget ).data("job")}`; return; diff --git a/lms/www/jobs/job.py b/lms/www/jobs_openings/job.py similarity index 89% rename from lms/www/jobs/job.py rename to lms/www/jobs_openings/job.py index 5d91c4bda..d5746d3f3 100644 --- a/lms/www/jobs/job.py +++ b/lms/www/jobs_openings/job.py @@ -5,7 +5,7 @@ def get_context(context): try: job = frappe.form_dict["job"] except KeyError: - frappe.local.flags.redirect_location = "/jobs" + frappe.local.flags.redirect_location = "/job-openings" raise frappe.Redirect context.job = frappe.get_doc("Job Opportunity", job)