From 2921d383d664cfa9128ad61818e32c86eeccd6b7 Mon Sep 17 00:00:00 2001 From: Serghei MIHAI Date: Fri, 25 Oct 2013 18:17:00 +0200 Subject: [PATCH] events preview displayed in the agenda Closes #3881 --- tabellio/agenda/event.py | 10 ++++++++++ tabellio/agenda/folder_templates/view.pt | 1 + 2 files changed, 11 insertions(+) diff --git a/tabellio/agenda/event.py b/tabellio/agenda/event.py index 4b400c6..4820f35 100644 --- a/tabellio/agenda/event.py +++ b/tabellio/agenda/event.py @@ -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, '

', n)] class Event(BaseEvent): implements(IEvent) diff --git a/tabellio/agenda/folder_templates/view.pt b/tabellio/agenda/folder_templates/view.pt index 29fa8bf..418b40d 100644 --- a/tabellio/agenda/folder_templates/view.pt +++ b/tabellio/agenda/folder_templates/view.pt @@ -126,6 +126,7 @@ class string:d-${event/start/year}-${event/start/month}-${event/start/day}">

+ Détail de l'événement