feat(options): header row of Top-of-page tab — font+color in col 1, background in col 2

Row 136: in the "Top of the page" tab the header section columns are swapped:
column 1 now holds the header font (headerfont) with the menu item color
(navbarfontcolor + custom picker) stacked below it; column 2 holds the header
background color (headerbackgroundcolor + custom). Slot mapping changed
accordingly (headerfont/navbarfontcolor(+custom) = h1 = row+col 1, header
background = h2 = col 2, sticky = h3 = col 3) and aTopOfPageKeys reordered.

The header background color in column 2 is lowered to align with the color
option in column 1: a new alignHeaderColumns step in options.js measures the
vertical offset between the navbarfontcolor block and the background column
(getBoundingClientRect, no hardcoded px) and applies it as padding-top on the
background column. OPTIONS_JS_TOKEN -> 20261126.15. Verified: render tc=633
(col1 = headerfont+navbarfontcolor, col2 = headerbackgroundcolor, divs 312/312,
options.js?v=20261126.15), jsdom 7/7 incl. new pins (header row order in raw
HTML; measured padding-top applied with a faked getBoundingClientRect), export
exit 0. Variants not rebuilt (deferred).

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-26 19:25:22 +01:00
commit f812268ffa
2 changed files with 40 additions and 10 deletions

View file

@ -887,6 +887,25 @@ var ThemeOptions = function () {
if (customInput.length) { customInput.on('input change', refreshAll); }
};
// THEME ADDITION (row 136): in the "Top of the page" tab the header row is
// col 1 = font + menu item color, col 2 = header background color. Lower the
// background column so its option aligns with the color option in col 1:
// measure the vertical distance between the navbarfontcolor block's top and
// the background column's top and apply it as padding-top (robust against
// font-size/line-height differences — no hardcoded px).
var alignHeaderColumns = function () {
var row = globalForm.find('.top-section-header').first();
if (!row.length) { return; }
var bgField = globalForm.find('#simple_edit_options_headerbackgroundcolor');
var colorField = globalForm.find('#simple_edit_options_navbarfontcolor');
if (!bgField.length || !colorField.length) { return; }
var bgCol = bgField.closest('.top-section-header .col-md-4');
var colorWrap = colorField.closest('.mb-3');
if (!bgCol.length || !colorWrap.length || !bgCol[0].getBoundingClientRect) { return; }
var diff = colorWrap[0].getBoundingClientRect().top - bgCol[0].getBoundingClientRect().top;
if (diff > 0) { bgCol[0].style.paddingTop = diff + 'px'; }
};
// Shared delegated handlers for ALL chooser dropdowns (row 122/135): a REAL user
// change event bubbles natively to document even when an earlier direct handler
// threw (jQuery only aborts synthetic triggers), so the active outline still moves
@ -967,6 +986,10 @@ var ThemeOptions = function () {
});
safeStep('bindColorModeDelegates', bindColorModeDelegates);
// THEME ADDITION (row 136): align the header background color (col 2) with
// the menu item color option (col 1) in the Top-of-the-page tab
safeStep('alignHeaderColumns', alignHeaderColumns);
// THEME ADDITION (row 133): restore the options tab the user was on before
// Save (after a save the page reloads on the first tab)
safeStep('restoreActiveTab', restoreActiveTab);

View file

