# HG changeset patch # User Tero Marttila # Date 1234381775 -7200 # Node ID 67f48e288102731fc441077fd1ecbfa2490578f0 # Parent 0690d715385d8bc8b49d7bb0ba191c931aff7c51 add prev/next date links to channel_date pagination diff -r 0690d715385d -r 67f48e288102 helpers.py --- 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) + diff -r 0690d715385d -r 67f48e288102 static/irclogs.css --- 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; diff -r 0690d715385d -r 67f48e288102 templates/channel_date.tmpl --- 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()"> + « ${h.fmt_date(h.prev_date(date))} + + <%def name="right()"> + ${h.fmt_date(h.next_date(date))} » + + +
${channel.title} :: Logs for ${h.fmt_date(date)}
% 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 diff -r 0690d715385d -r 67f48e288102 templates/inc_paginate.tmpl --- 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 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.