Aggiunge annunci in-app/sito, contatti e migliora UI copertina sul portale.

Include admin/API/banner nativi, form contatti e reset copertina standard con layout edit più ampio.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-20 15:30:49 +02:00
co-authored by Cursor
parent e502844b88
commit 5b723bf844
81 changed files with 2177 additions and 38 deletions
@@ -0,0 +1,79 @@
<%= form_with model: announcement, url: (announcement.persisted? ? admin_announcement_path(announcement) : admin_announcements_path),
method: (announcement.persisted? ? :patch : :post), local: true, class: "admin-form" do |f| %>
<div class="admin-form-row">
<div>
<%= f.label :kind, t("admin.announcements.form.kind") %>
<%= f.select :kind, AppAnnouncement::KINDS.map { |k| [t("admin.announcements.kind.#{k}"), k] } %>
</div>
<div>
<%= f.label :severity, t("admin.announcements.form.severity") %>
<%= f.select :severity, AppAnnouncement::SEVERITIES.map { |k| [t("admin.announcements.severity.#{k}"), k] } %>
</div>
</div>
<div>
<%= f.label :status, t("admin.announcements.form.status") %>
<%= f.select :status, AppAnnouncement::STATUSES.map { |k| [t("admin.announcements.status.#{k}"), k] } %>
</div>
<fieldset class="admin-channels">
<legend><%= t("admin.announcements.form.channels") %></legend>
<label class="admin-checkbox">
<%= f.check_box :show_on_app %>
<span><%= t("admin.announcements.channels.app") %></span>
</label>
<label class="admin-checkbox">
<%= f.check_box :show_on_web_public %>
<span><%= t("admin.announcements.channels.web_public") %></span>
</label>
<label class="admin-checkbox">
<%= f.check_box :show_on_web_private %>
<span><%= t("admin.announcements.channels.web_private") %></span>
</label>
<p class="muted admin-form-hint"><%= t("admin.announcements.form.channels_hint") %></p>
</fieldset>
<div>
<%= f.label :title, t("admin.announcements.form.title") %>
<%= f.text_field :title, required: true, maxlength: 120 %>
</div>
<div>
<%= f.label :body, t("admin.announcements.form.body") %>
<%= f.text_area :body, required: true, rows: 5, maxlength: 2000 %>
</div>
<div class="admin-form-row">
<div>
<%= f.label :starts_at, t("admin.announcements.form.starts_at") %>
<%= f.datetime_field :starts_at, value: announcement.starts_at&.in_time_zone&.strftime("%Y-%m-%dT%H:%M") %>
</div>
<div>
<%= f.label :ends_at, t("admin.announcements.form.ends_at") %>
<%= f.datetime_field :ends_at, value: announcement.ends_at&.in_time_zone&.strftime("%Y-%m-%dT%H:%M") %>
</div>
</div>
<p class="muted admin-form-hint"><%= t("admin.announcements.form.window_hint") %></p>
<div>
<%= f.label :action_url, t("admin.announcements.form.action_url") %>
<%= f.url_field :action_url, placeholder: "https://" %>
</div>
<p class="muted admin-form-hint"><%= t("admin.announcements.form.action_url_hint") %></p>
<div>
<%= f.label :action_label, t("admin.announcements.form.action_label") %>
<%= f.text_field :action_label, maxlength: 40 %>
</div>
<label class="admin-checkbox">
<%= f.check_box :dismissible %>
<span><%= t("admin.announcements.form.dismissible") %></span>
</label>
<p class="muted admin-form-hint"><%= t("admin.announcements.form.dismissible_hint") %></p>
<div class="admin-form-actions">
<%= f.submit (announcement.persisted? ? t("admin.announcements.form.submit_update") : t("admin.announcements.form.submit_create")), class: "admin-btn admin-btn--primary" %>
<%= link_to t("admin.announcements.form.cancel"), admin_announcements_path, class: "admin-btn admin-btn--outline" %>
</div>
<% end %>
@@ -0,0 +1,9 @@
<% content_for :body_class, "admin-body" %>
<div class="admin-page-head">
<h2 class="admin-page-title"><%= t("admin.announcements.edit.title") %></h2>
</div>
<div class="panel">
<%= render "form", announcement: @announcement %>
</div>
@@ -0,0 +1,56 @@
<% content_for :body_class, "admin-body" %>
<div class="admin-page-head">
<h2 class="admin-page-title"><%= t("admin.announcements.index.title") %></h2>
<p class="muted admin-page-sub"><%= t("admin.announcements.index.lead") %></p>
</div>
<div class="panel" style="margin-bottom:1.5rem">
<div class="admin-toolbar">
<%= link_to t("admin.announcements.index.new"), new_admin_announcement_path, class: "admin-btn admin-btn--primary" %>
</div>
</div>
<div class="panel">
<h2><%= t("admin.announcements.index.table_title") %></h2>
<% if @announcements.any? %>
<div class="admin-table-wrap">
<table class="admin-table">
<thead>
<tr>
<th><%= t("admin.announcements.table.status") %></th>
<th><%= t("admin.announcements.table.kind") %></th>
<th><%= t("admin.announcements.table.title") %></th>
<th><%= t("admin.announcements.table.channels") %></th>
<th><%= t("admin.announcements.table.window") %></th>
<th></th>
</tr>
</thead>
<tbody>
<% @announcements.each do |item| %>
<tr>
<td>
<span class="badge badge--<%= announcement_status_badge(item) %>"><%= t("admin.announcements.status.#{item.status}") %></span>
</td>
<td class="muted"><%= t("admin.announcements.kind.#{item.kind}") %></td>
<td>
<strong><%= item.title %></strong>
<div class="muted" style="font-size:0.85rem;margin-top:0.25rem"><%= truncate(item.body, length: 90) %></div>
</td>
<td class="muted"><%= announcement_channels_label(item) %></td>
<td class="muted"><%= announcement_window_label(item) %></td>
<td class="admin-actions">
<%= link_to t("admin.announcements.actions.edit"), edit_admin_announcement_path(item), class: "admin-btn admin-btn--sm" %>
<%= button_to t("admin.announcements.actions.delete"), admin_announcement_path(item), method: :delete,
class: "admin-btn admin-btn--sm admin-btn--danger",
form: { data: { confirm: t("admin.announcements.actions.delete_confirm") } } %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% else %>
<p class="empty"><%= t("admin.announcements.index.none") %></p>
<% end %>
</div>
@@ -0,0 +1,9 @@
<% content_for :body_class, "admin-body" %>
<div class="admin-page-head">
<h2 class="admin-page-title"><%= t("admin.announcements.new.title") %></h2>
</div>
<div class="panel">
<%= render "form", announcement: @announcement %>
</div>
@@ -0,0 +1,13 @@
<p><strong><%= t("mailers.contact.heading") %></strong></p>
<p>
<%= t("mailers.contact.name") %> <%= @name %><br>
<%= t("mailers.contact.email") %> <%= @email %><br>
<%= t("mailers.contact.club") %> <%= @club_name.presence || t("mailers.contact.club_none") %><br>
<%= t("mailers.contact.topic") %> <%= t("mailers.contact.topic_labels.#{@topic}") %>
</p>
<p><%= t("mailers.contact.message") %></p>
<p style="white-space:pre-wrap"><%= @message %></p>
<p style="color:#666;font-size:12px"><%= t("mailers.contact.footer") %></p>
@@ -0,0 +1,11 @@
<%= t("mailers.contact.heading") %>
<%= t("mailers.contact.name") %> <%= @name %>
<%= t("mailers.contact.email") %> <%= @email %>
<%= t("mailers.contact.club") %> <%= @club_name.presence || t("mailers.contact.club_none") %>
<%= t("mailers.contact.topic") %> <%= t("mailers.contact.topic_labels.#{@topic}") %>
<%= t("mailers.contact.message") %>
<%= @message %>
<%= t("mailers.contact.footer") %>
+2 -1
View File
@@ -4,7 +4,7 @@
<title><%= t("admin.layout.title") %></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex, nofollow">
<link rel="stylesheet" href="/admin.css?v=4">
<link rel="stylesheet" href="/admin.css?v=6">
<% if content_for?(:replay_archive_styles) %>
<link rel="stylesheet" href="/marketing.css?v=42">
<% end %>
@@ -25,6 +25,7 @@
<%= link_to admin_ops_path, class: ("active" if controller_name == "ops") do %>
<%= t("admin.layout.nav.ops") %><% if ops_critical.positive? %> <span class="admin-nav-badge"><%= ops_critical %></span><% end %>
<% end %>
<%= link_to t("admin.layout.nav.announcements"), admin_announcements_path, class: ("active" if controller_name == "announcements") %>
<%= link_to t("admin.layout.nav.clubs"), admin_clubs_path, class: ("active" if controller_name.in?(%w[clubs teams club_recordings])) %>
<%= link_to t("admin.layout.nav.billing"), admin_billing_path, class: ("active" if controller_name.in?(%w[billing billing_invoices])) %>
<%= link_to t("admin.layout.nav.youtube"), admin_youtube_platform_path, class: ("active" if controller_name == "youtube") %>
+2 -1
View File
@@ -8,11 +8,12 @@
<%= render "shared/meta_tags" %>
<%= yield :head %>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css" integrity="sha512-SnH5WK+bZxgPHs44uWIX+LLJAJ9/2PkPKZ5QiAj6Ta86w+fsb2TkcmfRyVX3pBnMFcV7oQPJkl9QevSCWr3W6A==" crossorigin="anonymous" referrerpolicy="no-referrer">
<link rel="stylesheet" href="/marketing.css?v=64">
<link rel="stylesheet" href="/marketing.css?v=67">
</head>
<body data-confirm-i18n='<%= raw confirm_dialog_i18n_json %>'<% if MatchLiveTv.google_analytics_configured? %> data-ga-id="<%= MatchLiveTv.google_analytics_measurement_id %>"<% end %>>
<%= render "shared/cookie_banner" %>
<%= render(@app_store_review_chrome ? "shared/marketing_nav_app_store" : "shared/marketing_nav") %>
<%= render "shared/site_announcements" %>
<main>
<% if flash[:notice] %><div class="wrap"><div class="flash notice"><%= flash[:notice] %></div></div><% end %>
<% if flash[:alert] %><div class="wrap"><div class="flash alert"><%= flash[:alert] %></div></div><% end %>
@@ -6,13 +6,14 @@
<title><%= content_for?(:title) ? yield(:title) : "Match Live TV" %></title>
<%= render "shared/meta_tags" %>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css" integrity="sha512-SnH5WK+bZxgPHs44uWIX+LLJAJ9/2PkPKZ5QiAj6Ta86w+fsb2TkcmfRyVX3pBnMFcV7oQPJkl9QevSCWr3W6A==" crossorigin="anonymous" referrerpolicy="no-referrer">
<link rel="stylesheet" href="/marketing.css?v=64">
<link rel="stylesheet" href="/marketing.css?v=67">
<link rel="stylesheet" href="/live.css?v=26">
<%= yield :head %>
</head>
<body data-confirm-i18n='<%= raw confirm_dialog_i18n_json %>'<% if MatchLiveTv.google_analytics_configured? %> data-ga-id="<%= MatchLiveTv.google_analytics_measurement_id %>"<% end %>>
<%= render "shared/cookie_banner" %>
<%= render "shared/marketing_nav" %>
<%= render "shared/site_announcements" %>
<main class="live-main">
<%= yield %>
</main>
+1 -1
View File
@@ -1,7 +1,7 @@
<% content_for :title, t("club.edit.title", name: @club.name) %>
<% content_for :robots, "noindex, nofollow" %>
<div class="wrap" style="padding-top:20px;max-width:560px">
<div class="wrap wrap--portal" style="padding-top:20px">
<h1><%= t("club.edit.heading") %></h1>
<div class="card">
<%= form_with url: public_club_path(@club), method: :patch, multipart: true do %>
@@ -0,0 +1,124 @@
<% content_for :title, t("pages.contacts.meta_title") %>
<% content_for :meta_description, t("pages.contacts.meta_description") %>
<% content_for :canonical_url, seo_absolute_url(public_contatti_path) %>
<article class="contacts-page">
<header class="features-hero contacts-hero">
<div class="wrap">
<p class="features-hero__eyebrow"><%= t("pages.contacts.eyebrow") %></p>
<h1><%= t("pages.contacts.title") %></h1>
<p class="features-hero__lead"><%= t("pages.contacts.lead") %></p>
<p class="contacts-hero__meta"><%= t("pages.contacts.response_time") %></p>
</div>
</header>
<section class="section wrap" aria-label="<%= t("pages.contacts.title") %>">
<div class="contacts-channels">
<article class="feature-card">
<span class="feature-card__icon" aria-hidden="true"><i class="fa-solid fa-briefcase"></i></span>
<h2><%= t("pages.contacts.commercial_title") %></h2>
<p><%= t("pages.contacts.commercial_body") %></p>
<p class="contacts-channels__email">
<%= mail_to MatchLiveTv.support_email, MatchLiveTv.support_email %>
</p>
</article>
<article class="feature-card">
<span class="feature-card__icon feature-card__icon--blue" aria-hidden="true"><i class="fa-solid fa-life-ring"></i></span>
<h2><%= t("pages.contacts.support_title") %></h2>
<p>
<%= raw t(
"pages.contacts.support_body_html",
faq_link: link_to(t("pages.contacts.faq_link"), public_faq_path),
support_link: link_to(t("pages.contacts.support_link"), public_support_path)
) %>
</p>
<p class="contacts-channels__email">
<%= mail_to MatchLiveTv.support_email, MatchLiveTv.support_email %>
</p>
</article>
<article class="feature-card">
<span class="feature-card__icon feature-card__icon--gold" aria-hidden="true"><i class="fa-solid fa-shield-halved"></i></span>
<h2><%= t("pages.contacts.privacy_title") %></h2>
<p><%= t("pages.contacts.privacy_body") %></p>
<p class="contacts-channels__email">
<%= mail_to MatchLiveTv.privacy_controller_email, MatchLiveTv.privacy_controller_email %>
</p>
</article>
</div>
</section>
<section class="section wrap" aria-labelledby="contacts-company-title">
<div class="features-panel contacts-company">
<h2 id="contacts-company-title"><%= t("pages.contacts.company_title") %></h2>
<p class="features-panel__lead"><%= t("pages.contacts.company_lead") %></p>
<ul class="contacts-company__details">
<li><strong><%= MatchLiveTv.privacy_controller_name %></strong></li>
<li><%= t("pages.contacts.label_address") %>: <%= MatchLiveTv.privacy_controller_address %></li>
<% if MatchLiveTv.privacy_controller_vat.present? %>
<li><%= t("pages.contacts.label_vat") %>: <%= MatchLiveTv.privacy_controller_vat %></li>
<% end %>
</ul>
</div>
</section>
<section class="section wrap" aria-labelledby="contacts-form-title">
<div class="contacts-form-panel">
<h2 id="contacts-form-title"><%= t("pages.contacts.form_title") %></h2>
<p class="contacts-form-panel__lead"><%= t("pages.contacts.form_lead") %></p>
<%= form_with url: public_contatti_path, method: :post, local: true, class: "contacts-form" do %>
<div class="contacts-hp" aria-hidden="true">
<label for="website"><%= t("pages.contacts.honeypot_label") %></label>
<%= text_field_tag :website, @inquiry[:website], tabindex: -1, autocomplete: "off" %>
</div>
<%= label_tag :name, t("pages.contacts.name_label") %>
<%= text_field_tag :name, @inquiry[:name], required: true, maxlength: 120, autocomplete: "name" %>
<%= label_tag :email, t("pages.contacts.email_label") %>
<%= email_field_tag :email, @inquiry[:email], required: true, autocomplete: "email" %>
<%= label_tag :club_name, t("pages.contacts.club_label") %>
<%= text_field_tag :club_name, @inquiry[:club_name], maxlength: 160, autocomplete: "organization" %>
<%= label_tag :topic, t("pages.contacts.topic_label") %>
<%= select_tag :topic, options_for_select(
[
[t("pages.contacts.topic_commercial"), "commercial"],
[t("pages.contacts.topic_support"), "support"],
[t("pages.contacts.topic_privacy"), "privacy"]
],
@inquiry[:topic]
), required: true %>
<%= label_tag :message, t("pages.contacts.message_label") %>
<%= text_area_tag :message, @inquiry[:message], required: true, rows: 6, maxlength: 4000 %>
<label class="legal-accept">
<%= check_box_tag :accept_privacy, "1", @inquiry[:accept_privacy] == "1", required: true %>
<span class="legal-accept-text">
<%= raw t(
"pages.contacts.privacy_accept_html",
privacy_link: link_to(t("pages.contacts.privacy_link"), public_privacy_path, target: "_blank", rel: "noopener")
) %>
</span>
</label>
<%= submit_tag t("pages.contacts.submit"), class: "btn btn-primary" %>
<% end %>
</div>
</section>
<section class="section wrap features-cta" aria-labelledby="contacts-cta-title">
<div class="features-cta__box">
<h2 id="contacts-cta-title"><%= t("pages.contacts.cta_title") %></h2>
<p><%= t("pages.contacts.cta_body") %></p>
<div class="features-cta__actions">
<%= link_to t("pages.contacts.cta_faq"), public_faq_path, class: "btn btn-outline" %>
<%= link_to t("pages.contacts.cta_signup"), public_signup_path, class: "btn btn-primary" %>
</div>
</div>
</section>
</article>
@@ -83,6 +83,6 @@
<div class="card" style="margin-top:32px;text-align:center">
<h3 style="margin-top:0"><%= t("pages.pricing.different_title") %></h3>
<p style="color:#aaa;margin-bottom:16px"><%= t("pages.pricing.different_body") %></p>
<%= mail_to "info@matchlivetv.it", t("pages.pricing.contact_button"), class: "btn btn-primary" %>
<%= link_to t("pages.pricing.contact_button"), public_contatti_path, class: "btn btn-primary" %>
</div>
</div>
@@ -43,6 +43,7 @@
<li><%= raw t("legal.privacy.s3_item4_html") %></li>
<li><%= raw t("legal.privacy.s3_item5_html") %></li>
<li><%= raw t("legal.privacy.s3_item6_html") %></li>
<li><%= raw t("legal.privacy.s3_item7_html") %></li>
</ul>
</section>
@@ -107,6 +108,10 @@
<td><%= t("legal.privacy.s5_row6_purpose") %></td>
<td><%= t("legal.privacy.s5_row6_basis") %></td>
</tr>
<tr>
<td><%= t("legal.privacy.s5_row7_purpose") %></td>
<td><%= t("legal.privacy.s5_row7_basis") %></td>
</tr>
</tbody>
</table>
</div>
@@ -144,6 +149,7 @@
<li><%= raw t("legal.privacy.s8_item2_html") %></li>
<li><%= raw t("legal.privacy.s8_item3_html") %></li>
<li><%= raw t("legal.privacy.s8_item4_html", hours: MatchLiveTv.password_reset_expiry_hours) %></li>
<li><%= raw t("legal.privacy.s8_item5_html") %></li>
</ul>
</section>
+1 -1
View File
@@ -1,7 +1,7 @@
<% content_for :title, t("team.edit.title", name: @team.name) %>
<% content_for :robots, "noindex, nofollow" %>
<div class="wrap" style="padding-top:20px;max-width:560px">
<div class="wrap wrap--portal" style="padding-top:20px">
<h1><%= @team.name %></h1>
<p style="color:#888"><%= t("team.edit.club_label") %> <%= link_to @club.name, public_club_path(@club) %></p>
<div class="card">
+46 -19
View File
@@ -1,7 +1,9 @@
<% record = local_assigns[:record] %>
<% show_inherit_hint = local_assigns[:show_inherit_hint] %>
<% can_upload = local_assigns.fetch(:can_upload, false) %>
<% cover_src = record.effective_cover_url.presence || Streams::CoverResolver::DEFAULT_COVER_URL %>
<% default_cover = Streams::CoverResolver::DEFAULT_COVER_URL %>
<% cover_src = record.effective_cover_url.presence || default_cover %>
<% remove_id = "remove_cover_#{record.model_name.param_key}" %>
<fieldset class="branding-fields cover-fields">
<legend><%= t("club.branding.cover_legend") %></legend>
@@ -22,16 +24,25 @@
</div>
<% if can_upload %>
<%= file_field_tag "branding[cover_image]",
accept: "image/png,image/jpeg,image/webp",
data: { branding_cover_file: true },
class: "branding-file-input" %>
<% if record.cover_image_attached? %>
<label class="checkbox-label cover-remove-label">
<%= check_box_tag "remove_cover", "1", false, id: "remove_cover_#{record.model_name.param_key}" %>
<%= t("club.branding.cover_remove_label") %>
</label>
<% end %>
<div class="cover-actions">
<%= file_field_tag "branding[cover_image]",
accept: "image/png,image/jpeg,image/webp",
data: { branding_cover_file: true },
class: "branding-file-input" %>
<% if record.cover_image_attached? %>
<%= hidden_field_tag "remove_cover", "0", id: remove_id, data: { branding_cover_remove: true } %>
<button type="button"
class="btn btn-secondary cover-reset-btn"
data-branding-cover-reset
data-default-cover="<%= default_cover %>"
data-remove-input="#<%= remove_id %>">
<%= t("club.branding.cover_reset_button") %>
</button>
<p class="branding-hint cover-reset-hint" data-branding-cover-reset-hint hidden>
<%= t("club.branding.cover_reset_pending_hint") %>
</p>
<% end %>
</div>
<% else %>
<p class="muted"><%= t("club.branding.cover_requires_full") %></p>
<%= link_to t("club.branding.cover_see_plans"), public_prezzi_path, class: "btn btn-secondary btn-sm" %>
@@ -43,13 +54,29 @@
(function () {
var input = document.querySelector("[data-branding-cover-file]");
var img = document.querySelector("[data-branding-cover-img]");
if (!input || !img) return;
input.addEventListener("change", function () {
var file = input.files && input.files[0];
if (!file) return;
var reader = new FileReader();
reader.onload = function (e) { img.src = e.target.result; };
reader.readAsDataURL(file);
});
var resetBtn = document.querySelector("[data-branding-cover-reset]");
var removeInput = document.querySelector("[data-branding-cover-remove]");
var resetHint = document.querySelector("[data-branding-cover-reset-hint]");
if (input && img) {
input.addEventListener("change", function () {
var file = input.files && input.files[0];
if (!file) return;
if (removeInput) removeInput.value = "0";
if (resetHint) resetHint.hidden = true;
if (resetBtn) resetBtn.disabled = false;
var reader = new FileReader();
reader.onload = function (e) { img.src = e.target.result; };
reader.readAsDataURL(file);
});
}
if (resetBtn && img && removeInput) {
resetBtn.addEventListener("click", function () {
removeInput.value = "1";
img.src = resetBtn.getAttribute("data-default-cover");
if (input) input.value = "";
if (resetHint) resetHint.hidden = false;
resetBtn.disabled = true;
});
}
})();
</script>
@@ -5,6 +5,7 @@
<%= render "shared/store_badges", variant: "footer" %>
</div>
<div>
<%= link_to t("common.contacts"), public_contatti_path %> ·
<%= link_to t("common.support"), public_support_path %> ·
<%= link_to t("common.pricing"), public_prezzi_path %> ·
<%= link_to t("footer.live"), public_live_index_path %> ·
@@ -0,0 +1,45 @@
<% announcements = @site_announcements %>
<% if announcements.present? %>
<div class="site-announcements" role="region" aria-label="<%= t("announcement.region") %>">
<% announcements.each do |item| %>
<article class="site-announcement site-announcement--<%= item.kind %> site-announcement--<%= item.severity %>"
data-announcement-id="<%= item.id %>">
<div class="site-announcement__body">
<p class="site-announcement__title"><%= item.title %></p>
<div class="site-announcement__text"><%= simple_format(item.body) %></div>
<% if item.action_url.present? %>
<p class="site-announcement__action">
<%= link_to (item.action_label.presence || t("announcement.open")), item.action_url,
class: "site-announcement__link", target: "_blank", rel: "noopener noreferrer" %>
</p>
<% end %>
</div>
<% if item.dismissible? %>
<button type="button" class="site-announcement__dismiss" data-announcement-dismiss aria-label="<%= t("announcement.dismiss") %>">
×
</button>
<% end %>
</article>
<% end %>
</div>
<script>
(function () {
var key = "mltv.webDismissedAnnouncements";
var dismissed = [];
try { dismissed = JSON.parse(localStorage.getItem(key) || "[]"); } catch (e) {}
document.querySelectorAll(".site-announcement[data-announcement-id]").forEach(function (el) {
if (dismissed.indexOf(el.getAttribute("data-announcement-id")) !== -1) el.remove();
});
document.querySelectorAll("[data-announcement-dismiss]").forEach(function (btn) {
btn.addEventListener("click", function () {
var box = btn.closest("[data-announcement-id]");
if (!box) return;
var id = box.getAttribute("data-announcement-id");
if (dismissed.indexOf(id) === -1) dismissed.push(id);
localStorage.setItem(key, JSON.stringify(dismissed));
box.remove();
});
});
})();
</script>
<% end %>