[IMP] website_event: title of the main events page summarises the search

bzr revid: tde@openerp.com-20130924111957-mzxnibdgbb8d09zo
This commit is contained in:
Thibault Delavallée 2013-09-24 13:19:57 +02:00
parent 95e7c0f61c
commit 6a3939f932
4 changed files with 28 additions and 46 deletions

View File

@ -1,23 +1,4 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013-Today OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Online Events',

View File

@ -1,22 +1,3 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013-Today OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import main

View File

@ -37,7 +37,10 @@ class website_event(http.Controller):
@website.route(['/event/', '/event/page/<int:page>/'], type='http', auth="public")
def events(self, page=1, **searches):
cr, uid, context = request.cr, request.uid, request.context
event_obj = request.registry['event.event']
type_obj = request.registry['event.type']
country_obj = request.registry['res.country']
searches.setdefault('date', 'all')
searches.setdefault('type', 'all')
@ -73,13 +76,19 @@ class website_event(http.Controller):
]
# search domains
current_date = dates[0][1]
current_type = None
current_country = None
for date in dates:
if searches.get("date") == date[0]:
if searches["date"] == date[0]:
domain_search["date"] = date[2]
if searches.get("type", "all") != 'all':
domain_search["type"] = [("type", "=", int(searches.get("type")))]
if searches.get("country", "all") != 'all':
domain_search["country"] = [("country_id", "=", int(searches.get("country")))]
current_date = date[1]
if searches["type"] != 'all':
current_type = type_obj.browse(cr, uid, int(searches['type']), context=context)
domain_search["type"] = [("type", "=", int(searches["type"]))]
if searches["country"] != 'all':
current_country = country_obj.browse(cr, uid, int(searches['country']), context=context)
domain_search["country"] = [("country_id", "=", int(searches["country"]))]
def dom_without(without):
domain = SUPERUSER_ID != request.uid and [('website_published', '=', True)] or [(1, "=", 1)]
@ -128,6 +137,9 @@ class website_event(http.Controller):
context=request.context)
values = {
'current_date': current_date,
'current_country': current_country,
'current_type': current_type,
'event_ids': events_ids,
'dates': dates,
'types': types,

View File

@ -29,9 +29,6 @@
</t>
<t t-set="title">Events</t>
<div id="wrap">
<div class="oe_structure">
<h1 class="text-center">Our Events</h1>
</div>
<div class="container">
<div class="row">
<div class="col-md-4 css_noprint" id="left_column">
@ -50,6 +47,17 @@
</t>
</div>
<div class="col-md-8">
<div class="oe_structure">
<h2>
Events for <t t-esc="current_date"/>
<t t-if="current_type">
in <t t-esc="current_type.name"/>
</t>
<t t-if="current_country">
in <t t-esc="current_country.name"/>
</t>
</h2>
</div>
<ul class="media-list">
<li t-foreach="event_ids" t-as="event" class="media" data-publish="">
<t t-call="website.publish"><t t-set="object" t-value="event"/></t>