From ea89a77d8f2b1ed864f1f9c2c4ad7fd77fe7bd5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20H=C3=A4ttasch?= <benjamin.haettasch@fachschaft.informatik.tu-darmstadt.de> Date: Mon, 10 May 2021 22:30:38 +0200 Subject: [PATCH] Show unscheduled slots in scheduler grouped by tracks --- .../templates/admin/AKScheduling/scheduling.html | 16 +++++++++++----- AKScheduling/views.py | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/AKScheduling/templates/admin/AKScheduling/scheduling.html b/AKScheduling/templates/admin/AKScheduling/scheduling.html index 62b67236..daa19367 100644 --- a/AKScheduling/templates/admin/AKScheduling/scheduling.html +++ b/AKScheduling/templates/admin/AKScheduling/scheduling.html @@ -184,11 +184,17 @@ <div id="planCalendar"></div> </div> <div class="col-md-2 col-lg-2" id="unscheduled-slots"> - {% for slot in slots_unscheduled %} - <div class="unscheduled-slot badge badge-primary" style='background-color: {{ slot.ak.category.color }}' - data-event='{ "title": "{{ slot.ak.short_name }}", "duration": {"hours": "{{ slot.duration|unlocalize }}"}, "constraint": "roomAvailable", "description": "{{ slot.ak.details | escapejs }}", "slotID": "{{ slot.pk }}", "backgroundColor": "{{ slot.ak.category.color }}"}' data-details="{{ slot.ak.details }}">{{ slot.ak.short_name }} - ({{ slot.duration }} h)<br>{{ slot.ak.owners_list }} - </div> + {% regroup slots_unscheduled by ak.track as slots_unscheduled_by_track_list %} + {% for track_slots in slots_unscheduled_by_track_list %} + {% if track_slots.grouper %} + <h5 class="mt-2">{{ track_slots.grouper }}</h5> + {% endif %} + {% for slot in track_slots.list %} + <div class="unscheduled-slot badge badge-primary" style='background-color: {{ slot.ak.category.color }}' + data-event='{ "title": "{{ slot.ak.short_name }}", "duration": {"hours": "{{ slot.duration|unlocalize }}"}, "constraint": "roomAvailable", "description": "{{ slot.ak.details | escapejs }}", "slotID": "{{ slot.pk }}", "backgroundColor": "{{ slot.ak.category.color }}"}' data-details="{{ slot.ak.details }}">{{ slot.ak.short_name }} + ({{ slot.duration }} h)<br>{{ slot.ak.owners_list }} + </div> + {% endfor %} {% endfor %} </div> </div> diff --git a/AKScheduling/views.py b/AKScheduling/views.py index 73719bd8..86445fac 100644 --- a/AKScheduling/views.py +++ b/AKScheduling/views.py @@ -25,7 +25,7 @@ class SchedulingAdminView(AdminViewMixin, FilterByEventSlugMixin, ListView): context_object_name = "slots_unscheduled" def get_queryset(self): - return super().get_queryset().filter(start__isnull=True) + return super().get_queryset().filter(start__isnull=True).order_by('ak__track') def get_context_data(self, *, object_list=None, **kwargs): context = super().get_context_data(object_list=object_list, **kwargs) -- GitLab