--- a/helpers.py Wed Feb 11 04:57:55 2009 +0200
+++ b/helpers.py Wed Feb 11 21:49:35 2009 +0200
@@ -200,4 +200,18 @@
value
) for key, value in key_values
)
+
+ def prev_date (self, date) :
+ """
+ Returns the previous date for the given datetime-date
+ """
+ return datetime.datetime(date.year, date.month, date.day, tzinfo=date.tzinfo) - datetime.timedelta(days=1)
+
+ def next_date (self, date) :
+ """
+ Returns the previous date for the given datetime-date
+ """
+
+ return datetime.datetime(date.year, date.month, date.day, tzinfo=date.tzinfo) + datetime.timedelta(days=1)
+
--- a/static/irclogs.css Wed Feb 11 04:57:55 2009 +0200
+++ b/static/irclogs.css Wed Feb 11 21:49:35 2009 +0200
@@ -361,6 +361,14 @@
background-color: #d0d0d0;
}
+li.paginate-left {
+ float: left;
+}
+
+li.paginate-right {
+ float: right;
+}
+
/* Lastlog */
div#other-formats {
font-size: small;
--- a/templates/channel_date.tmpl Wed Feb 11 04:57:55 2009 +0200
+++ b/templates/channel_date.tmpl Wed Feb 11 21:49:35 2009 +0200
@@ -1,13 +1,25 @@
<%inherit file="channel.tmpl" />
-<%namespace file="inc_paginate.tmpl" import="paginate" />
+<%namespace file="inc_paginate.tmpl" name="paginate" />
+
+## special pagination stuff
+<%def name="paginate_date()">
+ <%call expr="paginate.paginate(urls.channel_date, count, page, max, channel=channel, date=date)">
+ <%def name="left()">
+ <a href="${h.build_url(urls.channel_date, channel=channel, date=h.prev_date(date))}">« ${h.fmt_date(h.prev_date(date))}</a>
+ </%def>
+ <%def name="right()">
+ <a href="${h.build_url(urls.channel_date, channel=channel, date=h.next_date(date))}">${h.fmt_date(h.next_date(date))} »</a>
+ </%def>
+ </%call>
+</%def>
<div id="title">${channel.title} :: Logs for ${h.fmt_date(date)}</div>
% if page :
-${paginate(urls.channel_date, count, page, max, channel=channel, date=date)}
+${paginate_date()}
% endif
<%include file="lines.tmpl" />
% if page :
-${paginate(urls.channel_date, count, page, max, channel=channel, date=date)}
+${paginate_date()}
% endif
--- a/templates/inc_paginate.tmpl Wed Feb 11 04:57:55 2009 +0200
+++ b/templates/inc_paginate.tmpl Wed Feb 11 21:49:35 2009 +0200
@@ -1,11 +1,29 @@
+## special overrides...
+<%def name="paginate_left()">
+
+</%def>
+
<%def name="paginate(url, count, page_cur, page_max, _more=None, _last=False, **args)">
<%doc>
Pagination works using page numbers, with a specific number of maximum pages displayed. If _more is True,
then instead of a "Next" button, we have a "More" button, which goes to the max+1'th page, unless _last is
- True, whereupon it's not displayed
+ True, whereupon it's not displayed.
+
+ Can be called using <%call>, whereupon caller.left/caller.right can define additional data to display at the
+ left/right of the pagination ul.
</%doc>
<div class="paginate">
<ul>
+ % if caller and caller.right :
+ <li class="paginate-right">
+ ${caller.right()}
+ </li>
+ % endif
+ % if caller and caller.left :
+ <li class="paginate-left">
+ ${caller.left()}
+ </li>
+ % endif
<li>
% if page_cur > 1 :
<a href="${h.build_url(url, count=count, page=page_cur-1, max=max, **args)}">« Prev</a>