[IMP] Cleaning Jobs + Small Imp Event layout

bzr revid: fp@openerp.com-20131111183638-w7o1tsbo1shxzptk
This commit is contained in:
Fabien Pinckaers
2013-11-11 19:36:38 +01:00
parent 70338369a9
commit c8fb0335a5
5 changed files with 136 additions and 91 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

+4 -4
View File
@@ -89,14 +89,14 @@
<div class="row">
<div class="col-md-12 mb16">
<div class="oe_demo">
<img src="http://ebmedia.eventbrite.com/s3-build/17022-rc2013-11-04-acfb89e/django/images/pages/home/featcats_bizpro.jpg"/>
<div class="text-center"><a href="/">Photos of Events</a></div>
<img src="/website_event/static/src/img/openerp_enterprise_of_the_year.png" class="img-rounded"/>
<div class="text-center"><a href="/event">Photos of Past Events</a></div>
</div>
</div>
<div class="col-md-12 mb16">
<div class="oe_demo">
<img src="http://ebmedia.eventbrite.com/s3-build/17022-rc2013-11-04-acfb89e/django/images/pages/home/featcats_bizpro.jpg"/>
<div class="text-center"><a href="/">Customer Quotes</a></div>
<img src="/website_event/static/src/img/training.jpg" class="img-rounded"/>
<div class="text-center"><a href="/event">Our Trainings</a></div>
</div>
</div>
</div>
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from openerp.addons.web import http
from openerp.tools.translate import _
from openerp.addons.web.http import request
from openerp.addons.website.models import website
from openerp.addons.website.controllers.main import Website as controllers
@@ -10,45 +11,16 @@ import base64
class website_hr_recruitment(http.Controller):
@website.route(['/jobs', '/jobs/page/<int:page>/', '/department/<id>/', '/department/<id>/page/<int:page>/'], type='http', auth="public", multilang=True)
def jobs(self, id=0, page=1):
id = id and int(id) or 0
@website.route(['/jobs', '/department/<model("hr.department"):id>'], type='http', auth="public", multilang=True)
def jobs(self, department=None, page=0):
hr_job_obj = request.registry['hr.job']
hr_department_obj = request.registry['hr.department']
domain = [("state", 'in', ['recruit', 'open'])]
if id != 0:
domain += [('department_id','=', id)]
jobpost_ids = hr_job_obj.search(request.cr, request.uid, domain)
request.cr.execute("SELECT DISTINCT(hr_job.company_id) FROM hr_job WHERE hr_job.company_id IS NOT NULL")
ids = []
for i in request.cr.fetchall():
ids.append(i[0])
companies = request.registry['res.company'].browse(request.cr, request.uid, ids)
vals = {}
for rec in hr_job_obj.browse(request.cr, request.uid, jobpost_ids):
vals[rec.id] = {'count': int(rec.no_of_recruitment), 'date_recruitment': rec.write_date.split(' ')[0]}
department_ids = []
request.cr.execute("SELECT * FROM hr_department")
for i in request.cr.fetchall():
department_ids.append(i[0])
active = id
step = 10
pager = request.website.pager(url="/jobs/", total=len(jobpost_ids), page=page, step=step, scope=5)
jobpost_ids = hr_job_obj.search(request.cr, request.uid, domain, limit=step, offset=pager['offset'])
values = {
'active': active,
'companies': companies,
'res_job': hr_job_obj.browse(request.cr, request.uid, jobpost_ids),
'departments': hr_department_obj.browse(request.cr, request.uid, department_ids),
'vals': vals,
'pager': pager
}
return request.website.render("website_hr_recruitment.index", values)
domain = []
if department:
domain += [('department_id','=', department.id)]
jobpost_ids = hr_job_obj.search(request.cr, request.uid, domain, order="website_published,no_of_recruitment", context=request.context)
return request.website.render("website_hr_recruitment.index", {
'jobs': hr_job_obj.browse(request.cr, request.uid, jobpost_ids, request.context),
})
@website.route(['/job/detail/<model("hr.job"):job>'], type='http', auth="public", multilang=True)
def detail(self, job):
@@ -60,7 +32,24 @@ class website_hr_recruitment(http.Controller):
@website.route(['/job/success'], type='http', auth="admin", multilang=True)
def success(self, **post):
id = request.registry['hr.applicant'].create(request.cr, request.uid, post)
data = {
'name': _('Online Form'),
'phone': post.get('phone', False),
'email_from': post.get('email_from', False),
'partner_name': post.get('partner_name', False),
'description': post.get('description', False),
'department_id': post.get('department_id', False),
'job_id': post.get('job_id', False)
}
imd = request.registry['ir.model.data']
try:
model, source_id = imd.get_object_reference(request.cr, request.uid, 'hr_recruitment', 'source_website_company')
data['source_id'] = source_id
except ValueError, e:
pass
jobid = request.registry['hr.applicant'].create(request.cr, request.uid, data, context=request.context)
if post['ufile']:
attachment_values = {
'name': post['ufile'].filename,
@@ -68,16 +57,13 @@ class website_hr_recruitment(http.Controller):
'datas_fname': post['ufile'].filename,
'res_model': 'hr.applicant',
'res_name': post['name'],
'res_id': id
'res_id': jobid
}
request.registry['ir.attachment'].create(request.cr, request.uid, attachment_values)
values = {
'jobid': post['job_id']
}
return request.website.render("website_hr_recruitment.thankyou", values)
request.registry['ir.attachment'].create(request.cr, request.uid, attachment_values, context=request.context)
return request.website.render("website_hr_recruitment.thankyou", {})
@website.route(['/apply/<model("hr.job"):job>'], type='http', auth="public", multilang=True)
def applyjobpost(self, job):
@website.route(['/job/apply', '/job/apply/<model("hr.job"):job>'], type='http', auth="public", multilang=True)
def applyjobpost(self, job=None):
return request.website.render("website_hr_recruitment.applyjobpost", { 'job': job })
@website.route('/job/publish', type='json', auth="admin", multilang=True)
@@ -97,4 +83,3 @@ class website_hr_recruitment(http.Controller):
hr_job.write(request.cr, request.uid, [rec.id], vals, context=request.context)
return res
# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -16,29 +16,61 @@
<template id="index" name="Jobs">
<t t-call="website.layout">
<div id="wrap">
<div class="oe_structure"/>
<div class="container oe_website_jobs">
<div class="row">
<div class="col-sm-4">
<t t-call="website.pager">
<t t-set="classname">pull-left</t>
</t>
<div class="oe_structure">
<section data-snippet-id="text-block" class="mb32">
<div class="container">
<div class="row">
<div class="col-md-12 text-center mb16" data-snippet-id="colmd">
<h2>Our Job Offers</h2>
<h3 class="text-muted">Join us and help disrupt the enterprise market!</h3>
</div>
<div class="col-md-12" data-snippet-id="colmd">
<p>
With a small team of smart people, we released the most
disruptive enterprise management software in the world.
OpenERP is fully open source, super easy, full featured
(3000+ apps) and its online offer is 3 times cheaper than
traditional competitors like SAP and Ms Dynamics. You think
it's just marketing ?
<a href="/">Just check by yourself</a> and discover
<a href="http://twitter.com/openerp/favorites">what people say</a>
about us.
</p>
<p>
We can offer you an extraordinary chance to learn, to
develop and to be part of an exciting experience and
team.
</p>
</div>
</div>
</div>
<div class='row style_default mt16'>
</section>
</div>
<div class="container oe_website_jobs">
<div class="row">
<div class="col-md-12" id="jobs_grid">
<ul class="media-list">
<li t-foreach="res_job" t-as="job" class="media">
<li t-foreach="jobs" t-as="job" class="media">
<div class="media-body" t-att-data-publish="job.website_published and 'on' or 'off'">
<t t-if="job.no_of_recruitment">
<span class="label label-default pull-right label-info"><t t-esc="vals[job.id]['count']"/> Vacancies.</span>
</t>
<h4 class="media-heading"><a t-href="/job/detail/#{ job.id }/"><span t-field="job.name"> </span></a></h4>
<div t-if="companies[0].country_id">
<i class="icon-map-marker"/> <span t-field="companies[0].city"> </span> <span t-if="companies[0].state_id" t-field="companies[0].state_id.name"> </span>, <span t-field="companies[0].country_id.name"> </span>
<h3 class="media-heading">
<a t-href="/job/detail/#{ job.id }/">
<span t-field="job.name"/>
</a>
<small t-if="job.no_of_recruitment &gt; 1">
<t t-esc="job.no_of_recruitment"/> open positions
</small>
</h3>
<div t-if="job.department_id and job.department_id.company_id">
<i class="icon-map-marker"/>
<span t-field="job.department_id.company_id.city"/>
<span t-if="job.department_id.company_id.state_id" t-field="job.department_id.company_id.state_id.name"/>
, <span t-field="job.department_id.company_id.country_id.name"/>
</div>
<div class="text-muted">
<i class="icon-time"/> <span><t t-esc="vals[job.id]['date_recruitment']"/></span>
<i class="icon-time"/> <span t-field="job.write_date"/>
</div>
</div>
</li>
@@ -46,7 +78,18 @@
</div>
</div>
</div>
<div class="oe_structure"/>
<div class="oe_structure">
<section data-snippet-id="cta" class="darken">
<div class="container">
<div class="row">
<div class="col-md-12 text-center mt16 mb16">
<a t-href="/job/apply" class="btn btn-primary btn-lg">Apply</a>
</div>
</div>
</div>
</section>
</div>
</div>
</t>
</template>
@@ -57,12 +100,6 @@
<div id="wrap">
<div class="container oe_website_hr_recruitment">
<div class="row">
<div class="col-md-3">
<t t-call="website_mail.follow">
<t t-set="email" t-value="user_id.email"/>
<t t-set="object" t-value="job"/>
</t>
</div>
<t t-call="website.publish_management">
<t t-set="object" t-value="job"/>
<t t-set="publish_edit" t-value="True"/>
@@ -86,7 +123,7 @@
<div class="container">
<div class="row">
<div class="col-md-12 text-center mt16 mb16">
<a t-href="/apply/#{ job.id }/" class="btn btn-primary btn-lg">Apply</a>
<a t-href="/job/apply/#{ job.id }/" class="btn btn-primary btn-lg">Apply</a>
</div>
</div>
</div>
@@ -103,28 +140,39 @@
<t t-set="additional_title">Apply Job</t>
<div id="wrap">
<div class="container">
<h1 class="text-center">Apply for <span t-field="job.name"/></h1>
<h1 class="text-center">
Job Application Form
</h1>
<h2 t-if="job" class="text-center text-muted">
<span t-field="job.name"/>
</h2>
<div class="row">
<section id="forms">
<!-- TODO Multilingual form action support ? -->
<form class="form-horizontal mt32" action="/job/success" method="post" enctype="multipart/form-data">
<input type="hidden" t-att-value="job.department_id.id" name="department_id"/>
<input type="hidden" t-att-value="job.id" name="job_id"/>
<input type="hidden" t-att-value="job.name" name="name"/>
<input type="hidden" t-att-value="job and job.department_id.id or False" name="department_id"/>
<input type="hidden" t-att-value="job and job.id or False" name="job_id"/>
<div class="form-group">
<label class="col-md-3 col-sm-4 control-label" for="partner_name">Name</label>
<label class="col-md-3 col-sm-4 control-label" for="partner_name">Your Name</label>
<div class="col-md-7 col-sm-8">
<input type="text" class="form-control" name="partner_name" required="True" />
</div>
</div>
<div class="form-group">
<label class="col-md-3 col-sm-4 control-label" for="email_from">Email</label>
<label class="col-md-3 col-sm-4 control-label" for="email_from">Your Email</label>
<div class="col-md-7 col-sm-8">
<input type="email" class="form-control" name="email_from" required="True" />
</div>
</div>
<div class="form-group">
<label class="col-md-3 col-sm-4 control-label" for="description">Cover Note</label>
<label class="col-md-3 col-sm-4 control-label" for="phone">Your Phone</label>
<div class="col-md-7 col-sm-8">
<input type="text" class="form-control" name="phone" required="True" />
</div>
</div>
<div class="form-group">
<label class="col-md-3 col-sm-4 control-label" for="description">Short Introduction</label>
<div class="col-md-7 col-sm-8">
<textarea class="form-control" name="description" style="min-height: 120px"/>
</div>
@@ -147,20 +195,32 @@
</div>
</t>
</template>
<template id="thankyou">
<t t-call="website.layout">
<div id="wrap">
<template id="thankyou">
<t t-call="website.layout">
<div id="wrap">
<div class="oe_structure">
<div class="container">
<h1>Thank you!</h1>
<p>
We have received your application for the position,
we will contact you soon for the next part of the
recruitment process.
Your job application has been successfully registered,
we will get back to you soon.
</p>
</div>
<section data-snippet-id="cta" class="darken">
<div class="container">
<div class="row">
<div class="col-md-12 text-center mt16 mb16">
<a t-href="/" class="btn btn-primary btn-lg">Continue To Our Website</a>
</div>
</div>
</div>
</section>
</div>
</t>
</template>
</div>
</t>
</template>
<template id="job_departments" inherit_option_id="website_hr_recruitment.index" name="Job Departments">
<xpath expr="//div[@id='jobs_grid']" position="before">
<div class="col-md-3">