From 4fa766a9db4aafc0b4f9faf6a00e8074f03ec200 Mon Sep 17 00:00:00 2001
From: Michael Bauer <michael-bauer@posteo.de>
Date: Wed, 30 Oct 2024 13:28:20 +0100
Subject: [PATCH] Tidy the coursebook-template

---
 .../alsijil/partials/register_coursebook.html | 166 +++++++++---------
 1 file changed, 81 insertions(+), 85 deletions(-)

diff --git a/aleksis/apps/alsijil/templates/alsijil/partials/register_coursebook.html b/aleksis/apps/alsijil/templates/alsijil/partials/register_coursebook.html
index 591d4efbc..d7a7a664d 100644
--- a/aleksis/apps/alsijil/templates/alsijil/partials/register_coursebook.html
+++ b/aleksis/apps/alsijil/templates/alsijil/partials/register_coursebook.html
@@ -1,98 +1,94 @@
 <h4>{% trans 'Coursebook' %}</h4>
-  <table class="small-print">
-    <thead>
-    <tr>
-      <th></th>
-      <th>{% trans 'Pe.' %}</th>
-      <th>{% trans 'Subj.' %}</th>
-      <th>{% trans 'Lesson topic' %}</th>
-      <th>{% trans 'Homework' %}</th>
-      <th>{% trans 'Notes' %}</th>
-      <th>{% trans 'Te.' %}</th>
-    </tr>
-    </thead>
-    <tbody>
+
+<table class="small-print">
+  <thead>
+  <tr>
+    <th></th>
+    <th>{% trans 'Pe.' %}</th>
+    <th>{% trans 'Subj.' %}</th>
+    <th>{% trans 'Lesson topic' %}</th>
+    <th>{% trans 'Homework' %}</th>
+    <th>{% trans 'Notes' %}</th>
+    <th>{% trans 'Te.' %}</th>
+  </tr>
+  </thead>
+  <tbody>
     {% for day, documentations in documentations_by_day %}
-    <!-- CONTINUE -->
-    <!-- Update next row -->
-      {% for register_object, documentation, notes, substitution in register_objects %}
-        <tr class="
-                {% if doc.amends %}
-                  {% if doc.amends.cancelled %}
-                    lesson-cancelled
-                  {% endif %}
-                  {% if doc.amends.amends %}
-                    lesson-substituted
-                  {% endif %}
+      <tr class="
+              {% if doc.amends %}
+                {% if doc.amends.cancelled %}
+                  lesson-cancelled
                 {% endif %}
-                {% if forloop.first %}
-                  lessons-day-first
+                {% if doc.amends.amends %}
+                  lesson-substituted
                 {% endif %}
-              ">
-          {% if forloop.first %}
-          <!-- TODO: There is no lessons-day-head class -->
-            <th rowspan="{{ documentations|length }}" class="lessons-day-head">{{ day|date:"D" }}</th>
-          {% endif %}
-          <td class="lesson-pe">
-            {% if doc.amends %}
-              {% if doc.amends.slot_number_start == doc.amends.slot_number_ends %}
-                {{ doc.amends.slot_number_start }}.
-              {% else %}
-                {{ doc.amends.slot_number_start }}.–{{ doc.amends.slot_number_end }}.
               {% endif %}
-	    {% else %}
-              {{ doc.datetime_start|time:"H:i" }}-{{ doc.datetime_end|time:"H:i" }}
+              {% if forloop.first %}
+                lessons-day-first
+              {% endif %}
+            ">
+        {% if forloop.first %}
+        <!-- TODO: There is no lessons-day-head class -->
+          <th rowspan="{{ documentations|length }}" class="lessons-day-head">{{ day|date:"D" }}</th>
+        {% endif %}
+        <td class="lesson-pe">
+          {% if doc.amends %}
+            {% if doc.amends.slot_number_start == doc.amends.slot_number_ends %}
+              {{ doc.amends.slot_number_start }}.
+            {% else %}
+              {{ doc.amends.slot_number_start }}.–{{ doc.amends.slot_number_end }}.
+            {% endif %}
+          {% else %}
+            {{ doc.datetime_start|time:"H:i" }}-{{ doc.datetime_end|time:"H:i" }}
+          {% endif %}
+        </td>
+        <td class="lesson-subj">
+          {% include "chronos/partials/subject.html" with subject=doc.subject %}
+        </td>
+        <td class="lesson-topic">
+          {{ doc.topic }}
+        </td>
+        <td class="lesson-homework">{{ doc.homework }}</td>
+        <td class="lesson-notes">
+          {{ documentation.group_note }}
+          {% for participation in doc.notable_participations %}
+            {% if participation.absence_reason %}
+              <span class="lesson-note-absent">
+                {{ participation.person.short_name }}
+                <span class="lesson-note-excused">
+                  ({{ participation.absence_reason.short_name }})
+                </span>
+              </span>
             {% endif %}
-          </td>
-          <td class="lesson-subj">
-            {% include "chronos/partials/subject.html" with subject=doc.subject %}
-          </td>
-          <td class="lesson-topic">
-            {{ doc.topic }}
-          </td>
-          <td class="lesson-homework">{{ doc.homework }}</td>
-          <td class="lesson-notes">
-            {{ documentation.group_note }}
-            {% for participation in doc.notable_participations %}
-              {% if participation.absence_reason %}
-                <span class="lesson-note-absent">
-                  {{ participation.person.short_name }}
-                  <span class="lesson-note-excused">
-                    ({{ participation.absence_reason.short_name }})
-                  </span>
+            {% if participation.tardiness %}
+              <span class="lesson-note-late">
+                {{ participation.person.short_name }}
+                ({{ participation.tardiness }}′)
+              </span>
+            {% endif %}
+            {% for personal_note in doc.personal_notes %}
+              {% if personal_note.extra_mark %}
+                <span>
+                  {{ personal_note.person.short_name }}
+                  ({{ personal_note.extra_mark.short_name }})
                 </span>
               {% endif %}
-              {% if participation.tardiness %}
-                <span class="lesson-note-late">
-                  {{ participation.person.short_name }}
-                  ({{ participation.tardiness }}′)
+              {% if personal_note.note %}
+                <span>
+                  {{ personal_note.person.short_name }}
+                  <!-- MAYBE: Shorten note -->
+                  ({{ personal_note.note }})
                 </span>
               {% endif %}
-              {% for personal_note in doc.personal_notes %}
-                {% if personal_note.extra_mark %}
-                  <span>
-                    {{ personal_note.person.short_name }}
-                    ({{ personal_note.extra_mark.short_name }})
-                  </span>
-                {% endif %}
-                {% if personal_note.note %}
-                  <span>
-                    {{ personal_note.person.short_name }}
-                    <!-- MAYBE: Shorten note -->
-                    ({{ personal_note.note }})
-                  </span>
-                {% endif %}
-              {% endfor %}
             {% endfor %}
-          </td>
-          <td class="lesson-te">
-            {% if documentation.topic %}
-              {{ doc.teachers.first.short_name }}
-            {% endif %}
-          </td>
-        </tr>
-      {% endfor %}
-    {% endwith %}
-  {% endfor %}
+          {% endfor %}
+        </td>
+        <td class="lesson-te">
+          {% if documentation.topic %}
+            {{ doc.teachers.first.short_name }}
+          {% endif %}
+        </td>
+      </tr>
+    {% endfor %}
   </tbody>
 </table>
-- 
GitLab