Rende usabili calendario, overlay ospite e stato diretta del cartellone.

Il calendario non deve più scorrere in orizzontale, il logo a destra non copre il nome e una diretta YouTube o in collegamento compare come In diretta.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-06 09:55:08 +02:00
co-authored by Cursor
parent b09e83db09
commit c3ef8e91a6
13 changed files with 296 additions and 108 deletions
@@ -8,88 +8,105 @@
<% if @matches.any? %>
<p class="tournament-hub-hint" style="margin-top:16px"><%= t("tournaments.hub.calendar_edit_hint") %></p>
<div class="tournament-table-wrap">
<table class="data tournament-match-table" data-swap-error="<%= t("flash.tournaments.sides_swap_failed") %>">
<thead>
<tr>
<th><%= t("tournaments.hub.datetime") %></th>
<th><%= t("tournaments.hub.court") %></th>
<th><%= t("tournaments.hub.round") %></th>
<th><%= t("tournaments.hub.home") %></th>
<th class="tournament-match-swap-col"></th>
<th><%= t("tournaments.hub.away") %></th>
<th><%= t("tournaments.hub.result") %></th>
<th></th>
</tr>
</thead>
<tbody>
<% @matches.each do |match| %>
<% form_id = "match-edit-#{match.id}" %>
<% courts = (@tournament.court_list + [match.court]).compact_blank.uniq %>
<%= form_with url: public_tournament_match_path(@tournament, match), method: :patch, html: { id: form_id, class: "visually-hidden" } do %>
<%= hidden_field_tag :tab, @tab, form: form_id %>
<% end %>
<tr>
<% if @writable %>
<td>
<%= datetime_local_field_tag "match[scheduled_at]", tournament_datetime_local(match.scheduled_at),
id: "match_at_#{match.id}", form: form_id, required: true, class: "tournament-match-form__datetime" %>
</td>
<td>
<%= select_tag "match[court]", options_for_select(courts, match.court),
id: "match_court_#{match.id}", form: form_id, include_blank: true, class: "tournament-match-form__court" %>
</td>
<td><%= tournament_phase_label(match) %></td>
<td data-swap-side="home"><%= render "public/tournaments/match_side_select", match: match, side: :home, form_id: form_id %></td>
<td class="tournament-match-swap-col">
<%= button_to public_swap_tournament_match_path(@tournament, match), method: :post,
class: "tournament-match-swap__btn",
title: t("tournaments.hub.swap_sides"),
form: { class: "tournament-match-swap__form", data: { turbo: false } } do %>
<i class="fa-solid fa-right-left" aria-hidden="true"></i>
<span class="visually-hidden"><%= t("tournaments.hub.swap_sides") %></span>
<% end %>
</td>
<td data-swap-side="away"><%= render "public/tournaments/match_side_select", match: match, side: :away, form_id: form_id %></td>
<td>
<% if match.played? || match.result_status.to_s.start_with?("walkover") %>
<span data-swap-played-score><%= match.home_score %><%= match.away_score %></span>
<% else %>
<span class="tournament-match-form__score">
<%= number_field_tag :home_score, match.home_score, id: "home_score_#{match.id}", form: form_id, data: { swap_score: "home" } %>
<span></span>
<%= number_field_tag :away_score, match.away_score, id: "away_score_#{match.id}", form: form_id, data: { swap_score: "away" } %>
</span>
<% end %>
</td>
<td class="tournament-match-form__actions">
<%= submit_tag t("tournaments.hub.save_match"), form: form_id, class: "btn btn-secondary tournament-match-form__save" %>
<% if match.deletable? %>
<%= button_to t("matches.index.delete"), public_tournament_match_path(@tournament, match),
method: :delete, class: "btn btn-secondary tournament-match-form__save",
form: { class: "tournament-match-delete-form", data: { turbo_confirm: match.matchup_label } } %>
<% end %>
</td>
<% else %>
<td><%= match.scheduled_at ? l(match.scheduled_at, format: :short) : "—" %></td>
<td><%= match.court || "—" %></td>
<td><%= tournament_phase_label(match) %></td>
<td><%= tournament_team_chip(match.home_participant, name: match.home_display_name) %></td>
<td class="tournament-match-swap-col"></td>
<td><%= tournament_team_chip(match.away_participant, name: match.away_display_name) %></td>
<td>
<div class="tournament-match-list tournament-match-table" data-swap-error="<%= t("flash.tournaments.sides_swap_failed") %>">
<% @matches.each do |match| %>
<% form_id = "match-edit-#{match.id}" %>
<% courts = (@tournament.court_list + [match.court]).compact_blank.uniq %>
<%= form_with url: public_tournament_match_path(@tournament, match), method: :patch, html: { id: form_id, class: "visually-hidden" } do %>
<%= hidden_field_tag :tab, @tab, form: form_id %>
<% end %>
<article class="tournament-match-row">
<% if @writable %>
<div class="tournament-match-row__field">
<label for="match_at_<%= match.id %>"><%= t("tournaments.hub.datetime") %></label>
<%= datetime_local_field_tag "match[scheduled_at]", tournament_datetime_local(match.scheduled_at),
id: "match_at_#{match.id}", form: form_id, required: true, class: "tournament-match-form__datetime" %>
</div>
<div class="tournament-match-row__field">
<label for="match_court_<%= match.id %>"><%= t("tournaments.hub.court") %></label>
<%= select_tag "match[court]", options_for_select(courts, match.court),
id: "match_court_#{match.id}", form: form_id, include_blank: true, class: "tournament-match-form__court" %>
</div>
<div class="tournament-match-row__field tournament-match-row__field--phase">
<span class="tournament-match-row__label"><%= t("tournaments.hub.round") %></span>
<p class="tournament-match-row__phase"><%= tournament_phase_label(match) %></p>
</div>
<div class="tournament-match-row__sides">
<div class="tournament-match-row__side">
<span class="tournament-match-row__label"><%= t("tournaments.hub.home") %></span>
<div data-swap-side="home"><%= render "public/tournaments/match_side_select", match: match, side: :home, form_id: form_id %></div>
</div>
<div class="tournament-match-swap-col">
<%= button_to public_swap_tournament_match_path(@tournament, match), method: :post,
class: "tournament-match-swap__btn",
title: t("tournaments.hub.swap_sides"),
form: { class: "tournament-match-swap__form", data: { turbo: false } } do %>
<i class="fa-solid fa-right-left" aria-hidden="true"></i>
<span class="visually-hidden"><%= t("tournaments.hub.swap_sides") %></span>
<% end %>
</div>
<div class="tournament-match-row__side">
<span class="tournament-match-row__label"><%= t("tournaments.hub.away") %></span>
<div data-swap-side="away"><%= render "public/tournaments/match_side_select", match: match, side: :away, form_id: form_id %></div>
</div>
<div class="tournament-match-row__score">
<span class="tournament-match-row__label"><%= t("tournaments.hub.result") %></span>
<% if match.played? || match.result_status.to_s.start_with?("walkover") %>
<p data-swap-played-score><%= match.home_score %><%= match.away_score %></p>
<% else %>
<span class="tournament-match-form__score">
<%= number_field_tag :home_score, match.home_score, id: "home_score_#{match.id}", form: form_id, data: { swap_score: "home" } %>
<span></span>
<%= number_field_tag :away_score, match.away_score, id: "away_score_#{match.id}", form: form_id, data: { swap_score: "away" } %>
</span>
<% end %>
</div>
</div>
<div class="tournament-match-form__actions tournament-match-row__actions">
<%= submit_tag t("tournaments.hub.save_match"), form: form_id, class: "btn btn-secondary tournament-match-form__save" %>
<% if match.deletable? %>
<%= button_to t("matches.index.delete"), public_tournament_match_path(@tournament, match),
method: :delete, class: "btn btn-secondary tournament-match-form__save",
form: { class: "tournament-match-delete-form", data: { turbo_confirm: match.matchup_label } } %>
<% end %>
</div>
<% else %>
<div class="tournament-match-row__field">
<span class="tournament-match-row__label"><%= t("tournaments.hub.datetime") %></span>
<p class="tournament-match-row__phase"><%= match.scheduled_at ? l(match.scheduled_at, format: :short) : "—" %></p>
</div>
<div class="tournament-match-row__field">
<span class="tournament-match-row__label"><%= t("tournaments.hub.court") %></span>
<p class="tournament-match-row__phase"><%= match.court || "—" %></p>
</div>
<div class="tournament-match-row__field tournament-match-row__field--phase">
<span class="tournament-match-row__label"><%= t("tournaments.hub.round") %></span>
<p class="tournament-match-row__phase"><%= tournament_phase_label(match) %></p>
</div>
<div class="tournament-match-row__sides">
<div class="tournament-match-row__side">
<span class="tournament-match-row__label"><%= t("tournaments.hub.home") %></span>
<%= tournament_team_chip(match.home_participant, name: match.home_display_name) %>
</div>
<div class="tournament-match-swap-col" aria-hidden="true"></div>
<div class="tournament-match-row__side">
<span class="tournament-match-row__label"><%= t("tournaments.hub.away") %></span>
<%= tournament_team_chip(match.away_participant, name: match.away_display_name) %>
</div>
<div class="tournament-match-row__score">
<span class="tournament-match-row__label"><%= t("tournaments.hub.result") %></span>
<p>
<% if match.home_score.present? %>
<%= match.home_score %><%= match.away_score %>
<% else %>
<% end %>
</td>
<td></td>
<% end %>
</tr>
</p>
</div>
</div>
<% end %>
</tbody>
</table>
</article>
<% end %>
</div>
<% else %>
<p class="tournament-hub-hint" style="margin-top:16px"><%= t("tournaments.hub.no_matches") %></p>