From: Christian Heller <c.heller@plomlompom.de>
Date: Thu, 30 May 2024 07:09:33 +0000 (+0200)
Subject: In Calendar view, highlight today's date.
X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/booking/%7B%7Bprefix%7D%7D/task?a=commitdiff_plain;h=d916781d66c1aaf4e3a04580153dce61744d5729;p=taskplom

In Calendar view, highlight today's date.
---

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>