From 17d6313042b102e82218e336884f135ae0e9e859 Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Thu, 4 Sep 2025 18:49:17 +0200 Subject: [PATCH 1/8] Add automatic broadcast features and UI improvements --- .../tournaments/broadcast/broadcast.html | 4 +- .../tournaments/broadcast/broadcast_club.html | 15 ++- .../broadcast/broadcasted_auto.html | 91 +++++++++++++++++++ .../broadcast/broadcasted_bracket.html | 18 ++++ .../broadcast/broadcasted_club_auto.html | 63 +++++++++++++ .../broadcast/broadcasted_event_auto.html | 63 +++++++++++++ .../broadcast/broadcasted_planning.html | 2 +- tournaments/views.py | 22 +++-- 8 files changed, 268 insertions(+), 10 deletions(-) create mode 100644 tournaments/templates/tournaments/broadcast/broadcasted_club_auto.html create mode 100644 tournaments/templates/tournaments/broadcast/broadcasted_event_auto.html diff --git a/tournaments/templates/tournaments/broadcast/broadcast.html b/tournaments/templates/tournaments/broadcast/broadcast.html index 134466d..98bff39 100644 --- a/tournaments/templates/tournaments/broadcast/broadcast.html +++ b/tournaments/templates/tournaments/broadcast/broadcast.html @@ -24,13 +24,15 @@
diff --git a/tournaments/templates/tournaments/broadcast/broadcast_club.html b/tournaments/templates/tournaments/broadcast/broadcast_club.html index 2ebd531..91c1df5 100644 --- a/tournaments/templates/tournaments/broadcast/broadcast_club.html +++ b/tournaments/templates/tournaments/broadcast/broadcast_club.html @@ -8,6 +8,18 @@ {% block content %}
+ +
+
+ + Diffusion automatique du club + - Cycle automatiquement entre tous les tournois actifs +- 3 jours + +
+
+ + +
@@ -30,7 +42,8 @@ {{ tournament.private_label }}
- Automatic | + Auto | + Event Auto | (beta) Tableau | (beta) Planning | Matchs | diff --git a/tournaments/templates/tournaments/broadcast/broadcasted_auto.html b/tournaments/templates/tournaments/broadcast/broadcasted_auto.html index 3222ddf..e775f46 100644 --- a/tournaments/templates/tournaments/broadcast/broadcasted_auto.html +++ b/tournaments/templates/tournaments/broadcast/broadcasted_auto.html @@ -200,6 +200,7 @@
+
{% if tournament.event.images.exists %} @@ -213,4 +214,94 @@
{% endif %} + + diff --git a/tournaments/templates/tournaments/broadcast/broadcasted_bracket.html b/tournaments/templates/tournaments/broadcast/broadcasted_bracket.html index c9f9529..0ca7970 100644 --- a/tournaments/templates/tournaments/broadcast/broadcasted_bracket.html +++ b/tournaments/templates/tournaments/broadcast/broadcasted_bracket.html @@ -43,6 +43,24 @@ padding: 20px; max-width: 45%; } + + /* Reduce font size for player names */ + .broadcast-mode .player .semibold { + font-size: 0.85em !important; + line-height: 1.2 !important; + } + + /* Reduce font size for team weight */ + .broadcast-mode .score.numbers { + font-size: 0.85em !important; + } + + /* Optional: Also reduce single/two player text if needed */ + .broadcast-mode .single-player .semibold, + .broadcast-mode .two-players .semibold { + font-size: 0.85em !important; + line-height: 1.2 !important; + } diff --git a/tournaments/templates/tournaments/broadcast/broadcasted_club_auto.html b/tournaments/templates/tournaments/broadcast/broadcasted_club_auto.html new file mode 100644 index 0000000..54d079b --- /dev/null +++ b/tournaments/templates/tournaments/broadcast/broadcasted_club_auto.html @@ -0,0 +1,63 @@ + + + + Club Auto Broadcast + + + + + + + + + diff --git a/tournaments/templates/tournaments/broadcast/broadcasted_event_auto.html b/tournaments/templates/tournaments/broadcast/broadcasted_event_auto.html new file mode 100644 index 0000000..69d8c90 --- /dev/null +++ b/tournaments/templates/tournaments/broadcast/broadcasted_event_auto.html @@ -0,0 +1,63 @@ + + + + Event Auto Broadcast + + + + + + + + + diff --git a/tournaments/templates/tournaments/broadcast/broadcasted_planning.html b/tournaments/templates/tournaments/broadcast/broadcasted_planning.html index 00f2385..fcf5241 100644 --- a/tournaments/templates/tournaments/broadcast/broadcasted_planning.html +++ b/tournaments/templates/tournaments/broadcast/broadcasted_planning.html @@ -267,7 +267,7 @@ this.currentDayIndex = 0; this.currentPageIndex = 0; } - }, 15000); + }, 20000); }, calculateFractionWidth() { diff --git a/tournaments/views.py b/tournaments/views.py index c8d9bb7..29a3434 100644 --- a/tournaments/views.py +++ b/tournaments/views.py @@ -521,18 +521,29 @@ def tournament_broadcast_home(request, tournament_id): def automatic_broadcast(request, tournament_id): tournament = get_object_or_404(Tournament, pk=tournament_id) - return render(request, 'tournaments/broadcast/broadcasted_auto.html', { + response = render(request, 'tournaments/broadcast/broadcasted_auto.html', { 'tournament': tournament, 'qr_code_url': qr_code_url(request, tournament_id), 'qr_code_options': qr_code_options(), }) + # Allow iframe embedding from same origin + response['X-Frame-Options'] = 'SAMEORIGIN' + return response def automatic_broadcast_event(request, event_id): event = get_object_or_404(Event, pk=event_id) tournaments = Tournament.objects.filter(event=event) tournament_ids = [str(tournament.id) for tournament in tournaments] - return render(request, 'tournaments/broadcast/broadcasted_auto_event.html', { + + # Create QR code URL for the event broadcast + qr_code_url_val = reverse('automatic-broadcast-event', args=[event_id]) + qr_code_url_full = request.build_absolute_uri(qr_code_url_val) + + return render(request, 'tournaments/broadcast/broadcasted_event_auto.html', { 'tournament_ids': tournament_ids, + 'event': event, + 'qr_code_url': qr_code_url_full, + 'qr_code_options': qr_code_options(), }) def qr_code_url(request, tournament_id): @@ -774,13 +785,10 @@ def club_broadcast_auto(request, broadcast_code): ) tournament_ids = [str(tournament.id) for tournament in tournaments] - #print(tournament_ids) - return render(request, 'tournaments/broadcast/broadcasted_auto_event.html', { + + return render(request, 'tournaments/broadcast/broadcasted_club_auto.html', { 'tournament_ids': tournament_ids, 'club_name': club.name, - 'qr_code_url': qr_code_url_with_query(request, club.id), - 'qr_code_options': qr_code_options(), - }) def download(request): From 34530f94c5b742cecbc51fdf86013fe817244019 Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Thu, 4 Sep 2025 19:08:33 +0200 Subject: [PATCH 2/8] Add null checks and handle empty lists in broadcast templates --- .../tournaments/broadcast/broadcast_base.html | 2 +- .../broadcast/broadcasted_auto.html | 28 ++-- .../broadcast/broadcasted_bracket.html | 2 +- .../broadcast/broadcasted_group_stages.html | 2 +- .../broadcast/broadcasted_matches.html | 2 +- .../broadcast/broadcasted_planning.html | 2 +- .../broadcast/broadcasted_prog.html | 2 +- tournaments/views.py | 121 ++++++++++++++++-- 8 files changed, 134 insertions(+), 27 deletions(-) diff --git a/tournaments/templates/tournaments/broadcast/broadcast_base.html b/tournaments/templates/tournaments/broadcast/broadcast_base.html index efa4206..cb21406 100644 --- a/tournaments/templates/tournaments/broadcast/broadcast_base.html +++ b/tournaments/templates/tournaments/broadcast/broadcast_base.html @@ -6,7 +6,7 @@ {% include 'tournaments/broadcast/base_head.html' %} - + {% block head_title %}Page Title{% endblock %} diff --git a/tournaments/templates/tournaments/broadcast/broadcasted_auto.html b/tournaments/templates/tournaments/broadcast/broadcasted_auto.html index e775f46..d2d3257 100644 --- a/tournaments/templates/tournaments/broadcast/broadcasted_auto.html +++ b/tournaments/templates/tournaments/broadcast/broadcasted_auto.html @@ -6,7 +6,7 @@ {% include 'tournaments/broadcast/base_head.html' %} - + Broadcast @@ -127,14 +127,18 @@ }, 15000) }, pageCount() { - return this.paginatedMatches.length + this.paginatedGroupStages.length + this.paginatedSummons.length + this.paginatedRankings.length + return (this.paginatedMatches?.length || 0) + (this.paginatedGroupStages?.length || 0) + (this.paginatedSummons?.length || 0) + (this.paginatedRankings?.length || 0) }, setPrefixTitle() { - if (this.active < 1 + this.paginatedSummons.length) { + const summonsLength = this.paginatedSummons?.length || 0; + const matchesLength = this.paginatedMatches?.length || 0; + const groupStagesLength = this.paginatedGroupStages?.length || 0; + + if (this.active < 1 + summonsLength) { this.prefixTitle = 'Convocations' - } else if (this.active < 1 + this.paginatedSummons.length + this.paginatedMatches.length) { + } else if (this.active < 1 + summonsLength + matchesLength) { this.prefixTitle = 'Matchs' - } else if (this.active < 1 + this.paginatedSummons.length + this.paginatedMatches.length + this.paginatedGroupStages.length) { + } else if (this.active < 1 + summonsLength + matchesLength + groupStagesLength) { this.prefixTitle = 'Poules' } else { this.prefixTitle = 'Classement' @@ -162,7 +166,7 @@
-