From 8fff1cd81703520b15db3d2f23d1231d99f871a5 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Mon, 10 Jan 2022 21:39:26 +0530 Subject: [PATCH 1/6] fix: jobs ui --- school/job/doctype/job_settings/__init__.py | 0 .../job/doctype/job_settings/job_settings.js | 8 ++++ .../doctype/job_settings/job_settings.json | 42 +++++++++++++++++++ .../job/doctype/job_settings/job_settings.py | 8 ++++ .../doctype/job_settings/test_job_settings.py | 8 ++++ school/public/css/style.css | 29 ++++++------- school/www/jobs/index.html | 39 +++++++++++------ school/www/jobs/index.py | 2 +- school/www/jobs/job.html | 31 ++++++++------ 9 files changed, 125 insertions(+), 42 deletions(-) create mode 100644 school/job/doctype/job_settings/__init__.py create mode 100644 school/job/doctype/job_settings/job_settings.js create mode 100644 school/job/doctype/job_settings/job_settings.json create mode 100644 school/job/doctype/job_settings/job_settings.py create mode 100644 school/job/doctype/job_settings/test_job_settings.py diff --git a/school/job/doctype/job_settings/__init__.py b/school/job/doctype/job_settings/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/school/job/doctype/job_settings/job_settings.js b/school/job/doctype/job_settings/job_settings.js new file mode 100644 index 00000000..7234fdf2 --- /dev/null +++ b/school/job/doctype/job_settings/job_settings.js @@ -0,0 +1,8 @@ +// Copyright (c) 2022, Frappe and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Job Settings', { + // refresh: function(frm) { + + // } +}); diff --git a/school/job/doctype/job_settings/job_settings.json b/school/job/doctype/job_settings/job_settings.json new file mode 100644 index 00000000..aac7e3aa --- /dev/null +++ b/school/job/doctype/job_settings/job_settings.json @@ -0,0 +1,42 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2022-01-10 17:16:46.598673", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "allow_posting" + ], + "fields": [ + { + "default": "0", + "fieldname": "allow_posting", + "fieldtype": "Check", + "label": "Allow Job Posting From Website" + } + ], + "index_web_pages_for_search": 1, + "issingle": 1, + "links": [], + "modified": "2022-01-10 18:45:26.646438", + "modified_by": "Administrator", + "module": "Job", + "name": "Job Settings", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "print": 1, + "read": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "states": [] +} \ No newline at end of file diff --git a/school/job/doctype/job_settings/job_settings.py b/school/job/doctype/job_settings/job_settings.py new file mode 100644 index 00000000..48d20ea9 --- /dev/null +++ b/school/job/doctype/job_settings/job_settings.py @@ -0,0 +1,8 @@ +# Copyright (c) 2022, Frappe and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class JobSettings(Document): + pass diff --git a/school/job/doctype/job_settings/test_job_settings.py b/school/job/doctype/job_settings/test_job_settings.py new file mode 100644 index 00000000..65294592 --- /dev/null +++ b/school/job/doctype/job_settings/test_job_settings.py @@ -0,0 +1,8 @@ +# Copyright (c) 2022, Frappe and Contributors +# See license.txt + +# import frappe +import unittest + +class TestJobSettings(unittest.TestCase): + pass diff --git a/school/public/css/style.css b/school/public/css/style.css index 1786a37d..6cabda07 100644 --- a/school/public/css/style.css +++ b/school/public/css/style.css @@ -63,9 +63,8 @@ input[type=checkbox] { text-align: center; letter-spacing: 0.011em; text-transform: uppercase; - color: #2C5477; font-weight: bold; - box-shadow: 0px 5px 10px rgb(0 0 0 / 10%); + box-shadow: var(--shadow-base); } .dark-pills { @@ -119,9 +118,7 @@ input[type=checkbox] { .card-heading { font-weight: 600; - font-size: 1.5rem; - line-height: 156%; - letter-spacing: -0.014em; + font-size: var(--text-3xl); color: var(--text-color-dark); } @@ -1478,20 +1475,20 @@ pre { .job-card { display: flex; - justify-content: space-between; - align-items: center; - padding-right: 1rem; -} - -.job-card-info { - padding: 2rem 1rem 1rem; -} - -.job-description-section { padding: 1rem; } +.job-card-info { + padding: 0 1.5rem; + flex: 1; +} + .company-logo { - background-position: left; + background-position: center; background-size: 88px; } + +.job-card-parent { + display: grid; + row-gap: 1rem; +} diff --git a/school/www/jobs/index.html b/school/www/jobs/index.html index dcf2af68..1d28fcd9 100644 --- a/school/www/jobs/index.html +++ b/school/www/jobs/index.html @@ -3,32 +3,47 @@ {% block title %}{{ _('Job Openings') }}{% endblock %} {% block content %} +{% set allow_posting = frappe.db.get_single_value("Job Settings", "allow_posting") %}
- {{ _("Post a Job") }} + + {% if allow_posting and jobs | length %} + {{ _("Post a Job") }} + {% endif %} +
{{ _("Job Openings") }}
-
+ {% if jobs | length %} +
{% for job in jobs %}
-
-
-
{{ _(job.type) }}
-
{{ job.location }}
-
-
-
{{ _(job.job_title) }}
- {{ job.company_name }} -
-
+
+
+
{{ _(job.type) }}
+
{{ job.location }}
+
+
{{ _(job.job_title) }}
+
{{ job.company_name }}
+
+
Posted on: {{ frappe.utils.format_date(job.creation, "medium") }}
{% endfor %}
+ {% else %} +
+ +
{{ _("No open positions") }}
+
{{ _("There are no job openings available.") }}
+ {% if allow_posting %} + {{ _("Post a Job") }} + {% endif %} +
+ {% endif %}
{% endblock %} diff --git a/school/www/jobs/index.py b/school/www/jobs/index.py index 1870ae0e..c1534e15 100644 --- a/school/www/jobs/index.py +++ b/school/www/jobs/index.py @@ -8,7 +8,7 @@ def get_context(context): }, [ "job_title", "location", "type", "company_name", - "company_logo", "name" + "company_logo", "name", "creation" ], order_by="creation desc") diff --git a/school/www/jobs/job.html b/school/www/jobs/job.html index e733fb8c..e692127c 100644 --- a/school/www/jobs/job.html +++ b/school/www/jobs/job.html @@ -8,23 +8,28 @@
{{ BreadCrumb(job) }}
-
-
- -
{{ _(job.type) }}
-
{{ job.location }}
-
-
-
{{ _(job.job_title) }}
- {{ job.company_name }} -
Posted On: {{ frappe.utils.format_date(job.creation, "medium") }}
-
-
+
+
+ +
{{ _(job.type) }}
+
{{ job.location }}
+
+
+
{{ _(job.job_title) }}
+ {{ job.company_name }} +
+
+
+
Posted On: {{ frappe.utils.format_date(job.creation, "medium") }}
+ Edit +
+
-
+ +
{{ _(job.description) }}
{{ _("Apply Now") }}
From e214573cd10f16cc62af11b247e567b3493108ea Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Tue, 11 Jan 2022 15:10:31 +0530 Subject: [PATCH 2/6] fix: job reporting --- .../job_opportunity/job_opportunity.json | 19 +++--- .../job_opportunity/job_opportunity.py | 23 ++++++- school/public/css/style.css | 14 +++- school/templates/emails/job_report.html | 7 ++ school/templates/job_card.html | 21 ++++++ school/www/community/index.html | 1 - school/www/courses/index.html | 1 - school/www/jobs/index.html | 21 ++---- school/www/jobs/index.py | 4 +- school/www/jobs/job.html | 68 ++++++++++++------- school/www/jobs/job.js | 27 ++++++++ 11 files changed, 147 insertions(+), 59 deletions(-) create mode 100644 school/templates/emails/job_report.html create mode 100644 school/templates/job_card.html create mode 100644 school/www/jobs/job.js diff --git a/school/job/doctype/job_opportunity/job_opportunity.json b/school/job/doctype/job_opportunity/job_opportunity.json index 60331764..6397d2a1 100644 --- a/school/job/doctype/job_opportunity/job_opportunity.json +++ b/school/job/doctype/job_opportunity/job_opportunity.json @@ -9,10 +9,10 @@ "field_order": [ "job_title", "location", + "disabled", "column_break_5", "type", "status", - "job_opportunity_status", "section_break_6", "description", "company_details_section", @@ -51,19 +51,12 @@ "reqd": 1 }, { - "default": "Pending", + "default": "Open", "fieldname": "status", "fieldtype": "Select", "in_list_view": 1, "in_standard_filter": 1, "label": "Status", - "options": "Pending\nApproved\nRejected" - }, - { - "default": "Open", - "fieldname": "job_opportunity_status", - "fieldtype": "Select", - "label": "Job Opportunity Status", "options": "Open\nClosed" }, { @@ -109,11 +102,17 @@ "fieldtype": "Data", "label": "Application Form Link", "reqd": 1 + }, + { + "default": "0", + "fieldname": "disabled", + "fieldtype": "Check", + "label": "Disabled" } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2021-12-30 12:10:08.849547", + "modified": "2022-01-11 14:56:42.509351", "modified_by": "Administrator", "module": "Job", "name": "Job Opportunity", diff --git a/school/job/doctype/job_opportunity/job_opportunity.py b/school/job/doctype/job_opportunity/job_opportunity.py index 994f6e29..3812910e 100644 --- a/school/job/doctype/job_opportunity/job_opportunity.py +++ b/school/job/doctype/job_opportunity/job_opportunity.py @@ -1,8 +1,29 @@ # Copyright (c) 2021, Frappe and contributors # For license information, please see license.txt -# import frappe +import frappe from frappe.model.document import Document +from frappe.utils.user import get_system_managers +from frappe import _ +from frappe.utils import get_link_to_form class JobOpportunity(Document): pass + +@frappe.whitelist() +def report(job, reason): + args = { + "job": job, + "job_url": get_link_to_form("Job Opportunity", job), + "user": frappe.session.user + } + system_managers = get_system_managers(only_name=True) + user = frappe.db.get_value("User", frappe.session.user, "full_name") + subject = _("User {0} has reported the job post {1}").format(user, job) + frappe.sendmail( + recipients = system_managers, + subject=subject, + header=[subject, "green"], + template = "job_report", + args=args, + now=True) diff --git a/school/public/css/style.css b/school/public/css/style.css index 6cabda07..ad2f83f8 100644 --- a/school/public/css/style.css +++ b/school/public/css/style.css @@ -1479,16 +1479,26 @@ pre { } .job-card-info { - padding: 0 1.5rem; flex: 1; } .company-logo { background-position: center; - background-size: 88px; + background-size: 37px; } .job-card-parent { display: grid; row-gap: 1rem; } + +.job-card-logo-section { + display: flex; + flex-direction: column; + align-items: flex-end; + justify-content: space-between; +} + +.job-detail-card { + flex-direction: column; +} diff --git a/school/templates/emails/job_report.html b/school/templates/emails/job_report.html new file mode 100644 index 00000000..82896d36 --- /dev/null +++ b/school/templates/emails/job_report.html @@ -0,0 +1,7 @@ +{% set job_link = "" + job + "" %} + + +

