From d04dde15daca556085855f96d43e505fadfb5386 Mon Sep 17 00:00:00 2001 From: Marie Birner Date: Thu, 6 Apr 2023 09:30:43 +0200 Subject: [PATCH] [TASK] add header --- templates/admin/user/index.html.tera | 3 +- templates/auth/login.html.tera | 33 ++--- templates/base.html.tera | 11 +- templates/includes/macros.html.tera | 23 ++++ templates/index.html.tera | 197 +++++++++++++-------------- 5 files changed, 137 insertions(+), 130 deletions(-) create mode 100644 templates/includes/macros.html.tera diff --git a/templates/admin/user/index.html.tera b/templates/admin/user/index.html.tera index a1255a5..12c5a1c 100644 --- a/templates/admin/user/index.html.tera +++ b/templates/admin/user/index.html.tera @@ -1,7 +1,8 @@ +{% import "includes/macros" as macros %} + {% extends "base" %} {% block content %} -

Users

diff --git a/templates/auth/login.html.tera b/templates/auth/login.html.tera index 3fff768..58d610c 100644 --- a/templates/auth/login.html.tera +++ b/templates/auth/login.html.tera @@ -1,29 +1,24 @@ {% extends "base" %} {% block content %} - -{% if flash %} - {% if flash.0 == "success" %} -
-
- {{ flash.1 }} -
-
- {% endif %} - {% if flash.0 == "error" %} -
-
- {{ flash.1 }} -
-
- {% endif %} -{% endif %} -
Your Company

Ruderassistent

+ + {% if flash %} + {% if flash.0 == "success" %} +
+ {{ flash.1 }} +
+ {% endif %} + {% if flash.0 == "error" %} +
+ {{ flash.1 }} +
+ {% endif %} + {% endif %}
@@ -49,6 +44,4 @@
- - {% endblock content %} \ No newline at end of file diff --git a/templates/base.html.tera b/templates/base.html.tera index 77ef984..b2ec392 100644 --- a/templates/base.html.tera +++ b/templates/base.html.tera @@ -1,3 +1,5 @@ +{% import "includes/macros" as macros %} + @@ -5,10 +7,13 @@ + {%if loggedin_user %} + {{ macros::header(loggedin_user=loggedin_user) }} + {%endif%} +
- {% block content %} - {% endblock content %} -
+ {% block content %}{% endblock content %} +
diff --git a/templates/includes/macros.html.tera b/templates/includes/macros.html.tera new file mode 100644 index 0000000..73653e4 --- /dev/null +++ b/templates/includes/macros.html.tera @@ -0,0 +1,23 @@ +{% macro header(loggedin_user) %} +
+
+
+ Hallo {{ loggedin_user.name }} +
+ +
+ {% if loggedin_user.is_admin %} + + + Userverwaltung + + {% endif %} + + + Ausloggen + +
+
+
+
+{% endmacro input %} \ No newline at end of file diff --git a/templates/index.html.tera b/templates/index.html.tera index 7436316..e56b79e 100644 --- a/templates/index.html.tera +++ b/templates/index.html.tera @@ -1,128 +1,113 @@ {% extends "base" %} {% block content %} - -
- {% if loggedin_user %} - Hi {{ loggedin_user.name }}. LOGOUT - - {% if loggedin_user.is_admin %} - USER +
+ {% if flash %} + {% if flash.0 == "success" %} +
+ {{ flash.1 }} +
+ {% endif %} + {% if flash.0 == "error" %} +
+ {{ flash.1 }} +
+ {% endif %} {% endif %} - {% endif %} - {% if flash %} - {% if flash.0 == "success" %} -
-
- {{ flash.1 }} -
-
+

Ausfahrten

+ + {% for day in days %} +
+

{{ day.day }}

+ + {% for planned_event in day.planned_events %} +

Planned event '{{ planned_event.name }}'

