events preview displayed in the agenda

Closes #3881
This commit is contained in:
Serghei Mihai 2013-10-25 18:17:00 +02:00
parent 4189550093
commit 2921d383d6
No known key found for this signature in database
GPG Key ID: 76D1C964BF2FA1AF
2 changed files with 11 additions and 0 deletions

View File

@ -101,6 +101,16 @@ class BaseEvent(Item):
return 'today'
return ''
def preview(self):
n = 3
def nth_position(string, sub, n, pos = 0):
if n:
sliced_from = string.find(sub) + len(sub)
return pos + nth_position(string[sliced_from:],
sub, n-1, sliced_from)
return pos
return self.text.output[:nth_position(self.text.output, '</p>', n)]
class Event(BaseEvent):
implements(IEvent)

View File

@ -126,6 +126,7 @@
class string:d-${event/start/year}-${event/start/month}-${event/start/day}">
<h3><span tal:content="event/longdatetime"/> <span tal:content="event/title"/></h3>
<p tal:condition="event/place" class="place" tal:content="event/place"></p>
<span tal:condition="event/text" class="preview" tal:content="structure event/preview"></span>
<a href="#" class="event-details" tal:attributes="href event/absolute_url">Détail de l'événement</a>
<span class="closediv"/>
</div>