--- a/static/cal.css Sat Jan 08 22:55:01 2011 +0200
+++ b/static/cal.css Sat Jan 08 23:17:16 2011 +0200
@@ -62,10 +62,28 @@
height: 1em;
}
-/* The days are separated by borders */
+/* Each event is visible as its own block */
+table.calendar tbody tr.week-data td.event a
+{
+ display: block;
+
+ background-color: #A6C6E3;
+
+ padding: 4px;
+
+ /* Rounded corner for cosmetic effect */
+ border-radius: 4px;
+ -moz-border-radius: 6px;
+
+ text-align: center;
+}
+
+/* Borders ? */
table.calendar tbody td
{
border: 1px solid #d8d8d8;
border-style: none solid;
}
+
+
--- a/svv/cal.py Sat Jan 08 22:55:01 2011 +0200
+++ b/svv/cal.py Sat Jan 08 23:17:16 2011 +0200
@@ -152,16 +152,23 @@
# each even on its own row for now
for order in orders :
- yield tags.tr(class_='week-data')(
- (
- tags.td(
- tags.a(href=self.url_for(urls.OrderView, id=order.id))(order.event_name)
+ # start/end date for this week
+ start = min(date for date in week if order.on_date(date))
+ end = max(date for date in week if order.on_date(date))
+
+ # as vector into week
+ leading = (start - min(week)).days
+ length = (end - start).days + 1
+ trailing = (max(week) - end).days
- ) if order.on_date(date) else (
- tags.td("")
+ log.debug("Event %r from %r -> %r", order.event_name, start, end)
- )
- ) for date in week
+ yield tags.tr(class_='week-data')(
+ [tags.td("")] * leading,
+ tags.td(colspan=length, class_='event')(
+ tags.a(href=self.url_for(urls.OrderView, id=order.id))(order.event_name)
+ ),
+ [tags.td("")] * trailing,
)
def render_calendar (self, month) :