74 lines
3.6 KiB
ERB
74 lines
3.6 KiB
ERB
<% content_for :title, t("tournaments.hub.title", name: @tournament.name) %>
|
||
<% content_for :robots, "noindex, nofollow" %>
|
||
|
||
<div class="wrap wrap--portal tournament-hub" style="padding-top:20px">
|
||
<nav class="team-dashboard-nav">
|
||
<%= link_to "← #{t("tournaments.index.heading")}", public_club_tournaments_path(@club), class: "team-dashboard-nav__club" %>
|
||
</nav>
|
||
|
||
<header class="tournament-hub-header">
|
||
<div class="tournament-hub-header__identity">
|
||
<% logo = @tournament.effective_logo_url %>
|
||
<div class="tournament-hub-logo">
|
||
<div class="tournament-hub-logo__preview" aria-hidden="true">
|
||
<% if logo.present? %>
|
||
<%= image_tag logo, alt: "" %>
|
||
<% else %>
|
||
<span class="tournament-hub-logo__empty"><%= @tournament.name.to_s.first %></span>
|
||
<% end %>
|
||
</div>
|
||
<% if @writable %>
|
||
<%= form_with model: @tournament, url: public_tournament_path(@tournament), method: :patch,
|
||
html: { class: "tournament-hub-logo__form", multipart: true } do %>
|
||
<label class="btn btn-secondary tournament-hub-logo__btn">
|
||
<%= t("tournaments.hub.logo_file") %>
|
||
<%= file_field_tag "tournament[logo_file]", accept: "image/png,image/jpeg,image/webp", onchange: "this.form.requestSubmit()" %>
|
||
</label>
|
||
<% end %>
|
||
<% end %>
|
||
</div>
|
||
<div class="tournament-hub-header__text">
|
||
<h1><%= @tournament.name %></h1>
|
||
<p>
|
||
<%= @tournament.sport_label %>
|
||
· <%= l(@tournament.starts_on) %> – <%= l(@tournament.ends_on) %>
|
||
· <%= t("tournaments.status.#{@tournament.status}") %>
|
||
· <%= t("tournaments.form.formats.#{@tournament.format_kind}") %>
|
||
</p>
|
||
<% if @writable %>
|
||
<p class="tournament-hub-hint" style="margin:4px 0 0"><%= t("tournaments.hub.tournament_logo_hint") %></p>
|
||
<% end %>
|
||
</div>
|
||
</div>
|
||
<div class="tournament-hub-header__actions">
|
||
<% if @tournament.published? %>
|
||
<%= link_to t("tournaments.hub.public_page"), public_tournament_page_path(@tournament.slug), class: "btn btn-secondary", target: "_blank", rel: "noopener" %>
|
||
<% if @writable %>
|
||
<%= button_to t("tournaments.hub.unpublish"), public_unpublish_tournament_path(@tournament), method: :post, class: "btn btn-secondary" %>
|
||
<% end %>
|
||
<% elsif @writable %>
|
||
<%= button_to t("tournaments.hub.publish"), public_publish_tournament_path(@tournament), method: :post, class: "btn btn-primary" %>
|
||
<% end %>
|
||
<% if @writable && !@tournament.archived? %>
|
||
<%= button_to t("tournaments.hub.archive"), public_archive_tournament_path(@tournament), method: :post, class: "btn btn-secondary", form: { data: { turbo_confirm: t("tournaments.hub.archive") } } %>
|
||
<% end %>
|
||
<%= button_to t("tournaments.hub.delete"), public_tournament_path(@tournament), method: :delete, class: "btn btn-secondary",
|
||
form: { data: { turbo_confirm: t("tournaments.hub.delete_confirm", name: @tournament.name), confirm_kind: "delete" } } %>
|
||
</div>
|
||
</header>
|
||
|
||
<% @overlap_warnings.each do |warning| %>
|
||
<div class="flash alert"><%= warning %></div>
|
||
<% end %>
|
||
|
||
<nav style="display:flex;gap:8px;flex-wrap:wrap;margin-bottom:16px">
|
||
<% %w[squadre struttura calendario dirette tabellone].each do |tab| %>
|
||
<%= link_to t("tournaments.hub.tabs.#{tab}"), public_tournament_path(@tournament, tab: tab),
|
||
class: "btn #{@tab == tab ? 'btn-primary' : 'btn-secondary'}",
|
||
style: "padding:8px 14px;font-size:0.9rem" %>
|
||
<% end %>
|
||
</nav>
|
||
|
||
<%= render "public/tournaments/tab_#{@tab}" %>
|
||
</div>
|