|
|
|
@@ -3,48 +3,46 @@
|
|
|
|
|
<% filter_params = @archive_filter_params %>
|
|
|
|
|
|
|
|
|
|
<div class="replay-archive<%= " replay-archive--admin" if local_assigns[:admin_mode] %>">
|
|
|
|
|
<p style="margin-bottom:16px"><%= link_to "← #{@club.name}", paths.back %></p>
|
|
|
|
|
<p style="margin-bottom:16px"><%= link_to "#{t('recordings.archive.back_prefix')} #{@club.name}", paths.back %></p>
|
|
|
|
|
|
|
|
|
|
<h1>Archivio Replay<% if local_assigns[:admin_mode] %> <span class="muted" style="font-size:0.85rem;font-weight:400">(admin)</span><% end %></h1>
|
|
|
|
|
<h1><%= t("recordings.archive.heading") %><% if local_assigns[:admin_mode] %> <span class="muted" style="font-size:0.85rem;font-weight:400"><%= t("recordings.archive.admin_suffix") %></span><% end %></h1>
|
|
|
|
|
<p class="muted">
|
|
|
|
|
Gestisci registrazioni, visibilità e download.
|
|
|
|
|
<strong>Privato</strong> = link non indicizzato, non compare in <code>/replay</code> pubblico.
|
|
|
|
|
Eliminando un replay vengono rimossi anche i file sul server e il video YouTube collegato.
|
|
|
|
|
<%= raw t("recordings.archive.lead_html") %>
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<div class="kpi-grid replay-archive__kpis">
|
|
|
|
|
<div class="card replay-archive__kpi">
|
|
|
|
|
<div class="kpi-value"><%= @stats[:available_count] %></div>
|
|
|
|
|
<div class="kpi-sub">Replay disponibili</div>
|
|
|
|
|
<div class="kpi-sub"><%= t("recordings.archive.kpi_available") %></div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="card replay-archive__kpi">
|
|
|
|
|
<div class="kpi-value"><%= @stats[:expiring_soon_count] %></div>
|
|
|
|
|
<div class="kpi-sub">In scadenza (7 gg)</div>
|
|
|
|
|
<div class="kpi-sub"><%= t("recordings.archive.kpi_expiring") %></div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="card replay-archive__kpi">
|
|
|
|
|
<div class="kpi-value"><%= number_to_human_size(@stats[:total_bytes]) %></div>
|
|
|
|
|
<div class="kpi-sub">Spazio archivio</div>
|
|
|
|
|
<div class="kpi-sub"><%= t("recordings.archive.kpi_space") %></div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="card replay-archive__kpi">
|
|
|
|
|
<div class="kpi-value"><%= @stats[:total_views] %></div>
|
|
|
|
|
<div class="kpi-sub">Visualizzazioni totali</div>
|
|
|
|
|
<div class="kpi-sub"><%= t("recordings.archive.kpi_views") %></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<%= form_with url: paths.index, method: :get, local: true, class: "replay-filter-form" do %>
|
|
|
|
|
<label for="team_id" class="muted">Squadra</label>
|
|
|
|
|
<label for="team_id" class="muted"><%= t("recordings.archive.team_label") %></label>
|
|
|
|
|
<select name="team_id" id="team_id" class="input" onchange="this.form.submit()">
|
|
|
|
|
<option value="">Tutte</option>
|
|
|
|
|
<option value=""><%= t("recordings.archive.team_all") %></option>
|
|
|
|
|
<% @teams.each do |team| %>
|
|
|
|
|
<option value="<%= team.id %>"<%= " selected" if @filter_team_id.to_s == team.id.to_s %>><%= team.name %></option>
|
|
|
|
|
<% end %>
|
|
|
|
|
</select>
|
|
|
|
|
<label for="status" class="muted">Stato</label>
|
|
|
|
|
<label for="status" class="muted"><%= t("recordings.archive.status_label") %></label>
|
|
|
|
|
<select name="status" id="status" class="input" onchange="this.form.submit()">
|
|
|
|
|
<option value="">Tutti</option>
|
|
|
|
|
<option value="ready"<%= " selected" if @filter_status == "ready" %>>Disponibili</option>
|
|
|
|
|
<option value="processing"<%= " selected" if @filter_status == "processing" %>>In elaborazione</option>
|
|
|
|
|
<option value="expired"<%= " selected" if @filter_status == "expired" %>>Scaduti / errore</option>
|
|
|
|
|
<option value=""><%= t("recordings.archive.status_all") %></option>
|
|
|
|
|
<option value="ready"<%= " selected" if @filter_status == "ready" %>><%= t("recordings.archive.status_ready") %></option>
|
|
|
|
|
<option value="processing"<%= " selected" if @filter_status == "processing" %>><%= t("recordings.archive.status_processing") %></option>
|
|
|
|
|
<option value="expired"<%= " selected" if @filter_status == "expired" %>><%= t("recordings.archive.status_expired") %></option>
|
|
|
|
|
</select>
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
|
@@ -53,12 +51,12 @@
|
|
|
|
|
<table class="data replay-archive-table">
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th class="replay-archive-table__col-thumb" scope="col"><span class="visually-hidden">Anteprima</span></th>
|
|
|
|
|
<th scope="col">Partita</th>
|
|
|
|
|
<th scope="col">Squadra</th>
|
|
|
|
|
<th scope="col">Dettagli</th>
|
|
|
|
|
<th scope="col">Stato e visibilità</th>
|
|
|
|
|
<th class="replay-archive-table__col-actions" scope="col">Azioni</th>
|
|
|
|
|
<th class="replay-archive-table__col-thumb" scope="col"><span class="visually-hidden"><%= t("recordings.archive.col_preview") %></span></th>
|
|
|
|
|
<th scope="col"><%= t("recordings.archive.col_match") %></th>
|
|
|
|
|
<th scope="col"><%= t("recordings.archive.col_team") %></th>
|
|
|
|
|
<th scope="col"><%= t("recordings.archive.col_details") %></th>
|
|
|
|
|
<th scope="col"><%= t("recordings.archive.col_status") %></th>
|
|
|
|
|
<th class="replay-archive-table__col-actions" scope="col"><%= t("recordings.archive.col_actions") %></th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
@@ -68,7 +66,7 @@
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="replay-archive-table__col-thumb">
|
|
|
|
|
<% if can_play %>
|
|
|
|
|
<%= link_to rec.replay_url, class: "replay-archive__thumb", target: "_blank", rel: "noopener", title: "Guarda replay" do %>
|
|
|
|
|
<%= link_to rec.replay_url, class: "replay-archive__thumb", target: "_blank", rel: "noopener", title: t("recordings.archive.watch_replay") do %>
|
|
|
|
|
<% if rec.thumbnail_url %>
|
|
|
|
|
<img src="<%= rec.thumbnail_url %>" alt="" class="replay-archive__thumb-img" width="80" height="45" loading="lazy">
|
|
|
|
|
<% else %>
|
|
|
|
@@ -77,7 +75,7 @@
|
|
|
|
|
<span class="replay-archive__play-btn" aria-hidden="true">▶</span>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% else %>
|
|
|
|
|
<div class="replay-archive__thumb replay-archive__thumb--static" title="<%= rec.status == "processing" ? "Elaborazione in corso" : "Replay non disponibile" %>">
|
|
|
|
|
<div class="replay-archive__thumb replay-archive__thumb--static" title="<%= rec.status == "processing" ? t("recordings.archive.processing_title") : t("recordings.archive.not_available_title") %>">
|
|
|
|
|
<% if rec.thumbnail_url %>
|
|
|
|
|
<img src="<%= rec.thumbnail_url %>" alt="" class="replay-archive__thumb-img" width="80" height="45" loading="lazy">
|
|
|
|
|
<% else %>
|
|
|
|
@@ -100,16 +98,16 @@
|
|
|
|
|
<span class="replay-archive__detail-line">
|
|
|
|
|
<%= l_local(rec.recorded_at_or_fallback, format: :short) %>
|
|
|
|
|
· <%= rec.duration_label %>
|
|
|
|
|
· <%= rec.view_count %> vis.
|
|
|
|
|
· <%= rec.view_count %> <%= t("recordings.archive.views_suffix") %>
|
|
|
|
|
</span>
|
|
|
|
|
<span class="replay-archive__meta-line">
|
|
|
|
|
<% if rec.expires_at %>
|
|
|
|
|
Scade <%= l_local(rec.expires_at, format: :short) %>
|
|
|
|
|
<%= t("recordings.archive.expires_prefix") %> <%= l_local(rec.expires_at, format: :short) %>
|
|
|
|
|
<% if rec.days_until_expiry && rec.days_until_expiry.positive? %>
|
|
|
|
|
(<%= rec.days_until_expiry %> gg)
|
|
|
|
|
<%= t("recordings.archive.expires_days", count: rec.days_until_expiry) %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% else %>
|
|
|
|
|
Nessuna scadenza
|
|
|
|
|
<%= t("recordings.archive.no_expiry") %>
|
|
|
|
|
<% end %>
|
|
|
|
|
</span>
|
|
|
|
|
<% if local_assigns[:admin_mode] && !rec.deleted? && rec.expires_at.present? %>
|
|
|
|
@@ -119,16 +117,16 @@
|
|
|
|
|
rec.expires_at.to_date,
|
|
|
|
|
min: Date.tomorrow,
|
|
|
|
|
class: "replay-archive__expiry-input",
|
|
|
|
|
title: "Nuova data di scadenza" %>
|
|
|
|
|
<%= submit_tag "Salva", class: "replay-archive__expiry-save" %>
|
|
|
|
|
title: t("recordings.archive.new_expiry_title") %>
|
|
|
|
|
<%= submit_tag t("recordings.archive.save"), class: "replay-archive__expiry-save" %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<div class="replay-archive__expiry-quick">
|
|
|
|
|
<% [[30, "+30 gg"], [90, "+90 gg"], [180, "+180 gg"]].each do |days, label| %>
|
|
|
|
|
<%= button_to label, paths.update.call(rec),
|
|
|
|
|
<% [30, 90, 180].each do |days| %>
|
|
|
|
|
<%= button_to t("recordings.archive.extend_days", count: days), paths.update.call(rec),
|
|
|
|
|
method: :patch,
|
|
|
|
|
params: filter_params.merge(recording: { extend_days: days }),
|
|
|
|
|
class: "replay-archive__expiry-extend",
|
|
|
|
|
title: "Prolunga la scadenza di #{days} giorni" %>
|
|
|
|
|
title: t("recordings.archive.extend_title", count: days) %>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
@@ -139,8 +137,8 @@
|
|
|
|
|
<td class="replay-archive-table__col-actions">
|
|
|
|
|
<div class="replay-archive__actions">
|
|
|
|
|
<% next_privacy = rec.publicly_listed? ? "unlisted" : "public" %>
|
|
|
|
|
<% privacy_label = rec.publicly_listed? ? "Pubblico" : "Privato" %>
|
|
|
|
|
<% privacy_hint = rec.publicly_listed? ? "Visibile a tutti — clicca per rendere privato" : "Solo con link — clicca per rendere pubblico" %>
|
|
|
|
|
<% privacy_label = rec.publicly_listed? ? t("recordings.archive.privacy_public") : t("recordings.archive.privacy_private") %>
|
|
|
|
|
<% privacy_hint = rec.publicly_listed? ? t("recordings.archive.privacy_hint_public") : t("recordings.archive.privacy_hint_private") %>
|
|
|
|
|
<%= button_to paths.update.call(rec),
|
|
|
|
|
method: :patch,
|
|
|
|
|
params: filter_params.merge(recording: { privacy_status: next_privacy }),
|
|
|
|
@@ -161,26 +159,27 @@
|
|
|
|
|
<span class="visually-hidden"><%= privacy_label %></span>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% if ent.phone_download_enabled? && rec.ready? %>
|
|
|
|
|
<%= link_to "MP4", public_replay_download_path(rec.stream_session_id), class: "replay-archive__action replay-archive__action--secondary", title: "Scarica MP4" %>
|
|
|
|
|
<%= link_to "MP4", public_replay_download_path(rec.stream_session_id), class: "replay-archive__action replay-archive__action--secondary", title: t("recordings.archive.download_mp4_title") %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% if ent.premium_full? && ent.youtube_enabled? && rec.ready? && rec.youtube_video_id.blank? %>
|
|
|
|
|
<%= button_to "YT", paths.publish_youtube.call(rec), method: :post, class: "replay-archive__action replay-archive__action--secondary", title: "Pubblica su YouTube", form: { class: "replay-archive__action-form" } %>
|
|
|
|
|
<%= button_to "YT", paths.publish_youtube.call(rec), method: :post, class: "replay-archive__action replay-archive__action--secondary", title: t("recordings.archive.publish_youtube_title"), form: { class: "replay-archive__action-form" } %>
|
|
|
|
|
<% elsif rec.youtube_watch_url %>
|
|
|
|
|
<%= link_to "YT", rec.youtube_watch_url, class: "replay-archive__action replay-archive__action--secondary", target: "_blank", rel: "noopener", title: "Apri su YouTube" %>
|
|
|
|
|
<%= link_to "YT", rec.youtube_watch_url, class: "replay-archive__action replay-archive__action--secondary", target: "_blank", rel: "noopener", title: t("recordings.archive.open_youtube_title") %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% has_youtube = rec.youtube_video_id.present? && !rec.youtube_video_id.to_s.start_with?("mock_") %>
|
|
|
|
|
<% has_site = rec.storage_key.present? || %w[ready processing failed].include?(rec.status) %>
|
|
|
|
|
<% delete_confirm = "Scegli dove eliminare il replay. L'operazione è irreversibile." %>
|
|
|
|
|
<% delete_confirm = t("recordings.archive.delete_confirm") %>
|
|
|
|
|
<%= button_to paths.destroy.call(rec), method: :delete,
|
|
|
|
|
params: filter_params,
|
|
|
|
|
class: "replay-archive__action replay-archive__action--danger",
|
|
|
|
|
title: "Elimina replay",
|
|
|
|
|
title: t("recordings.archive.delete_title"),
|
|
|
|
|
form: {
|
|
|
|
|
class: "replay-archive__action-form",
|
|
|
|
|
data: {
|
|
|
|
|
confirm: delete_confirm,
|
|
|
|
|
turbo_confirm: delete_confirm,
|
|
|
|
|
confirm_mode: "delete-replay",
|
|
|
|
|
confirm_kind: "delete",
|
|
|
|
|
has_site: has_site ? "1" : "0",
|
|
|
|
|
has_youtube: has_youtube ? "1" : "0"
|
|
|
|
|
}
|
|
|
|
@@ -195,6 +194,6 @@
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
<% else %>
|
|
|
|
|
<p class="muted">Nessuna registrazione per i filtri selezionati.</p>
|
|
|
|
|
<p class="muted"><%= t("recordings.archive.no_recordings") %></p>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|