<%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">»</a>
<a href="${urls.channel_calendar.build(req, channel=channel, year=h.prev_month_year(month), month=h.prev_month(month))}" class="prev-month">«</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> </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)}