[IMP] website_event multilang

Some controllers does not use route params so it fails with language url offset

bzr revid: fme@openerp.com-20130926150729-ltq6wafp4h0n5x0l
This commit is contained in:
Fabien Meghazi 2013-09-26 17:07:29 +02:00
parent 4bad1f8362
commit ea642e75bf
2 changed files with 12 additions and 12 deletions

View File

@ -36,7 +36,7 @@ import werkzeug
class website_event(http.Controller):
_order = 'website_published desc, date_begin desc'
@website.route(['/event/', '/event/page/<int:page>/'], type='http', auth="public")
@website.route(['/event/', '/event/page/<int:page>/'], type='http', auth="public", multilang=True)
def events(self, page=1, **searches):
cr, uid, context = request.cr, request.uid, request.context
event_obj = request.registry['event.event']
@ -152,7 +152,7 @@ class website_event(http.Controller):
return request.website.render("website_event.index", values)
@website.route(['/event/<int:event_id>'], type='http', auth="public")
@website.route(['/event/<int:event_id>'], type='http', auth="public", multilang=True)
def event(self, event_id=None, **post):
event_obj = request.registry['event.event']
values = {
@ -162,7 +162,7 @@ class website_event(http.Controller):
}
return request.website.render("website_event.event_description_full", values)
@website.route(['/event/<int:event_id>/add_cart'], type='http', auth="public")
@website.route(['/event/<int:event_id>/add_cart'], type='http', auth="public", multilang=True)
def add_cart(self, event_id=None, **post):
user_obj = request.registry['res.users']
order_line_obj = request.registry.get('sale.order.line')
@ -210,5 +210,5 @@ class website_event(http.Controller):
order.write({'order_line': [(4, order_line_id)]}, context=request.context)
if not _values:
return werkzeug.utils.redirect("/event/%s/" % event_id)
return werkzeug.utils.redirect("/shop/checkout")
return request.redirect("/event/%s/" % event_id)
return request.redirect("/shop/checkout")

View File

@ -6,10 +6,10 @@
<template id="header_footer" inherit_id="website_sale.header_footer">
<xpath expr="//header//ul[@id='top_menu']/li" position="before">
<li><a href="/event">Events</a></li>
<li><a t-href="/event">Events</a></li>
</xpath>
<xpath expr="//footer//ul[@name='products']/li" position="after">
<li><a href="/event">Events</a></li>
<li><a t-href="/event">Events</a></li>
</xpath>
</template>
@ -36,7 +36,7 @@
<li class="nav-header">Date</li>
<t t-foreach="dates" t-as="date">
<li t-att-class="searches.get('date') == date[0] and 'active' or ''">
<a t-attf-href="/event/#{ search_path }&amp;date=#{ date[0] }"><t t-esc="date[1]"/> <small t-if="date[3]">(<t t-esc="date[3]"/>)</small></a>
<a t-href="/event/#{ search_path }&amp;date=#{ date[0] }"><t t-esc="date[1]"/> <small t-if="date[3]">(<t t-esc="date[3]"/>)</small></a>
</li>
</t>
</ul>
@ -74,7 +74,7 @@
available.
</span>
</t>
<h4 class="media-heading"><a t-attf-href="/event/#{ event.id }/"><span t-field="event.name"> </span></a></h4>
<h4 class="media-heading"><a t-href="/event/#{ event.id }/"><span t-field="event.name"> </span></a></h4>
<div>
<span t-field="event.type">: </span>
<t t-if="event.organizer_id">
@ -107,7 +107,7 @@
<li class="nav-header">Category</li>
<t t-foreach="types">
<li t-if="type" t-att-class="searches.get('type') == str(type and type[0]) and 'active' or ''">
<a t-attf-href="/event/#{ search_path }&amp;type=#{ type[0] }"><t t-esc="type[1]"/> <small>(<t t-esc="type_count"/>)</small></a>
<a t-href="/event/#{ search_path }&amp;type=#{ type[0] }"><t t-esc="type[1]"/> <small>(<t t-esc="type_count"/>)</small></a>
</li>
</t>
</ul>
@ -119,7 +119,7 @@
<li class="nav-header">Location</li>
<t t-foreach="countries">
<li t-if="country_id" t-att-class="searches.get('country') == str(country_id and country_id[0]) and 'active' or ''">
<a t-attf-href="/event/#{ search_path }&amp;country=#{ country_id[0] }"><t t-esc="country_id[1]"/><small>(<t t-esc="country_id_count"/>)</small></a>
<a t-href="/event/#{ search_path }&amp;country=#{ country_id[0] }"><t t-esc="country_id[1]"/><small>(<t t-esc="country_id_count"/>)</small></a>
</li>
</t>
</ul>
@ -164,7 +164,7 @@
<div class="col-md-8">
<t t-if="event_id.event_ticket_ids">
<hr/>
<form t-attf-action="/event/#{ event_id.id }/add_cart" method="post">
<form t-action="/event/#{ event_id.id }/add_cart" method="post">
<table class="table">
<thead>
<tr>