# HG changeset patch # User Tero Marttila # Date 1234387333 -7200 # Node ID 9fc0eb751b6afaa634c2c5f1d922068b265ff474 # Parent 090192b64d7e4a8c50c0e0de86a9bca81d2cc790 add
for month/year to calendar header diff -r 090192b64d7e -r 9fc0eb751b6a helpers.py --- a/helpers.py Wed Feb 11 22:56:43 2009 +0200 +++ b/helpers.py Wed Feb 11 23:22:13 2009 +0200 @@ -2,7 +2,8 @@ Some additional helpers """ -import datetime, calendar +import datetime +import calendar as _calendar import qmsk.web.helpers @@ -17,7 +18,10 @@ set = set # reference to calendar instance - calendar = calendar.Calendar() + calendar = _calendar.Calendar() + + # list of (month_num, month_name) for the months in the year + months = list(enumerate(_calendar.month_name))[1:] def tz_name (self, tz) : """ @@ -38,7 +42,7 @@ Formats an abbreviated weekday name """ - return calendar.day_abbr[wday] + return _calendar.day_abbr[wday] def build_date (self, month, mday) : """ @@ -198,15 +202,17 @@ return max(values) - def select_options (self, key_values, selected_key) : + def select_options (self, key_values, selected_key=None) : """ - Render a series of ' % ( - ' value="%s"' % key if key != value else '', - ' selected="selected"' if key == selected_key else '', + ' value="%s"' % key if key is not None else '', + ' selected="selected"' if (key if key is not None else value) == selected_key else '', value ) for key, value in key_values ) diff -r 090192b64d7e -r 9fc0eb751b6a static/irclogs.css --- a/static/irclogs.css Wed Feb 11 22:56:43 2009 +0200 +++ b/static/irclogs.css Wed Feb 11 23:22:13 2009 +0200 @@ -152,18 +152,14 @@ background-color: #c8c8c8; } -table.calendar td { - margin: 1px; - - - text-align: center; -} - +/* month header */ table.calendar tr.month-header th { } -table.calendar tr.month-header a { +table.calendar tr.month-header a, +table.calendar span.prev-month, +table.calendar span.next-month { display: block; color: inherit; @@ -176,6 +172,12 @@ font-size: x-large; } +table.calendar th.this-month a.next-month, +table.calendar span.prev-month, +table.calendar span.next-month { + color: #d5d5d5; +} + table.calendar tr.month-header a:hover { background-color: #b5b5b5; } @@ -184,25 +186,24 @@ margin-top: 5px; } -table.calendar a.prev-month { +table.calendar .prev-month { float: left; } -table.calendar a.next-month { +table.calendar .next-month { float: right; } -table.calendar th.this-month a.next-month { - color: #d5d5d5; -} - - +/* week header */ table.calendar tr.week-header th { width: 14% } +/* cells */ table.calendar td { padding: 2px; + margin: 1px; + text-align: center; } table.calendar td a { @@ -214,7 +215,7 @@ color: inherit; } - + table.calendar td.empty { color: #d0d0d0; } diff -r 090192b64d7e -r 9fc0eb751b6a templates/channel_calendar.tmpl --- a/templates/channel_calendar.tmpl Wed Feb 11 22:56:43 2009 +0200 +++ b/templates/channel_calendar.tmpl Wed Feb 11 23:22:13 2009 +0200 @@ -1,6 +1,6 @@ <%inherit file="channel.tmpl" /> -<%def name="month_table(month)"> +<%def name="month_table(month, is_center=True)"> ## the set of available days <% log_dates = h.set(channel.source.get_month_days(month)) %> ## the calendar table @@ -8,9 +8,22 @@ ## table header - month name - » - « + % if is_center : + » + « + + + + + +
+ % else : ${h.fmt_month(month)} + % endif ## month header - weekday names @@ -47,7 +60,7 @@ ## three months -${month_table(h.prev_month(month))} -${month_table(month )} -${month_table(h.next_month(month))} +${month_table(h.prev_month(month), is_center=False )} +${month_table(month, is_center=True )} +${month_table(h.next_month(month), is_center=False )} diff -r 090192b64d7e -r 9fc0eb751b6a templates/preferences.tmpl --- a/templates/preferences.tmpl Wed Feb 11 22:56:43 2009 +0200 +++ b/templates/preferences.tmpl Wed Feb 11 23:22:13 2009 +0200 @@ -9,7 +9,7 @@

(${h.tz_name(prefs['timezone'])})