From 6ca09589092dc7f5dbeb6cff5481eeaf16491a63 Mon Sep 17 00:00:00 2001 From: Luca Date: Mon, 25 Apr 2022 23:35:13 +0200 Subject: [PATCH] Style team pages --- shiftregister/app/models.py | 4 ++- .../templates/partials/shift_listitem.html | 3 ++ shiftregister/app/templates/shift.html | 3 ++ shiftregister/team/forms.py | 4 ++- .../team/templates/helper_detail.html | 20 +++++++------ .../team/templates/partials/shift_box.html | 14 +++++++++ .../templates/partials/shift_list_item.html | 6 ++-- .../team/templates/shift_detail.html | 30 ++++++++++++++----- shiftregister/team/templates/shift_list.html | 15 +++++----- .../team/templates/shift_overview.html | 30 +++++++++++-------- 10 files changed, 87 insertions(+), 42 deletions(-) create mode 100644 shiftregister/team/templates/partials/shift_box.html diff --git a/shiftregister/app/models.py b/shiftregister/app/models.py index 119d2d5..89cf961 100644 --- a/shiftregister/app/models.py +++ b/shiftregister/app/models.py @@ -103,7 +103,9 @@ class Message(models.Model): def gen_token(): - return secrets.token_urlsafe(15) # returns 15 bytes Base64-encoded (times 1.333...) = 20 characters + return secrets.token_urlsafe( + 15 + ) # returns 15 bytes Base64-encoded (times 1.333...) = 20 characters class LoginToken(models.Model): diff --git a/shiftregister/app/templates/partials/shift_listitem.html b/shiftregister/app/templates/partials/shift_listitem.html index 30d5d46..47c17a4 100644 --- a/shiftregister/app/templates/partials/shift_listitem.html +++ b/shiftregister/app/templates/partials/shift_listitem.html @@ -1,6 +1,9 @@
+{% if shift.deleted %} + gelöscht
+{% endif %} Ort: {{ shift.room.name }}
Beginn: {{ shift.start_at }}
Dauer: {{ shift.duration }} diff --git a/shiftregister/app/templates/shift.html b/shiftregister/app/templates/shift.html index a5ced05..dc5fba9 100644 --- a/shiftregister/app/templates/shift.html +++ b/shiftregister/app/templates/shift.html @@ -6,6 +6,9 @@
{% if is_registered %}
Du bist zu dieser Schicht angemeldet
+{% endif %} +{% if shift.deleted %} +
Diese Schicht wurde gelöscht.
{% endif %}
Ort: {{ shift.room.name }}
diff --git a/shiftregister/team/forms.py b/shiftregister/team/forms.py index 93b5ad6..7a47018 100644 --- a/shiftregister/team/forms.py +++ b/shiftregister/team/forms.py @@ -7,4 +7,6 @@ class EmptyForm(forms.Form): class HelperShift(forms.Form): - helper = forms.ModelChoiceField(queryset=Helper.objects.order_by("name")) + helper = forms.ModelChoiceField( + label="Helfer*in", queryset=Helper.objects.order_by("name") + ) diff --git a/shiftregister/team/templates/helper_detail.html b/shiftregister/team/templates/helper_detail.html index bc60450..59c6815 100644 --- a/shiftregister/team/templates/helper_detail.html +++ b/shiftregister/team/templates/helper_detail.html @@ -1,13 +1,15 @@ {% extends "team_base.html" %} -{% block title %}Schichtdetails{% endblock %} +{% block title %}Helferdetails{% endblock %} {% block content %} -

{{ helper.name }}

-Telefon: {{ helper.phone }} -

Schichten:

-
    - {% for reg in helper.shiftregistration_set.all %} -
  • {{ reg.shift.room.name }} {{ reg.shift.start_at }}({{ reg.shift.shiftregistration_set.count }}/{{ reg.shift.room.required_helpers }})Details
  • - {% endfor %} -
+

{{ helper.name }}