@ -43,7 +43,7 @@
heuristically cached copy (the file has only Last-Modified/ETag, no Cache-Control).
Re-register it with a version token: bump OPTIONS_JS_TOKEN below whenever
options/options.js changes, so every browser fetches the new file once. #}
{% set OPTIONS_JS_TOKEN = '20261126.14' %}
{% set OPTIONS_JS_TOKEN = '20261126.15' %}
{{ unregisterScriptFile(optionsPath ~ '/options.js') }}
{{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }}
@ -224,7 +224,7 @@
Values are stored per option key, so moving them here does not change any stored
value. The order of this list is the order shown in the tab. #}
{% set aTopOfPageKeys = [
'headerbackgroundcolor', 'headerbackgroundcolorcustom', 'headerfont', 'navbarfontcolor', 'navbarfontcolorcustom',
'headerfont', 'navbarfontcolor', 'navbarfontcolorcustom', 'headerbackgroundcolor', 'headerbackgroundcolorcustom',
'headersticky', 'headerstickycomputer', 'headerstickytablet', 'headerstickymobile',
'brandlogofile', 'brandlogotopmargin', 'brandshowoncomputer', 'brandshowontablet', 'brandshowonmobile',
'centerlogofile', 'centerlogotopmargin', 'centershowoncomputer', 'centershowontablet', 'centershowonmobile',
@ -370,11 +370,17 @@
{% endif %}
{% elseif bTopPane %}
{% if key in aLogoKeys %}{% set fSlot = 'logo' %}
{% elseif key == 'headerbackgroundcolor' %}{% set fSlot = 'h1' %}
{% elseif key == 'headerbackgroundcolorcustom' %}{% set fSlot = 'h1' %}
{% elseif key == 'headerfont' %}{% set fSlot = 'hf' %}
{% elseif key == 'navbarfontcolor' %}{% set fSlot = 'h2' %}
{% elseif key == 'navbarfontcolorcustom' %}{% set fSlot = 'h2' %}
{# row 136: header row layout — col 1 = font (headerfont) with the
menu item color (navbarfontcolor + custom) stacked below it,
col 2 = header background color (aligned with the color option
via a measured padding-top, see alignHeaderColumns in options.js),
col 3 = sticky. Slots: h1 opens the row + col 1 (further h1 keys
stack in col 1), h2 = col 2, h3 = col 3. #}
{% elseif key == 'headerfont' %}{% set fSlot = 'h1' %}
{% elseif key == 'navbarfontcolor' %}{% set fSlot = 'h1' %}
{% elseif key == 'navbarfontcolorcustom' %}{% set fSlot = 'h1' %}
{% elseif key == 'headerbackgroundcolor' %}{% set fSlot = 'h2' %}
{% elseif key == 'headerbackgroundcolorcustom' %}{% set fSlot = 'h2' %}
{% elseif key in aTopStickyKeys %}{% set fSlot = 'h3' %}
{% elseif key == 'progressbarposition' %}{% set fSlot = 'ppos' %}
{% elseif key == 'progressbarfont' %}{% set fSlot = 'pfont' %}
@ -399,9 +405,10 @@
{% endif %}
{% else %}
{# top-of-page transitions: close previous slot, open new slot.
Header: col 1 = h1, col 2 = hf stacked above h2, col 3 = h3.
Progress bar: first row = ppos in col 1, empty col 2, pfont in
col 3; then the colors row (pcol1/pcol2/pcol3). #}
Header (row 136): col 1 = h1 slot (headerfont + navbarfontcolor
stacked), col 2 = h2 slot (header background color), col 3 = h3
(sticky). Progress bar: first row = ppos in col 1, empty col 2,
pfont in col 3; then the colors row (pcol1/pcol2/pcol3). #}
{% if fLastSlot == 'h1' or fLastSlot == 'h2' %}</div><div class="col-md-4">
{% elseif fLastSlot == 'h3' %}</div></div><div class="row action_hide_on_inherit"><div class="col-12"><hr class="top-section-hr"></div></div><div class="row action_hide_on_inherit top-section-intro"><div class="col-12"><h2>{{ gT("Logos") }}</h2><p>{{ gT("In this theme there are three positions for separate logos, but it is up to you which positions you want to fill.") }}</p></div></div>
{% elseif fLastSlot == 'logo' %}<div class="row action_hide_on_inherit top-section-intro"><div class="col-12"><h2>{{ gT("Progress bar") }}</h2><p>{{ gT("The progress bar can be switched on/off per survey in the survey settings. Here in this section you can choose how the progress bar looks when displayed.") }}</p></div></div>