# HG changeset patch # User Tero Marttila # Date 1234153152 -7200 # Node ID ce028d356e1f4a444a2b43ecb3af174e6ad74f48 # Parent e123721e4b34dc61a3d7324f5f930b8c9949f97a special-case current month in calendar diff -r e123721e4b34 -r ce028d356e1f helpers.py --- a/helpers.py Mon Feb 09 06:12:11 2009 +0200 +++ b/helpers.py Mon Feb 09 06:19:12 2009 +0200 @@ -46,15 +46,38 @@ """ return datetime.date(month.year, month.month, mday) + + def now (self) : + """ + Build current time + """ + + return self.ctx['timezone'].localize(datetime.datetime.now()) + + def today (self) : + """ + Build today's date + """ + + return self.now().date() def is_today (self, date) : """ - checks if the given date is today + Checks if the given date is today """ # construct current date - return date == self.ctx['timezone'].localize(datetime.datetime.now()).date() + return date == self.today() + def is_this_month (self, month) : + """ + Checks the given month is the current month + """ + + today = self.today() + + return (month.year == today.year and month.month == today.month) + def prev_month_year (self, month) : """ Returns the year of the month before the given one diff -r e123721e4b34 -r ce028d356e1f static/irclogs.css --- a/static/irclogs.css Mon Feb 09 06:12:11 2009 +0200 +++ b/static/irclogs.css Mon Feb 09 06:19:12 2009 +0200 @@ -188,6 +188,11 @@ float: right; } +table.calendar th.this-month a.next-month { + color: #d5d5d5; +} + + table.calendar tr.week-header th { width: 14% } diff -r e123721e4b34 -r ce028d356e1f templates/channel_calendar.tmpl --- a/templates/channel_calendar.tmpl Mon Feb 09 06:12:11 2009 +0200 +++ b/templates/channel_calendar.tmpl Mon Feb 09 06:19:12 2009 +0200 @@ -4,7 +4,7 @@ ## table header - month name -
+ » « ${h.fmt_month(month)}