+
+ Telefon: {{ helper.phone }} +
+
Schichten
+
+{% for reg in helper.shiftregistration_set.all %} + {% include 'partials/shift_list_item.html' with shift=reg.shift %} +{% endfor %} +
{% endblock %} diff --git a/shiftregister/team/templates/partials/shift_box.html b/shiftregister/team/templates/partials/shift_box.html new file mode 100644 index 0000000..77ea0c7 --- /dev/null +++ b/shiftregister/team/templates/partials/shift_box.html @@ -0,0 +1,14 @@ +
+
+{% if shift.deleted %} + gelöscht
+{% endif %} + Ort: {{ shift.room.name }}
+ Beginn: {{ shift.start_at }}
+ Dauer: {{ shift.duration }}
+ Belegung: {{ shift.shiftregistration_set.count }}/{{ shift.room.required_helpers }} +
+
+ Details +
+
diff --git a/shiftregister/team/templates/partials/shift_list_item.html b/shiftregister/team/templates/partials/shift_list_item.html index b14a84d..807e273 100644 --- a/shiftregister/team/templates/partials/shift_list_item.html +++ b/shiftregister/team/templates/partials/shift_list_item.html @@ -1,3 +1,3 @@ -
  • {{ shift.room.name }} {{ shift.start_at }} ({{ shift.shiftregistration_set.count }}/{{ shift.room.required_helpers }}) - Details -
  • +
    + {% include 'partials/shift_box.html' %} +
    diff --git a/shiftregister/team/templates/shift_detail.html b/shiftregister/team/templates/shift_detail.html index 6a7b061..e5a92a0 100644 --- a/shiftregister/team/templates/shift_detail.html +++ b/shiftregister/team/templates/shift_detail.html @@ -2,13 +2,21 @@ {% block title %}Schichtdetails{% endblock %} {% block content %} -{{ shift.room.name }} {{ shift.start_at }}({{ shift.shiftregistration_set.count }}/{{ shift.room.required_helpers }}) -

    Helfer

    - +

    {% if shift.deleted %}(gelöscht) {% endif %}{{ shift.room.name }} {{ shift.start_at }} ({{ shift.shiftregistration_set.count }}/{{ shift.room.required_helpers }})

    +{% if shift.shiftregistration_set.all %} +
    Helfer*innen
    +
    +{% for reg in shift.shiftregistration_set.all %} + +{% endfor %} +
    +{% endif %} +
    Helfer*in eintragen
    {% csrf_token %} {% for field in add_helper_form %} @@ -20,7 +28,13 @@ {% else %}
    +{% if field.widget_type == 'select' %} +
    + {{ field }} +
    +{% else %} {{ field }} +{% endif %}
    {% endif %} {% if field.help_text %} @@ -28,6 +42,6 @@ {% endif %}
    {% endfor %} - + {% endblock %} diff --git a/shiftregister/team/templates/shift_list.html b/shiftregister/team/templates/shift_list.html index 7a60ab2..6af18bd 100644 --- a/shiftregister/team/templates/shift_list.html +++ b/shiftregister/team/templates/shift_list.html @@ -1,11 +1,12 @@ {% extends "team_base.html" %} -{% block title %}{{title}}{% endblock %} +{% block title %}{{ title }}{% endblock %} + {% block content %} -

    {{title}}

    -
      - {% for shift in object_list %} - {% include "partials/shift_list_item.html" %} - {% endfor %} -
    +

    {{ title }}

    +
    +{% for shift in object_list %} + {% include "partials/shift_list_item.html" %} +{% endfor %} +
    {% endblock %} diff --git a/shiftregister/team/templates/shift_overview.html b/shiftregister/team/templates/shift_overview.html index 342aea0..c822d96 100644 --- a/shiftregister/team/templates/shift_overview.html +++ b/shiftregister/team/templates/shift_overview.html @@ -1,20 +1,24 @@ {% extends "team_base.html" %} {% block title %}Schichtübersicht{% endblock %} + {% block content %} {% if running_shifts %} -

    Laufende Schichten

    -
      - {% for shift in running_shifts %} - {% include "partials/shift_list_item.html" %} - {% endfor %} -
    +

    Laufende Schichten

    +
    +{% for shift in running_shifts %} + {% include "partials/shift_list_item.html" %} +{% endfor %} +
    {% endif %} -
    -

    Nächste Schichten pro Raum

    -
      - {% for shift in next_shifts %} - {% include "partials/shift_list_item.html" %} - {% endfor %} -
    +
    +

    Nächste Schichten pro Raum

    +
    +{% for shift in next_shifts %} +
    +
    {{ shift.room.name }}
    + {% include "partials/shift_box.html" %} +
    +{% endfor %} +
    {% endblock %}