templates/channel_calendar.tmpl
author Tero Marttila <terom@fixme.fi>
Tue, 10 Feb 2009 22:59:52 +0200
changeset 85 0521cf830eb9
parent 58 ce028d356e1f
child 112 090192b64d7e
permissions -rw-r--r--
misc. template clean (hide RSS link, remove extra whitespace from calendar source
<%inherit file="channel.tmpl" />

<%def name="month_table(cal, month, dates)">
<table class="calendar">
## table header - month name
    <tr class="month-header">
        <th colspan="7"${' class="this-month"' if h.is_this_month(month) else ''}>
            <a href="${urls.channel_calendar.build(req, channel=channel, year=h.next_month_year(month), month=h.next_month(month))}" class="next-month">&raquo;</a>
            <a href="${urls.channel_calendar.build(req, channel=channel, year=h.prev_month_year(month), month=h.prev_month(month))}" class="prev-month">&laquo;</a>
            <span id="month-name">${h.fmt_month(month)}</span>
        </th>
    </tr>
## month header - weekday names    
    <tr class="week-header">
    % for weekday in cal.iterweekdays() :
        <th>${h.fmt_weekday(weekday)}</th>
    % endfor
    </tr>
## iterate over the weeks
% for week in cal.monthdays2calendar(month.year, month.month) :
    <tr>
    ## iterate over the week's days
    % for day, weekday in week :
        ## is it an empty cell?
        % if not day :
        <td>&nbsp;</td>
        % else :
        ## build date
        <% date = h.build_date(month, day) %>\
        ## render cell
        <td${' id="today"' if h.is_today(date) else ''}${' class="empty"' if date not in dates else ''}>\
        ## link to logs for this day?
        % if date in dates :
<a href="${urls.channel_date.build(req, channel=channel, date=date)}">${day}</a>\
        % else :
${day}\
        % endif
</td>
    % endif
    % endfor
    </tr>
% endfor
</table>
</%def>

${month_table(calendar, month, days)}