author | Tero Marttila <terom@fixme.fi> |
Wed, 11 Feb 2009 22:56:43 +0200 | |
changeset 112 | 090192b64d7e |
parent 85 | 0521cf830eb9 |
child 113 | 9fc0eb751b6a |
permissions | -rw-r--r-- |
54
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
1 |
<%inherit file="channel.tmpl" /> |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
2 |
|
112
090192b64d7e
add three calendars to the channel_calendar view
Tero Marttila <terom@fixme.fi>
parents:
85
diff
changeset
|
3 |
<%def name="month_table(month)"> |
090192b64d7e
add three calendars to the channel_calendar view
Tero Marttila <terom@fixme.fi>
parents:
85
diff
changeset
|
4 |
## the set of available days |
090192b64d7e
add three calendars to the channel_calendar view
Tero Marttila <terom@fixme.fi>
parents:
85
diff
changeset
|
5 |
<% log_dates = h.set(channel.source.get_month_days(month)) %> |
090192b64d7e
add three calendars to the channel_calendar view
Tero Marttila <terom@fixme.fi>
parents:
85
diff
changeset
|
6 |
## the calendar table |
54
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
7 |
<table class="calendar"> |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
8 |
## table header - month name |
55 | 9 |
<tr class="month-header"> |
58
ce028d356e1f
special-case current month in calendar
Tero Marttila <terom@fixme.fi>
parents:
55
diff
changeset
|
10 |
<th colspan="7"${' class="this-month"' if h.is_this_month(month) else ''}> |
112
090192b64d7e
add three calendars to the channel_calendar view
Tero Marttila <terom@fixme.fi>
parents:
85
diff
changeset
|
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">»</a> |
090192b64d7e
add three calendars to the channel_calendar view
Tero Marttila <terom@fixme.fi>
parents:
85
diff
changeset
|
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">«</a> |
55 | 13 |
<span id="month-name">${h.fmt_month(month)}</span> |
14 |
</th> |
|
54
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
15 |
</tr> |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
16 |
## month header - weekday names |
55 | 17 |
<tr class="week-header"> |
112
090192b64d7e
add three calendars to the channel_calendar view
Tero Marttila <terom@fixme.fi>
parents:
85
diff
changeset
|
18 |
% for weekday in h.calendar.iterweekdays() : |
54
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
19 |
<th>${h.fmt_weekday(weekday)}</th> |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
20 |
% endfor |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
21 |
</tr> |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
22 |
## iterate over the weeks |
112
090192b64d7e
add three calendars to the channel_calendar view
Tero Marttila <terom@fixme.fi>
parents:
85
diff
changeset
|
23 |
% for week in h.calendar.monthdays2calendar(month.year, month.month) : |
54
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
24 |
<tr> |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
25 |
## iterate over the week's days |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
26 |
% for day, weekday in week : |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
27 |
## is it an empty cell? |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
28 |
% if not day : |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
29 |
<td> </td> |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
30 |
% else : |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
31 |
## build date |
85
0521cf830eb9
misc. template clean (hide RSS link, remove extra whitespace from calendar source
Tero Marttila <terom@fixme.fi>
parents:
58
diff
changeset
|
32 |
<% date = h.build_date(month, day) %>\ |
55 | 33 |
## render cell |
112
090192b64d7e
add three calendars to the channel_calendar view
Tero Marttila <terom@fixme.fi>
parents:
85
diff
changeset
|
34 |
<td${' id="today"' if h.is_today(date) else ''}${' class="empty"' if date not in log_dates else ''}>\ |
54
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
35 |
## link to logs for this day? |
112
090192b64d7e
add three calendars to the channel_calendar view
Tero Marttila <terom@fixme.fi>
parents:
85
diff
changeset
|
36 |
% if date in log_dates : |
85
0521cf830eb9
misc. template clean (hide RSS link, remove extra whitespace from calendar source
Tero Marttila <terom@fixme.fi>
parents:
58
diff
changeset
|
37 |
<a href="${urls.channel_date.build(req, channel=channel, date=date)}">${day}</a>\ |
54
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
38 |
% else : |
85
0521cf830eb9
misc. template clean (hide RSS link, remove extra whitespace from calendar source
Tero Marttila <terom@fixme.fi>
parents:
58
diff
changeset
|
39 |
${day}\ |
54
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
40 |
% endif |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
41 |
</td> |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
42 |
% endif |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
43 |
% endfor |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
44 |
</tr> |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
45 |
% endfor |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
46 |
</table> |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
47 |
</%def> |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
48 |
|
112
090192b64d7e
add three calendars to the channel_calendar view
Tero Marttila <terom@fixme.fi>
parents:
85
diff
changeset
|
49 |
## three months |
090192b64d7e
add three calendars to the channel_calendar view
Tero Marttila <terom@fixme.fi>
parents:
85
diff
changeset
|
50 |
${month_table(h.prev_month(month))} |
090192b64d7e
add three calendars to the channel_calendar view
Tero Marttila <terom@fixme.fi>
parents:
85
diff
changeset
|
51 |
${month_table(month )} |
090192b64d7e
add three calendars to the channel_calendar view
Tero Marttila <terom@fixme.fi>
parents:
85
diff
changeset
|
52 |
${month_table(h.next_month(month))} |
54
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
53 |