feat(options): sticky header as label + 3 standalone checkboxes (Prompt L)

config.xml: the three headersticky* checkboxes lose parent="headersticky"
and get width=12 (stacked as a vertical list); the master key headersticky
stays in config.xml/DB for backward compatibility but is rendered as a
static label only (special case in options.twig — no input). Views:
custom_header.twig emits the per-breakpoint fixed-top media queries based
on the three checkboxes alone (master gate dropped; defaults on/on/off
when undefined); nav_bar.twig fallback now keys off headerstickycomputer
being defined. Migration note: an old row with headersticky=off no longer
disables sticky — only the checkboxes govern it.

Verified: CLI render row 270 — top-of-page pane shows the label + 3
checkboxes (col-md-12, no parent, checked on/on/off, no option-visibility);
survey 282267 renders media queries for computer+tablet but not mobile and
no hardcoded fixed-top; jsdom toggle/serialize + radio idempotency PASS;
run_all PASS; export green. Variants NOT rebuilt yet (config.xml batch —
rebuild+reset once after Prompt U per standing rule).

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-24 23:03:57 +01:00
commit b44d120d7d
4 changed files with 39 additions and 28 deletions

View file

@ -142,15 +142,20 @@
<!-- Header sticky per screen size (shown in the "Top of the page" tab).
Breakpoints are Bootstrap's default ones: phone < md (768px),
tablet = md..lg (768-991px), computer >= lg (992px). The three
checkboxes are children of the master switch: they are only visible
(and enabled) when "Make header sticky" is on. nav_bar.twig no longer
hardcodes fixed-top; custom_header.twig emits the media queries.
Defaults: sticky on computer + tablet, NOT on mobile. -->
<headersticky type="buttons" category="Top of the page" width="4" title="Make header sticky" options="on|off" optionlabels="Yes|No">on</headersticky>
<headerstickycomputer type="checkbox" category="Top of the page" width="4" title="Computer screen" parent="headersticky">on</headerstickycomputer>
<headerstickytablet type="checkbox" category="Top of the page" width="4" title="Tablet" parent="headersticky">on</headerstickytablet>
<headerstickymobile type="checkbox" category="Top of the page" width="4" title="Mobile phone" parent="headersticky">off</headerstickymobile>
tablet = md..lg (768-991px), computer >= lg (992px). nav_bar.twig no
longer hardcodes fixed-top; custom_header.twig emits the media
queries. Defaults: sticky on computer + tablet, NOT on mobile. -->
<!-- Prompt L: the master key "headersticky" is kept in config.xml/DB for
backward compatibility, but the options page renders it as a static
LABEL only (see options.twig). Sticky behaviour is governed solely by
the three checkboxes below, which no longer have a parent (always
visible, stacked as a list via width=12). Migration note: an old row
with headersticky=off no longer disables sticky — only the checkboxes
count (defaults on/on/off). -->
<headersticky type="buttons" category="Top of the page" width="12" title="Make header sticky" options="on|off" optionlabels="Yes|No">on</headersticky>
<headerstickycomputer type="checkbox" category="Top of the page" width="12" title="Computer screen">on</headerstickycomputer>
<headerstickytablet type="checkbox" category="Top of the page" width="12" title="Tablet">on</headerstickytablet>
<headerstickymobile type="checkbox" category="Top of the page" width="12" title="Mobile phone">off</headerstickymobile>
<!-- Various colors
HOUSE-STYLE: ALL colorpickers in this section (header, navbar menu,

View file

@ -228,7 +228,12 @@
{# label ALWAYS above the control, for every type incl. checkbox (Prompt G) #}
<label for="simple_edit_options_{{ key }}" id="lbl_simple_edit_options_{{ key }}" class="form-label">{{ gT(attr.title) }}</label>
{% if attr.type == 'buttons' %}
{% if key == 'headersticky' %}
{# Prompt L: the master switch is rendered as a STATIC LABEL only
(the generic form-label above); no input. The key stays in
config.xml/DB for compat, but sticky behaviour is governed
solely by the three headersticky* checkboxes below. #}
{% elseif attr.type == 'buttons' %}
{# buttons type: one radio per value of options="a|b", labels from optionlabels="A|B" #}
{% set optValues = attr.options|split('|') %}
{% set optLabels = attr.optionlabels|split('|') %}

View file

@ -145,24 +145,24 @@
background-color: {{ aSurveyInfo.options.headerbackgroundcolor }};
}
{# THEME ADDITION: sticky header per screen size (options headersticky +
headersticky{computer,tablet,mobile}). Breakpoints are Bootstrap's
{# THEME ADDITION: sticky header per screen size (options
headersticky{computer,tablet,mobile}; Prompt L — the master key
"headersticky" no longer gates this). Breakpoints are Bootstrap's
defaults: phone < md (768px), tablet = md..lg (768-991px),
computer >= lg (992px). The rules are the same as Bootstrap's
.fixed-top, but only inside the selected range(s). Only emitted when
the options exist (after a theme reset); before that nav_bar.twig keeps
the fixed-top class (old behaviour). #}
{% if aSurveyInfo.options.headersticky is defined %}
{% if aSurveyInfo.options.headersticky == 'on' %}
{% if aSurveyInfo.options.headerstickycomputer|default('on') == 'on' %}
the checkbox options exist (after a theme reset); before that nav_bar.twig
keeps the fixed-top class (old behaviour). Defaults when a checkbox is
undefined: computer on, tablet on, mobile off. #}
{% if aSurveyInfo.options.headerstickycomputer is defined %}
{% if aSurveyInfo.options.headerstickycomputer|default('on') == 'on' %}
@media (min-width: 992px) { #survey-nav { position: fixed; top: 0; right: 0; left: 0; z-index: 1030; } }
{% endif %}
{% if aSurveyInfo.options.headerstickytablet|default('on') == 'on' %}
{% endif %}
{% if aSurveyInfo.options.headerstickytablet|default('on') == 'on' %}
@media (min-width: 768px) and (max-width: 991.98px) { #survey-nav { position: fixed; top: 0; right: 0; left: 0; z-index: 1030; } }
{% endif %}
{% if aSurveyInfo.options.headerstickymobile|default('off') == 'on' %}
{% endif %}
{% if aSurveyInfo.options.headerstickymobile|default('off') == 'on' %}
@media (max-width: 767.98px) { #survey-nav { position: fixed; top: 0; right: 0; left: 0; z-index: 1030; } }
{% endif %}
{% endif %}
{% endif %}

View file

@ -34,12 +34,13 @@ For the survey navigator ("Next", "Back", etc.), see: navigation/navigator.twig
inherits the body font (body gets font-<base font>). Applied on #survey-nav,
so it covers the menu items and the survey name as well. #}
{% set sHeaderFont = aSurveyInfo.options.headerfont|default('base') %}
{# THEME ADDITION: sticky header per screen size (options headersticky +
headersticky{computer,tablet,mobile}). When the options exist (theme was
reset after adding them), fixed-top is NOT hardcoded here anymore —
custom_header.twig emits the media queries instead. Before a reset the
old behaviour (always fixed-top) is kept as fallback. #}
{% set bStickyConfigured = aSurveyInfo.options.headersticky is defined %}
{# THEME ADDITION: sticky header per screen size (options
headersticky{computer,tablet,mobile}; Prompt L — the master key no longer
counts). When the checkbox options exist (theme was reset after adding
them), fixed-top is NOT hardcoded here anymore — custom_header.twig emits
the media queries instead. Before a reset the old behaviour (always
fixed-top) is kept as fallback. #}
{% set bStickyConfigured = aSurveyInfo.options.headerstickycomputer is defined %}
{# Per-logo "hide on small screens" (Bootstrap classes d-none d-md-block).
Default (option missing or "on") keeps the logo hidden below the md breakpoint. #}
{% set hideSmallLeft = (aSurveyInfo.options.brandlogohideonsmall != "off") %}