feat(options): checkbox labels right of the box + explanatory h2/p header on Top-of-page tab (Prompt W)

Label-above stays the rule for every option type, with one exception:
checkboxes now render their label to the RIGHT of the box (classic
.form-check, label after the input, same lbl_ id so JS/tests keep
anchoring). Applies to the generic checkbox branch (headersticky*)
and the logo-block showon* checkboxes.

New experiment for explanatory text on the options pages: the
'Top of the page' pane starts with <h2>Header</h2> and a <p> explaining
what the header is, both wrapped in gT() so they are translatable.
(Owner's source typos fixed: distinguishable, you can choose.)

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-25 13:06:22 +01:00
commit fb560bef62

View file

@ -260,6 +260,17 @@
{% endif %} {% endif %}
<div role="tabpanel" class="CoreThemeOptions--settingsTab tab-pane {% if loop.first %}active{% endif %}" <div role="tabpanel" class="CoreThemeOptions--settingsTab tab-pane {% if loop.first %}active{% endif %}"
id="{{ tab.id }}" aria-labelledby="tab-{{ tab.id }}"> id="{{ tab.id }}" aria-labelledby="tab-{{ tab.id }}">
{% if tab.id == 'top-of-page' %}
{# Prompt W: experiment with explanatory text on the options pages — above the
FIRST element of the "Top of the page" pane a header + explanation. Wrapped
in gT() so the strings are picked up for translation into other languages.
(Typo's in the owner's source text fixed: "ditinguishable" -> "distinguishable",
"you van choose" -> "you can choose".) #}
<div class="row action_hide_on_inherit top-of-page-intro"><div class="col-12">
<h2>{{ gT("Header") }}</h2>
<p>{{ gT("The header is the top part of the page, possibly containing the name of the survey, logo's and a menu. In this part of the options you can make this header more or less distinguishable from the rest of the page and you can choose if the logo should stay on top of the page after scrolling (sticky) or not.") }}</p>
</div></div>
{% endif %}
<div class="row action_hide_on_inherit"> <div class="row action_hide_on_inherit">
{# Prompt P: in the Images pane use the three-column grid like the logo {# Prompt P: in the Images pane use the three-column grid like the logo
block (Prompt M), but fill ONLY column 1 — all Images options stack block (Prompt M), but fill ONLY column 1 — all Images options stack
@ -321,15 +332,14 @@
{% set ckey = pos ~ 'showon' ~ dev %} {% set ckey = pos ~ 'showon' ~ dev %}
{% set cattr = aOptionAttributes.optionAttributes[ckey] %} {% set cattr = aOptionAttributes.optionAttributes[ckey] %}
{% set ccv = bGeneralInherit ? 'inherit' : (aCurrentOptions[ckey] is defined ? aCurrentOptions[ckey] : (oParentOptions[ckey] is defined ? oParentOptions[ckey] : '')) %} {% set ccv = bGeneralInherit ? 'inherit' : (aCurrentOptions[ckey] is defined ? aCurrentOptions[ckey] : (oParentOptions[ckey] is defined ? oParentOptions[ckey] : '')) %}
<div class="mb-1"> {# Prompt W: checkbox label to the RIGHT of the box #}
<label for="simple_edit_options_{{ ckey }}" class="form-label">{{ gT(cattr.title) }}</label> <div class="form-check mb-1">
<div class="form-check"> <input type="checkbox" value="on"
<input type="checkbox" value="on" {% if ccv == 'on' %}checked{% endif %}
{% if ccv == 'on' %}checked{% endif %} class="form-check-input selector_option_checkbox_field"
class="form-check-input selector_option_checkbox_field" data-inheritvalue="{{ oParentOptions[ckey] }}"
data-inheritvalue="{{ oParentOptions[ckey] }}" id="simple_edit_options_{{ ckey }}" name="{{ ckey }}">
id="simple_edit_options_{{ ckey }}" name="{{ ckey }}"> <label for="simple_edit_options_{{ ckey }}" id="lbl_simple_edit_options_{{ ckey }}" class="form-check-label">{{ gT(cattr.title) }}</label>
</div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
@ -417,8 +427,12 @@
<div class="{{ wrapClass }} {% if attr.parent != '' %}option-visibility{% if bParentHidden %} d-none{% endif %}{% endif %}" <div class="{{ wrapClass }} {% if attr.parent != '' %}option-visibility{% if bParentHidden %} d-none{% endif %}{% endif %}"
{% if attr.parent != '' %}data-show-if-parent="{{ attr.parent }}" data-show-if-value="{{ showIfValues }}"{% endif %}> {% if attr.parent != '' %}data-show-if-parent="{{ attr.parent }}" data-show-if-value="{{ showIfValues }}"{% endif %}>
<div class="mb-3"> <div class="mb-3">
{# label ALWAYS above the control, for every type incl. checkbox (Prompt G) #} {# label ALWAYS above the control, for every type EXCEPT checkbox
(Prompt G; Prompt W: checkboxes carry their label to the RIGHT
of the box, rendered in the checkbox branch below) #}
{% if attr.type != 'checkbox' %}
<label for="simple_edit_options_{{ key }}" id="lbl_simple_edit_options_{{ key }}" class="form-label">{{ gT(attr.title) }}</label> <label for="simple_edit_options_{{ key }}" id="lbl_simple_edit_options_{{ key }}" class="form-label">{{ gT(attr.title) }}</label>
{% endif %}
{% if key == 'headersticky' %} {% if key == 'headersticky' %}
{# Prompt L: the master switch is rendered as a STATIC LABEL only {# Prompt L: the master switch is rendered as a STATIC LABEL only
@ -447,12 +461,15 @@
</div> </div>
{% elseif attr.type == 'checkbox' %} {% elseif attr.type == 'checkbox' %}
{# checkbox: checked = "on", unchecked = "off". The label is rendered {# checkbox: checked = "on", unchecked = "off". EXCEPTION to the
above like every other type (generic form-label at the top of this label-above rule (Prompt W): for checkboxes the label stands to
block, Prompt G); only the box itself is wrapped in .form-check. the RIGHT of the box (classic .form-check with the label after
With survey-level inherit, an untouched box keeps the value the input) — so the generic form-label at the top of this block
"inherit" (options.js: data was-inherit). Children of a parent is skipped for checkboxes and the label is rendered here with
switch get selector_radio_childfield + data-parent like the rest. #} the same id (lbl_simple_edit_options_<key>) so tests/JS anchors
keep working. With survey-level inherit, an untouched box keeps
the value "inherit" (options.js: data was-inherit). Children of
a parent switch get selector_radio_childfield + data-parent. #}
<div class="form-check"> <div class="form-check">
<input type="checkbox" value="on" <input type="checkbox" value="on"
{% if currentValue == 'on' %}checked{% endif %} {% if currentValue == 'on' %}checked{% endif %}
@ -460,6 +477,7 @@
{% if attr.parent != '' %}data-parent="{{ attr.parent }}"{% endif %} {% if attr.parent != '' %}data-parent="{{ attr.parent }}"{% endif %}
data-inheritvalue="{{ oParentOptions[key] }}" data-inheritvalue="{{ oParentOptions[key] }}"
id="simple_edit_options_{{ key }}" name="{{ key }}"> id="simple_edit_options_{{ key }}" name="{{ key }}">
<label for="simple_edit_options_{{ key }}" id="lbl_simple_edit_options_{{ key }}" class="form-check-label">{{ gT(attr.title) }}</label>
</div> </div>
{% elseif attr.type == 'dropdown' %} {% elseif attr.type == 'dropdown' %}