Tutte le view marketing, legali, viewer, dashboard e admin usano t(); mailer utente-facing e flash localizzati; admin con LocaleResolver e selettore lingua. Co-authored-by: Cursor <cursoragent@cursor.com>
71 lines
4.2 KiB
ERB
71 lines
4.2 KiB
ERB
<% record = local_assigns[:record] %>
|
|
<% show_inherit_hint = local_assigns[:show_inherit_hint] %>
|
|
<% param_key = record.model_name.param_key %>
|
|
<% primary = record.primary_color.presence || record.effective_primary_color %>
|
|
<% secondary = record.secondary_color.presence || record.effective_secondary_color %>
|
|
<% logo_src = record.effective_logo_url.presence %>
|
|
|
|
<fieldset class="branding-fields">
|
|
<legend><%= local_assigns[:legend] || t("club.branding.legend") %></legend>
|
|
|
|
<% if show_inherit_hint %>
|
|
<p class="branding-hint"><%= t("club.branding.inherit_hint") %></p>
|
|
<% end %>
|
|
|
|
<div class="branding-logo-block">
|
|
<%= label_tag "branding[logo_file]", t("club.branding.logo_file_label") %>
|
|
<div class="branding-logo-preview" data-branding-logo-preview>
|
|
<%= image_tag logo_src.presence || "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
|
|
alt: t("club.branding.logo_preview_alt"),
|
|
class: "branding-logo-preview__img",
|
|
data: { branding_logo_img: true },
|
|
width: 96,
|
|
height: 96,
|
|
hidden: logo_src.blank? %>
|
|
<span class="branding-logo-preview__placeholder" data-branding-logo-placeholder <%= "hidden" if logo_src.present? %>>
|
|
<%= t("club.branding.no_logo_placeholder") %>
|
|
</span>
|
|
</div>
|
|
<%= file_field_tag "branding[logo_file]", accept: "image/png,image/jpeg,image/webp", data: { branding_logo_file: true }, class: "branding-file-input" %>
|
|
</div>
|
|
|
|
<%= label_tag "#{param_key}[logo_url]", t("club.branding.logo_url_label") %>
|
|
<%= text_field_tag "#{param_key}[logo_url]", record.logo_url, placeholder: "https://…", class: "branding-url-input" %>
|
|
|
|
<%= label_tag "#{param_key}[primary_color]", t("club.branding.primary_color_label") %>
|
|
<div class="branding-color-row" data-branding-color-row="primary">
|
|
<%= color_field_tag "#{param_key}[primary_color]", primary, data: { color_picker: true }, class: "branding-color-picker", title: t("club.branding.choose_color") %>
|
|
<%= text_field_tag nil, primary, data: { color_hex: true }, class: "branding-hex-input", placeholder: "#e53935", autocomplete: "off", spellcheck: false %>
|
|
<span class="color-swatch branding-color-swatch" data-color-swatch aria-hidden="true"></span>
|
|
<div class="branding-color-presets" aria-label="<%= t("club.branding.quick_colors") %>">
|
|
<% %w[#e53935 #1565c0 #2e7d32 #ff9800 #212121 #ffffff].each do |hex| %>
|
|
<button type="button" class="branding-preset" data-color-preset="<%= hex %>" style="background:<%= hex %>" title="<%= hex %>"></button>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<%= label_tag "#{param_key}[secondary_color]", t("club.branding.secondary_color_label") %>
|
|
<div class="branding-color-row" data-branding-color-row="secondary">
|
|
<%= color_field_tag "#{param_key}[secondary_color]", secondary, data: { color_picker: true }, class: "branding-color-picker", title: t("club.branding.choose_color") %>
|
|
<%= text_field_tag nil, secondary, data: { color_hex: true }, class: "branding-hex-input", placeholder: "#ffffff", autocomplete: "off", spellcheck: false %>
|
|
<span class="color-swatch branding-color-swatch" data-color-swatch aria-hidden="true"></span>
|
|
<div class="branding-color-presets" aria-label="<%= t("club.branding.quick_colors") %>">
|
|
<% %w[#ffffff #f5f5f5 #212121 #ffd54f #90caf9 #e53935].each do |hex| %>
|
|
<button type="button" class="branding-preset" data-color-preset="<%= hex %>" style="background:<%= hex %>" title="<%= hex %>"></button>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="branding-live-preview" data-branding-live-preview>
|
|
<span class="branding-live-preview__label"><%= t("club.branding.header_preview_label") %></span>
|
|
<div class="branding-live-preview__header" data-preview-header style="--preview-primary:<%= primary %>;--preview-secondary:<%= secondary %>">
|
|
<span class="branding-live-preview__logo" data-preview-logo>
|
|
<% if logo_src %>
|
|
<%= image_tag logo_src, alt: "", width: 40, height: 40, style: "border-radius:8px;object-fit:contain" %>
|
|
<% end %>
|
|
</span>
|
|
<span class="branding-live-preview__name"><%= record.try(:name).presence || t("club.branding.name_placeholder") %></span>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|