home · contact · privacy
Improve visual/textual calendar structuring.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 15 May 2024 08:18:51 +0000 (10:18 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 15 May 2024 08:18:51 +0000 (10:18 +0200)
plomtask/days.py
templates/calendar.html
templates/day.html
templates/todo.html

index 0e07bf7aeb8837fc28031d2d924d65d17b0256bd..5e975602d112a81f71b7bafb47b2939f9084d365 100644 (file)
@@ -78,6 +78,17 @@ class Day(BaseModel[str]):
         assert isinstance(self.id_, str)
         return self.id_
 
+    @property
+    def first_of_month(self) -> bool:
+        """Return what month self.date is part of."""
+        assert isinstance(self.id_, str)
+        return self.id_[-2:] == '01'
+
+    @property
+    def month_name(self) -> str:
+        """Return what month self.date is part of."""
+        return self.datetime.strftime('%B')
+
     @property
     def weekday(self) -> str:
         """Return what weekday matches self.date."""
index 3acdbc6fc2205e67e0c4e514130e4e33ad292e66..715131af6de410b266fa71c0f29743cebeb74f19 100644 (file)
@@ -1,14 +1,39 @@
 {% extends 'base.html' %}
 
+{% block css %}
+tr.week_row td { height: 0.1em; background-color: black; padding: 0; margin: 0; }
+tr.month_row td { border: 0.1em solid black; text-align: center; }
+{% endblock %}
+
+
+
 {% block content %}
 <form action="calendar" method="GET">
 from <input name="start" value="{{start}}" />
 to <input name="end" value="{{end}}" />
 <input type="submit" value="OK" />
 </form>
-<ul>
+<table>
 {% for day in days %}
-<li><a href="day?date={{day.date}}">{{day.date}}</a> ({{day.weekday}}) {{day.comment|e}}
+
+{% if day.first_of_month %}
+<tr class="month_row">
+<td colspan=3>{{ day.month_name }}</td>
+</tr>
+{% endif %}
+
+{% if day.weekday == "Monday" %}
+<tr class="week_row">
+<td colspan=3></td>
+</tr>
+{% endif %}
+
+<tr>
+<td>{{day.weekday|truncate(2,True,'',0)}}</td>
+<td><a href="day?date={{day.date}}">{{day.date}}</a></td>
+<td>{{day.comment|e}}</td>
+</tr>
+
 {% endfor %}
-</ul>
+</table>
 {% endblock %}
index f6e22650ddc57fd1e0553e01e9f3f4d73c5dd794..a0823f33e16fb218d3212756fb3fe11bb9c8cfb3 100644 (file)
@@ -149,7 +149,7 @@ add todo: <input name="new_todo" list="processes" autocomplete="off" />
 {% endif %}
 {% endfor %}
 
-<td><input name="new_todo" list="todos_for_{{condition.id_}}" /></td>
+<td><input name="new_todo" list="todos_for_{{condition.id_}}" autocomplete="off" /></td>
 <datalist name="new_todo" id="todos_for_{{condition.id_}}" />
 {% for process in enablers_for[condition.id_] %}
 <option value="{{process.id_}}">{{process.title.newest|e}}</option>
index f50b635d2647879a66c602721481e68988a64bdc..9395adac6d92125f33b1ee0d320ad486f9281325 100644 (file)
@@ -1,5 +1,7 @@
 {% extends 'base.html' %}
 
+
+
 {% block content %}
 <h3>Todo: {{todo.process.title.newest|e}}</h3>
 <form action="todo?id={{todo.id_}}" method="POST">