From d916781d66c1aaf4e3a04580153dce61744d5729 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Thu, 30 May 2024 09:09:33 +0200
Subject: [PATCH] In Calendar view, highlight today's date.

---
 plomtask/http.py        | 3 ++-
 templates/calendar.html | 5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/plomtask/http.py b/plomtask/http.py
index 280b0f5..537f21f 100644
--- a/plomtask/http.py
+++ b/plomtask/http.py
@@ -120,7 +120,8 @@ class TaskHandler(BaseHTTPRequestHandler):
         days = Day.with_filled_gaps(days, start, end)
         for day in days:
             day.collect_calendarized_todos(self.conn)
-        return {'start': start, 'end': end, 'days': days}
+        today = date_in_n_days(0)
+        return {'start': start, 'end': end, 'days': days, 'today': today}
 
     def do_GET_day(self) -> dict[str, object]:
         """Show single Day of ?date=."""
diff --git a/templates/calendar.html b/templates/calendar.html
index 4d67242..d7ec545 100644
--- a/templates/calendar.html
+++ b/templates/calendar.html
@@ -16,6 +16,9 @@ tr.month_row td {
 td.day_name {
   padding-right: 0.5em;
 }
+td.today {
+  font-weight: bold;
+}
 {% endblock %}
 
 
@@ -45,7 +48,7 @@ to <input name="end" value="{{end}}" />
 
 <tr>
 <td class="day_name">{{day.weekday|truncate(2,True,'',0)}}</td>
-<td><a href="day?date={{day.date}}">{{day.date}}</a></td>
+<td{% if day.date == today %} class="today"{% endif %}><a href="day?date={{day.date}}">{{day.date}}</a></td>
 <td>{{day.comment|e}}</td>
 </tr>
 
-- 
2.30.2