feat(options): logo section as 3 columns (file/margin/per-device) in Top-of-page tab

Prompt M: per logo position (left=brand, center, right) the options page now
shows one column with vertical separators and an <hr> below: file dropdown
with 'No logo' (off) first, top margin as plain number 0-100, and 'Show logo
on' with computer/tablet/mobile checkboxes. New option keys per position:
<pos>logofile, <pos>logotopmargin, <pos>showon{computer,tablet,mobile};
old keys (brandlogo/centerlogo/rightlogo, *logohideonsmall, shared
logotopmargin) removed from config.xml. Views map the checkboxes to
Bootstrap display classes per breakpoint and emit per-logo padding-top;
variants/build.php migrates the old json keys to the new ones.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-24 23:14:10 +01:00
commit 751954c340

View file

@ -144,13 +144,21 @@
{% set aTopOfPageKeys = [
'headerbackgroundcolor', 'navbarfontcolor',
'headersticky', 'headerstickycomputer', 'headerstickytablet', 'headerstickymobile',
'brandlogo', 'brandlogofile', 'brandlogohideonsmall',
'centerlogo', 'centerlogofile', 'centerlogohideonsmall',
'rightlogo', 'rightlogofile', 'rightlogohideonsmall',
'logotopmargin',
'brandlogofile', 'brandlogotopmargin', 'brandshowoncomputer', 'brandshowontablet', 'brandshowonmobile',
'centerlogofile', 'centerlogotopmargin', 'centershowoncomputer', 'centershowontablet', 'centershowonmobile',
'rightlogofile', 'rightlogotopmargin', 'rightshowoncomputer', 'rightshowontablet', 'rightshowonmobile',
'progressbarposition', 'progressbarbackgroundcolor', 'progressbarcolor', 'progressbarfontcolor'
] %}
{# Prompt M: the logo keys are rendered as ONE dedicated 3-column block (triggered at
the first logo key, 'brandlogofile') and skipped in the generic per-key loop. #}
{% set aLogoKeys = [
'brandlogofile', 'brandlogotopmargin', 'brandshowoncomputer', 'brandshowontablet', 'brandshowonmobile',
'centerlogofile', 'centerlogotopmargin', 'centershowoncomputer', 'centershowontablet', 'centershowonmobile',
'rightlogofile', 'rightlogotopmargin', 'rightshowoncomputer', 'rightshowontablet', 'rightshowonmobile'
] %}
{% set aLogoPositions = ['brand', 'center', 'right'] %}
{# Tab list: FIRST the "Fonts" tab (where the default/base font is chosen and the
per-element font overrides live), then the "Top of the page" tab (keys =
aTopOfPageKeys), then one tab per remaining category from config.xml like the
@ -217,6 +225,73 @@
{% for key in aTabKeys %}
{% set attr = aOptionAttributes.optionAttributes[key] ?? null %}
{% if attr is not null %}
{% if tab.id == 'top-of-page' and key == 'brandlogofile' %}
{# PROMPT M: dedicated 3-column logo block (left/center/right), vertical
borders between columns, hr below. Per column, top to bottom:
file dropdown ("No logo" first), margin 0-100px, "Show logo on"
with 3 device checkboxes. Labels above controls (Prompt G),
server-side checked/selected/value like the generic renderer. #}
<div class="col-12">
<div class="row logo-columns">
{% for pos in aLogoPositions %}
{% set fkey = pos ~ 'logofile' %}
{% set mkey = pos ~ 'logotopmargin' %}
{% set fattr = aOptionAttributes.optionAttributes[fkey] %}
{% set mattr = aOptionAttributes.optionAttributes[mkey] %}
{% set fcv = bGeneralInherit ? 'inherit' : (aCurrentOptions[fkey] is defined ? aCurrentOptions[fkey] : (oParentOptions[fkey] is defined ? oParentOptions[fkey] : '')) %}
{% set mcv = bGeneralInherit ? 'inherit' : (aCurrentOptions[mkey] is defined ? aCurrentOptions[mkey] : (oParentOptions[mkey] is defined ? oParentOptions[mkey] : '')) %}
<div class="col-md-4 logo-col-{{ pos }}{% if not loop.first %} border-start{% endif %}">
{# 1. logo file dropdown, "No logo" (value off) first #}
<div class="mb-3">
<label for="simple_edit_options_{{ fkey }}" id="lbl_simple_edit_options_{{ fkey }}" class="form-label">{{ gT(fattr.title) }}</label>
<select class="form-select selector_option_value_field selector_image_selector"
data-inheritvalue="{{ oParentOptions[fkey] }}"
id="simple_edit_options_{{ fkey }}" name="{{ fkey }}">
{% if bInherit %}
<option value="inherit" {% if fcv == 'inherit' %}selected{% endif %}>{{ gT("Inherit") }} [{{ gT("Inherited value:") }} {{ oParentOptions[fkey] }}]</option>
{% endif %}
<option value="off" {% if fcv == 'off' %}selected{% endif %}>{{ gT("No logo") }}</option>
{{ imageOptions|raw }}
</select>
<button class="btn btn-outline-secondary btn-sm mt-1 selector__open_lightbox" data-bs-target="#simple_edit_options_{{ fkey }}">
{{ gT("Preview image") }}
</button>
</div>
{# 2. margin between logo and top of screen, 0-100 px #}
<div class="mb-3">
<label for="simple_edit_options_{{ mkey }}" id="lbl_simple_edit_options_{{ mkey }}" class="form-label">{{ gT(mattr.title) }}</label>
<input type="number" min="0" max="100" step="1"
class="form-control selector-numerical-input selector_text_option_value_field"
{% if mcv != '' and mcv != 'inherit' %}value="{{ mcv }}"{% endif %}
data-inheritvalue="{{ oParentOptions[mkey] }}"
id="simple_edit_options_{{ mkey }}" name="{{ mkey }}"
title="{{ gT("Inherited value:") }} {{ oParentOptions[mkey] }}"/>
</div>
{# 3. "Show logo on" per device #}
<div class="mb-3">
<span class="form-label d-block">{{ gT("Show logo on") }}</span>
{% for dev in ['computer', 'tablet', 'mobile'] %}
{% set ckey = pos ~ 'showon' ~ dev %}
{% set cattr = aOptionAttributes.optionAttributes[ckey] %}
{% set ccv = bGeneralInherit ? 'inherit' : (aCurrentOptions[ckey] is defined ? aCurrentOptions[ckey] : (oParentOptions[ckey] is defined ? oParentOptions[ckey] : '')) %}
<div class="mb-1">
<label for="simple_edit_options_{{ ckey }}" class="form-label">{{ gT(cattr.title) }}</label>
<div class="form-check">
<input type="checkbox" value="on"
{% if ccv == 'on' %}checked{% endif %}
class="form-check-input selector_option_checkbox_field"
data-inheritvalue="{{ oParentOptions[ckey] }}"
id="simple_edit_options_{{ ckey }}" name="{{ ckey }}">
</div>
</div>
{% endfor %}
</div>
</div>
{% endfor %}
</div>
<div class="row action_hide_on_inherit"><div class="col-12"><hr class="logo-columns-hr"></div></div>
</div>
{% elseif key not in aLogoKeys %}
{# server-side current value for this option (checked/selected/value) #}
{% set currentValue = bGeneralInherit ? 'inherit' : (aCurrentOptions[key] is defined ? aCurrentOptions[key] : (oParentOptions[key] is defined ? oParentOptions[key] : '')) %}
{# parent != '': this field is only visible when the parent option is "on"
@ -353,6 +428,7 @@
{% endif %}
</div>
</div>
{% endif %}
{% endif %}
{% endfor %}
</div>