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:
@@ -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 %>
|
||||
Reference in New Issue
Block a user