[IMP] website_hr_recruitment: group offices by country
This commit is contained in:
parent
6981af0221
commit
72dff744b5
|
@ -10,9 +10,10 @@ class website_hr_recruitment(http.Controller):
|
|||
@http.route([
|
||||
'/jobs',
|
||||
'/jobs/department/<model("hr.department"):department>',
|
||||
'/jobs/office/<string:office>'
|
||||
'/jobs/office/<string:office>',
|
||||
'/jobs/country/<model("res.country"):country>'
|
||||
], type='http', auth="public", website=True)
|
||||
def jobs(self, department=None, office=None):
|
||||
def jobs(self, department=None, office=None, country=None):
|
||||
context=dict(request.context, show_address=True, no_tag_br=True)
|
||||
cr, uid = request.cr, request.uid
|
||||
|
||||
|
@ -31,10 +32,12 @@ class website_hr_recruitment(http.Controller):
|
|||
# Deduce departments and offices of those jobs
|
||||
departments = set(j.department_id for j in jobs if j.department_id)
|
||||
offices = set(j.address_id for j in jobs if j.address_id)
|
||||
countries = set(o.country_id for o in offices if o.country_id)
|
||||
|
||||
# Filter the matching one
|
||||
jobs = [j for j in jobs if department==None or j.department_id and j.department_id.id == department.id]
|
||||
jobs = [j for j in jobs if office==None or j.address_id and j.address_id.id == office_id]
|
||||
jobs = [j for j in jobs if country==None or j.address_id and j.address_id.country_id and j.address_id.country_id.id == country.id]
|
||||
|
||||
# Render page
|
||||
return request.website.render("website_hr_recruitment.index", {
|
||||
|
@ -43,6 +46,7 @@ class website_hr_recruitment(http.Controller):
|
|||
'offices': offices,
|
||||
'department_id': department and department.id,
|
||||
'office_id': office_id,
|
||||
'countries': countries
|
||||
})
|
||||
|
||||
@http.route('/jobs/add', type='http', auth="user", methods=['POST'], website=True)
|
||||
|
|
|
@ -253,15 +253,17 @@
|
|||
<xpath expr="//div[@id='jobs_grid_left']" position="inside">
|
||||
<ul class="nav nav-pills nav-stacked mb32">
|
||||
<li t-att-class=" '' if office_id else 'active' "><a href="/jobs">All Offices</a></li>
|
||||
<t t-foreach="offices" t-as="thisoffice">
|
||||
<li t-att-class=" 'active' if office_id == thisoffice.id else '' ">
|
||||
<a t-attf-href="/jobs/office/#{ slug(thisoffice) }" >
|
||||
<span t-field="thisoffice.city"/><t t-if="thisoffice.country_id">,
|
||||
<span t-field="thisoffice.country_id.name"/>
|
||||
</t>
|
||||
</a>
|
||||
</li>
|
||||
</t>
|
||||
<li t-foreach="countries" t-as="thiscountry"><a t-attf-href="/jobs/country/#{slug(thiscountry)}" t-field="thiscountry.name"/>
|
||||
<ul class="nav nav-pills nav-stacked nav-hierarchy">
|
||||
<t t-foreach="offices" t-as="thisoffice">
|
||||
<li t-if="thisoffice.country_id == thiscountry" t-att-class=" 'active' if office_id == thisoffice.id else '' ">
|
||||
<a t-attf-href="/jobs/office/#{ slug(thisoffice) }" >
|
||||
<span t-field="thisoffice.city"/>
|
||||
</a>
|
||||
</li>
|
||||
</t>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</xpath>
|
||||
<xpath expr="//div[@id='jobs_grid_left']" position="attributes">
|
||||
|
|
Loading…
Reference in New Issue