Merge branch 'main' of https://github.com/frappe/school into members-page

This commit is contained in:
Jannat Patel
2022-01-03 16:36:23 +05:30
36 changed files with 644 additions and 34 deletions

View File

@@ -192,10 +192,7 @@ var submit_review = (e) => {
callback: (data) => {
if (data.message == "OK") {
$(".review-modal").modal("hide");
frappe.msgprint("Thanks for providing your feedback!");
setTimeout(() => {
window.location.reload();
}, 2000);
window.location.reload();
}
}
})

View File

View File

@@ -0,0 +1,34 @@
{% extends "templates/base.html" %}
{% from "www/hackathons/macros/card.html" import null_card %}
{% block title %}{{ _('Job Openings') }}{% endblock %}
{% block content %}
<div class="common-page-style">
<div class="container">
<a class="button is-primary pull-right" href="/job-opportunity">{{ _("Post a Job") }}</a>
<div class="course-home-headings">{{ _("Job Openings") }}</div>
<div class="cards-parent">
{% for job in jobs %}
<div class="common-card-style course-card">
<div class="job-card">
<div>
<div class="course-tags">
<div class="course-card-pills">{{ _(job.type) }}</div>
<div class="course-card-pills">{{ job.location }}</div>
</div>
<div class="job-card-info">
<div class="bold-title">{{ _(job.job_title) }}</div>
<small>{{ job.company_name }}</small>
</div>
</div>
<div class="avatar avatar-large" title="{{ job.company_name}}">
<span class="avatar-frame company-logo" style="background-image: url( {{ job.company_logo | urlencode }} );"></span>
</div>
</div>
<a class="stretched-link" href="/jobs/{{ job.name }}"></a>
</div>
{% endfor %}
</div>
</div>
</div>
{% endblock %}

14
school/www/jobs/index.py Normal file
View File

@@ -0,0 +1,14 @@
import frappe
def get_context(context):
context.jobs = frappe.get_all("Job Opportunity",
{
"status": "Approved",
"job_opportunity_status": "Open"
},
[
"job_title", "location", "type", "company_name",
"company_logo", "name"
],
order_by="creation desc")

43
school/www/jobs/job.html Normal file
View File

@@ -0,0 +1,43 @@
{% extends "templates/base.html" %}
{% from "www/hackathons/macros/card.html" import null_card %}
{% block title %}{{ _(job.job_title) }}{% endblock %}
{% block content %}
<div class="common-page-style">
<div class="container">
{{ BreadCrumb(job) }}
<div class="common-card-style thread-card">
<div class="job-card">
<div>
<span class="course-tags">
<div class="course-card-pills">{{ _(job.type) }}</div>
<div class="course-card-pills">{{ job.location }}</div>
</span>
<div class="job-card-info">
<div class="card-heading">{{ _(job.job_title) }}</div>
<a class="dark-links" href="{{ job.company_website }}">{{ job.company_name }}</a>
<div class="small mt-1">Posted On: {{ frappe.utils.format_date(job.creation, "medium") }}</div>
</div>
</div>
<div class="avatar avatar-large" title="{{ job.company_name}}">
<span class="avatar-frame company-logo" style="background-image: url( {{ job.company_logo | urlencode }} );"></span>
</div>
</div>
<div class="job-description-section">
<div>{{ _(job.description) }}</div>
<a class="button is-primary mt-5" href="{{ job.application_link }}">{{ _("Apply Now") }}</a>
</div>
</div>
</div>
</div>
{% endblock %}
{% macro BreadCrumb(job) %}
<div class="breadcrumb">
<a class="dark-links" href="/jobs">{{ _("Job Openings") }}</a>
<img class="ml-1 mr-1" src="/assets/school/icons/chevron-right.svg">
<span class="muted-text">{{ _(job.job_title) }}</span>
</div>
{% endmacro %}

9
school/www/jobs/job.py Normal file
View File

@@ -0,0 +1,9 @@
import frappe
def get_context(context):
try:
job = frappe.form_dict["job"]
except KeyError:
frappe.local.flags.redirect_location = "/jobs"
raise frappe.Redirect
context.job = frappe.get_doc("Job Opportunity", job)

