From b6aa6f4e85286c3a947182a64c837869e215ef0e Mon Sep 17 00:00:00 2001 From: "Andreas (@xAndy) Zimmermann" Date: Thu, 21 Apr 2022 00:21:06 +0200 Subject: [PATCH] eye candy --- shiftregister/app/templates/helper_base.html | 2 +- .../app/templates/partials/shift_listitem.html | 7 +++++++ shiftregister/app/templates/shift.html | 4 ++-- shiftregister/app/templates/shiftlist.html | 17 +++++++++++------ shiftregister/app/views.py | 4 ++-- 5 files changed, 23 insertions(+), 11 deletions(-) create mode 100644 shiftregister/app/templates/partials/shift_listitem.html diff --git a/shiftregister/app/templates/helper_base.html b/shiftregister/app/templates/helper_base.html index 646145b..6694afd 100644 --- a/shiftregister/app/templates/helper_base.html +++ b/shiftregister/app/templates/helper_base.html @@ -16,7 +16,7 @@ {% endif %} {% if helper.important_shift %} - {%if helper.important_shift.is_running%}Laufende{% else %}Nächste{% endif %} Schicht + {%if helper.important_shift.is_running%}Laufende{% else %}Nächste{% endif %} Schicht({{ helper.important_shift.start_at|date:"H:m" }}) {% endif %} {% endif %} diff --git a/shiftregister/app/templates/partials/shift_listitem.html b/shiftregister/app/templates/partials/shift_listitem.html new file mode 100644 index 0000000..222a4d9 --- /dev/null +++ b/shiftregister/app/templates/partials/shift_listitem.html @@ -0,0 +1,7 @@ +
  • {{ shift.room.name }} {{ shift.start_at }} + {% if registered %} + Details + {% else %} + Mithelfen + {% endif %} +
  • diff --git a/shiftregister/app/templates/shift.html b/shiftregister/app/templates/shift.html index 42cf79d..3c4d7c1 100644 --- a/shiftregister/app/templates/shift.html +++ b/shiftregister/app/templates/shift.html @@ -13,7 +13,7 @@ Dauer: {{ shift.duration }}
    {% csrf_token %} {{ shift_form.as_p }} - +
    {% endif %} {% if is_registered %} @@ -21,7 +21,7 @@ Dauer: {{ shift.duration }}
    {% csrf_token %} {{ shift_form.as_p }} - +
    {% elif not shift.has_ended %} Bitte wende dich an den Infopoint, falls du es nicht zu deiner Schicht schaffst. diff --git a/shiftregister/app/templates/shiftlist.html b/shiftregister/app/templates/shiftlist.html index 3087883..e27ee36 100644 --- a/shiftregister/app/templates/shiftlist.html +++ b/shiftregister/app/templates/shiftlist.html @@ -7,17 +7,22 @@ {{ current_shift.room.name }} {{ current_shift.start_at }}Details {% endif %} {% if my_shifts %} -

    Meine Schichten

    +

    Meine Schichten:

    {% endif %} -

    Freie Schichten:

    +
    +{% if free_shifts %} +

    Freie Schichten:

    + +{% else %} +Alle Schichten sind voll. Schau später noch mal vorbei. +{% endif %} {% endblock %} diff --git a/shiftregister/app/views.py b/shiftregister/app/views.py index a17b1f2..601681f 100644 --- a/shiftregister/app/views.py +++ b/shiftregister/app/views.py @@ -17,9 +17,9 @@ def index(request): # currently only sorts by date context = {} if request.helper: - context["my_shifts"] = request.helper.shiftregistration_set.filter( + context["my_shifts"] = (reg.shift for reg in request.helper.shiftregistration_set.filter( shift__start_at__gt=timezone.now() - ).order_by("shift__start_at") + ).order_by("shift__start_at")) imp_shift = request.helper.important_shift() print(imp_shift)