{{ _("Hey,") }}

+

{{ _("{0} has reported a job post for the following reason.").format(user) }}

+

{{ reason }}

+

{{ _("Please take appropriate action at {0}").format(job_link) }}

diff --git a/school/templates/job_card.html b/school/templates/job_card.html new file mode 100644 index 00000000..1ad7ec7c --- /dev/null +++ b/school/templates/job_card.html @@ -0,0 +1,21 @@ +
+
+
+
{{ _(job.type) }}
+
{{ job.location }}
+
+
{{ _(job.job_title) }}
+ + {% if show_edit_link and job.owner == frappe.session.user %} + Edit + {% endif %} +
+
+
Posted on: {{ frappe.utils.format_date(job.creation, "medium") }}
+
+ +
+
+
diff --git a/school/www/community/index.html b/school/www/community/index.html index f8f15e09..78027e14 100644 --- a/school/www/community/index.html +++ b/school/www/community/index.html @@ -1,5 +1,4 @@ {% extends "templates/base.html" %} -{% from "www/hackathons/macros/card.html" import null_card %} {% block title %}{{ _('Community') }}{% endblock %} {% block content %} diff --git a/school/www/courses/index.html b/school/www/courses/index.html index ea9d53d4..0f1139df 100644 --- a/school/www/courses/index.html +++ b/school/www/courses/index.html @@ -1,5 +1,4 @@ {% extends "templates/base.html" %} -{% from "www/hackathons/macros/card.html" import null_card %} {% block title %}{{ 'Courses' }}{% endblock %} {% block head_include %}