View File

@@ -32,6 +32,9 @@
{% if member.get_authored_courses() | length %}
<div class="creator-badge"> Creator </div>
{% endif %}
{% if member.looking_for_job %}
<div class="creator-badge"> Open Network </div>
{% endif %}
</div>
{% if frappe.session.user == member.email %}
@@ -78,20 +81,20 @@
<div class="common-card-style overview-card small-title">
{% if enrollment %}
<div class="overview-item">
<img class="icon-background mr-1" src="/assets/school/icons/user.svg" />
{{ enrollment }} Enrolled
<img class="mr-1" src="/assets/school/icons/course.svg" />
<span> {{ enrollment }} {% if enrollment > 1 %} Courses {% else %} Course {% endif %} Taken </span>
</div>
{% endif %}
{% if reviews %}
<div class="overview-item">
<img class="icon-background mr-1" src="/assets/school/icons/rating.svg" />
{{ reviews }} Created
<img class="mr-1" src="/assets/school/icons/rating.svg" />
<span> {{ reviews }} {% if reviews > 1 %} Courses {% else %} Course {% endif %} Reviewed </span>
</div>
{% endif %}
{% if mentorship %}
<div class="overview-item">
<img class="icon-background mr-1" src="/assets/school/icons/calendar.svg" />
{{ mentorship }} Mentored
<img class="mr-1" src="/assets/school/icons/calendar.svg" />
<span> {{ mentorship }} {% if mentorship > 1 %} Courses {% else %} Course {% endif %} Mentored </span>
</div>
{% endif %}
</div>
@@ -235,6 +238,7 @@
{% endmacro %}
{% macro Contact(member) %}
{% if show_contacts_section %}
<div class="education-details">
<div class="course-home-headings"> {{ _("Contact") }} </div>
<div class="common-card-style overview-card">
@@ -266,6 +270,7 @@
{% endif %}
</div>
</div>
{% endif %}
{% endmacro %}
{% macro Skills(member) %}
@@ -288,7 +293,7 @@
<div class="common-card-style profile-card">
{% for edu in member.education %}
<div class="profile-card-row">
<div class="institute-name"> {{ edu.institution_name }} </div>
<div class="bold-title"> {{ edu.institution_name }} </div>
<div class="profile-item"> {{ edu.degree_type }} <span></span> {{ edu.major }}
{% if not member.hide_private %}
<!-- {% if edu.grade_type %} {{ edu.grade_type }} {% endif %} -->
@@ -316,7 +321,7 @@
<div class="common-card-style profile-card">
{% for work in work_details %}
<div class="">
<div class="institute-name"> {{ work.title }} </div>
<div class="bold-title"> {{ work.title }} </div>
<div class="profile-item"> {{ work.company }} </div>
<div> {{ frappe.utils.format_date(work.from_date, "MMM YYYY") }} -
{% if work.to_date %} {{ frappe.utils.format_date(work.to_date, "MMM YYYY") }} {% else %} Present {% endif %} </div>
@@ -336,7 +341,7 @@
<div class="common-card-style profile-card">
{% for cert in member.certification %}
<div class="">
<div class="institute-name"> {{ cert.certification_name }} </div>
<div class="bold-title"> {{ cert.certification_name }} </div>
<div class="profile-item"> {{ cert.organization }} </div>
<div> {{ frappe.utils.format_date(cert.issue_date, "MMM YYYY") }}
{% if cert.expiration_date %} - {{ frappe.utils.format_date(cert.expiration_date, "MMM YYYY") }} {% endif %} </div>

View File

@@ -18,8 +18,16 @@ def get_context(context):
context.template = "www/404.html"
return
context.hide_primary_contact = frappe.db.get_single_value("LMS Settings", "hide_primary_contact")
context.show_contacts_section = show_contacts_section(context.member, context.hide_primary_contact)
context.profile_tabs = get_profile_tabs(context.member)
def show_contacts_section(member, hide_primary_contact):
if member.github or member.linkedin or member.medium:
return True
if hide_primary_contact or member.hide_private:
return False
return True
def get_profile_tabs(user):
"""Returns the enabled ProfileTab objects.