add title/location to event search (#1062)

This commit is contained in:
Frédéric Péters 2011-12-01 20:32:27 +01:00
parent 1d40abe852
commit c16db9285b
2 changed files with 15 additions and 6 deletions

View File

@ -32,13 +32,18 @@
<span>Nombre de résultats : <span tal:replace="python: len(search_results)"/></span>
</div>
<div id="results">
<ul>
<div> <!-- id="results"> -->
<ul id="events-ul-list">
<tal:entry tal:repeat="item search_batch">
<li tal:define="oddrow repeat/item/odd; object python: item.getObject()" tal:attributes="class python: oddrow and 'odd' or 'even'"><div>
<h4><a href="#" tal:attributes="href item/getURL" tal:content="item/Title">Véronique Salvi</a></h4>
<p><span tal:replace="item/start/day"/> <span tal:replace="python: item.getObject().start_month()">mars</span></p>
</div></li>
<li tal:define="oddrow repeat/item/odd; event python: item.getObject()" tal:attributes="class event/klass"><div>
<p class="date"><span tal:content="event/longdatetime"/>
<br/><span tal:condition="event/place" class="place" tal:content="event/place"></span>
<div class="event-data">
<h3><span class="event-type-square">■</span><span tal:replace="event/title"/></h3>
<p class="description" tal:condition="event/description" tal:content="event/description"></p>
<p class="details"><a href="#" tal:attributes="href event/absolute_url">Détails</a></p>
</div>
</li>
</tal:entry>
</ul>
</div>

View File

@ -577,6 +577,7 @@ class DeputySearchForm(form.Form):
class IEventSearch(interface.Interface):
search_type_is_event = schema.TextLine(title=u'Search Type', default=u'1', required=False)
text = schema.TextLine(title=_(u'Title / Location'), required=False)
start = schema.Date(title=_(u'Start'), required=False)
end = schema.Date(title=_(u'End'), required=False)
@ -956,6 +957,9 @@ class SearchView(BrowserView):
elif data.get('end'):
kw['start'] = {'query': data.get('end'), 'range': 'max'}
if data.get('text'):
kw['SearchableText'] = data.get('text')
kw['sort_on'] = 'start'
kw['sort_order'] = 'descending'