+ Planned amount cox: {{ planned_event.planned_amount_cox }}
+ Allow guests: {{ planned_event.allow_guests }}
+ Planned starting time: {{ planned_event.planned_starting_time }}
+ Max people: {{ planned_event.max_people }}
+ Notes: {{ planned_event.notes }}
+ Folgende Steuerpersonen haben sich schon angemeldet: + {% for cox in planned_event.cox %} + {{ cox }} + {% if cox == loggedin_user.name %} + ABMELDEN + {% endif %} + {% endfor %} +
+ + Folgende Ruderer haben sich schon angemeldet: + {% for rower in planned_event.rower%} + {{ rower.name }} (angemeldet seit {{ rower.registered_at }}) + {% if rower.name == loggedin_user.name %} + ABMELDEN + {% endif %} + {% endfor %} + + {% if planned_event.max_people > planned_event.rower | length %} + MITRUDERN {% endif %} - {% if flash.0 == "error" %} -
-
- {{ flash.1 }} -
-
+ + + {% if loggedin_user.is_cox %} + STEUERN {% endif %} - {% endif %} -

Ausfahrten

- - - - {% for day in days %} -
-

{{ day.day }}

- - {% for planned_event in day.planned_events %} -

Planned event '{{ planned_event.name }}'

- Planned amount cox: {{ planned_event.planned_amount_cox }}
- Allow guests: {{ planned_event.allow_guests }}
- Planned starting time: {{ planned_event.planned_starting_time }}
- Max people: {{ planned_event.max_people }}
- Notes: {{ planned_event.notes }}
- Folgende Steuerpersonen haben sich schon angemeldet: - {% for cox in planned_event.cox %} - {{ cox }} - {% if cox == loggedin_user.name %} - ABMELDEN - {% endif %} - {% endfor %} -
- - Folgende Ruderer haben sich schon angemeldet: - {% for rower in planned_event.rower%} - {{ rower.name }} (angemeldet seit {{ rower.registered_at }}) - {% if rower.name == loggedin_user.name %} - ABMELDEN + {% if loggedin_user.is_admin %} + DELETE {% endif %} {% endfor %} - {% if planned_event.max_people > planned_event.rower | length %} - MITRUDERN - {% endif %} + {% for trip in day.trips %} +

Ausfahrt von {{ trip.cox_name }}

+ Planned starting time: {{ trip.planned_starting_time }}
+ Max people: {{ trip.max_people }}
+ Notes: {{ trip.notes }}
+ Folgende Ruderer haben sich schon angemeldet: + {% for rower in trip.rower %} + {{ rower.name }} (angemeldet seit {{ rower.registered_at }}) + {% if rower.name == loggedin_user.name %} + ABMELDEN + {% endif %} + {% endfor %} - {% if loggedin_user.is_cox %} - STEUERN - {% endif %} + {% if trip.max_people > trip.rower | length and trip.cox_id != loggedin_user.id %} + MITRUDERN + {% endif %} + {% endfor %} {% if loggedin_user.is_admin %} - DELETE +

Add planned event

+
+ + + + Gäste + + + + + +
{% endif %} - {% endfor %} + {% if loggedin_user.is_cox%} +

Add trip

+
+ + + + - {% for trip in day.trips %} -

Ausfahrt von {{ trip.cox_name }}

- Planned starting time: {{ trip.planned_starting_time }}
- Max people: {{ trip.max_people }}
- Notes: {{ trip.notes }}
- Folgende Ruderer haben sich schon angemeldet: - {% for rower in trip.rower %} - {{ rower.name }} (angemeldet seit {{ rower.registered_at }}) - {% if rower.name == loggedin_user.name %} - ABMELDEN - {% endif %} - {% endfor %} - - {% if trip.max_people > trip.rower | length and trip.cox_id != loggedin_user.id %} - MITRUDERN + +
{% endif %} + + +
{% endfor %} - - {% if loggedin_user.is_admin %} -

Add planned event

-
- - - - Gäste - - - - - -
- {% endif %} - - {% if loggedin_user.is_cox%} -

Add trip

-
- - - - - - -
- {% endif %} - - -
- {% endfor %} -
+
{% endblock content %}