templates/channel_calendar.tmpl
changeset 112 090192b64d7e
parent 85 0521cf830eb9
child 113 9fc0eb751b6a
equal deleted inserted replaced
111:95c0c49d76aa 112:090192b64d7e
     1 <%inherit file="channel.tmpl" />
     1 <%inherit file="channel.tmpl" />
     2 
     2 
     3 <%def name="month_table(cal, month, dates)">
     3 <%def name="month_table(month)">
       
     4 ## the set of available days
       
     5 <% log_dates = h.set(channel.source.get_month_days(month)) %>
       
     6 ## the calendar table
     4 <table class="calendar">
     7 <table class="calendar">
     5 ## table header - month name
     8 ## table header - month name
     6     <tr class="month-header">
     9     <tr class="month-header">
     7         <th colspan="7"${' class="this-month"' if h.is_this_month(month) else ''}>
    10         <th colspan="7"${' class="this-month"' if h.is_this_month(month) else ''}>
     8             <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>
    11             <a href="${urls.channel_calendar.build(req, channel=channel, year=h.next_month(month).year, month=h.next_month(month).month)}" class="next-month">&raquo;</a>
     9             <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>
    12             <a href="${urls.channel_calendar.build(req, channel=channel, year=h.prev_month(month).year, month=h.prev_month(month).month)}" class="prev-month">&laquo;</a>
    10             <span id="month-name">${h.fmt_month(month)}</span>
    13             <span id="month-name">${h.fmt_month(month)}</span>
    11         </th>
    14         </th>
    12     </tr>
    15     </tr>
    13 ## month header - weekday names    
    16 ## month header - weekday names    
    14     <tr class="week-header">
    17     <tr class="week-header">
    15     % for weekday in cal.iterweekdays() :
    18     % for weekday in h.calendar.iterweekdays() :
    16         <th>${h.fmt_weekday(weekday)}</th>
    19         <th>${h.fmt_weekday(weekday)}</th>
    17     % endfor
    20     % endfor
    18     </tr>
    21     </tr>
    19 ## iterate over the weeks
    22 ## iterate over the weeks
    20 % for week in cal.monthdays2calendar(month.year, month.month) :
    23 % for week in h.calendar.monthdays2calendar(month.year, month.month) :
    21     <tr>
    24     <tr>
    22     ## iterate over the week's days
    25     ## iterate over the week's days
    23     % for day, weekday in week :
    26     % for day, weekday in week :
    24         ## is it an empty cell?
    27         ## is it an empty cell?
    25         % if not day :
    28         % if not day :
    26         <td>&nbsp;</td>
    29         <td>&nbsp;</td>
    27         % else :
    30         % else :
    28         ## build date
    31         ## build date
    29         <% date = h.build_date(month, day) %>\
    32         <% date = h.build_date(month, day) %>\
    30         ## render cell
    33         ## render cell
    31         <td${' id="today"' if h.is_today(date) else ''}${' class="empty"' if date not in dates else ''}>\
    34         <td${' id="today"' if h.is_today(date) else ''}${' class="empty"' if date not in log_dates else ''}>\
    32         ## link to logs for this day?
    35         ## link to logs for this day?
    33         % if date in dates :
    36         % if date in log_dates :
    34 <a href="${urls.channel_date.build(req, channel=channel, date=date)}">${day}</a>\
    37 <a href="${urls.channel_date.build(req, channel=channel, date=date)}">${day}</a>\
    35         % else :
    38         % else :
    36 ${day}\
    39 ${day}\
    37         % endif
    40         % endif
    38 </td>
    41 </td>
    41     </tr>
    44     </tr>
    42 % endfor
    45 % endfor
    43 </table>
    46 </table>
    44 </%def>
    47 </%def>
    45 
    48 
    46 ${month_table(calendar, month, days)}
    49 ## three months
       
    50 ${month_table(h.prev_month(month))}
       
    51 ${month_table(month              )}
       
    52 ${month_table(h.next_month(month))}
    47 
    53