feat: Visuelle Unterscheidung der Termintypen auf dem Dashboard

This commit is contained in:
Matthias Nagel 2025-10-01 11:57:22 +02:00
parent 74ff99fe52
commit 956d7a45e9
4 changed files with 24 additions and 5 deletions

View File

@ -15,7 +15,15 @@
{% if events %} {% if events %}
<div class="list-group"> <div class="list-group">
{% for event in events %} {% for event in events %}
<div class="list-group-item list-group-item-action flex-column align-items-start"> <div class="list-group-item list-group-item-action flex-column align-items-start
{% if event.game %}
event-game
{% elif event.training %}
event-training
{% else %}
event-generic
{% endif %}
">
<div class="d-flex w-100 justify-content-between"> <div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">{{ event.title }}</h5> <h5 class="mb-1">{{ event.title }}</h5>
<small>{{ event.start_time|localize }}</small> <small>{{ event.start_time|localize }}</small>
@ -33,4 +41,4 @@
{% else %} {% else %}
<p>No events found for your team.</p> <p>No events found for your team.</p>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View File

@ -22,9 +22,9 @@ def dashboard(request):
all_teams = list(set(chain(player_teams, coached_teams, assisted_teams))) all_teams = list(set(chain(player_teams, coached_teams, assisted_teams)))
if all_teams: if all_teams:
events = Event.objects.filter(team__in=all_teams).order_by('start_time') events = Event.objects.filter(team__in=all_teams).select_related('game', 'training').order_by('start_time')
context = { context = {
'events': events, 'events': events,
} }
return render(request, 'dashboard/dashboard.html', context) return render(request, 'dashboard/dashboard.html', context)

View File

@ -4,6 +4,17 @@
<head> <head>
<title>Baseball Organisator</title> <title>Baseball Organisator</title>
<link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}"> <link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
<style>
.event-game {
border-left: 5px solid #dc3545; /* red */
}
.event-training {
border-left: 5px solid #0d6efd; /* blue */
}
.event-generic {
border-left: 5px solid #6c757d; /* gray */
}
</style>
</head> </head>
<body> <body>
<nav class="navbar navbar-expand-lg navbar-light bg-light"> <nav class="navbar navbar-expand-lg navbar-light bg-light">
@ -46,4 +57,4 @@
<script src="{% static 'js/bootstrap.bundle.min.js' %}"></script> <script src="{% static 'js/bootstrap.bundle.min.js' %}"></script>
</body> </body>
</html> </html>