feat(options): Questions tab as 3 columns with conditional border options + new questionhelpfontcolor (Prompt R)

config.xml: Questions options reordered into the three pane columns
(col1 colors+help, col2 border + children, col3 checkbox color), all
width=12; new colorpicker questionhelpfontcolor (default #444444);
questionbordercolor/style/dropdown + 4 radii get parent="questionborder".
options.twig: Questions pane renders three col-md-4 columns (border-start
between), options stacked as col-12; aShowIfValues map carries the
multi-value show list (box|top) as data-show-if-value since core passes
only parent through; server-side initial d-none is multi-value aware
(Prompt Q logic extended); buttons/colorpicker children now also get
data-parent/selector_radio_childfield. options.js: updateVisibilityByParent
and updateChild are multi-value + checked-radio aware (single-value
behaviour unchanged); OPTIONS_JS_TOKEN bumped.
custom_header.twig: .question-help-container gets color from
questionhelpfontcolor.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-25 11:35:18 +01:00
commit 671fba4aff

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 = '20261124.4' %}
{% set OPTIONS_JS_TOKEN = '20261125.1' %}
{{ unregisterScriptFile(optionsPath ~ '/options.js') }}
{{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }}
@ -163,6 +163,22 @@
next to it stays empty) directly below the logo hr, in this fixed order. #}
{% set aProgressKeys = ['progressbarposition', 'progressbarbackgroundcolor', 'progressbarcolor', 'progressbarfontcolor'] %}
{# Prompt R: multi-value show lists per parent key, rendered as
data-show-if-value (e.g. "box|top" for questionborder). Core passes only the
`parent` attribute through to the option attributes, so this list lives here
in the theme. Default 'on'. Used both for the wrapper attribute and for the
server-side initial d-none (Prompt Q). #}
{% set aShowIfValues = { 'questionborder': 'box|top' } %}
{# Prompt R: the Questions pane renders as THREE columns (col-md-4, border-start
between them) with explicit key lists. config.xml lists the Questions options
in exactly this column order, so the generic loop meets them column by column
and opens/closes the columns on column change (qLastCol). Column 2's
conditional children use aShowIfValues['questionborder'] = 'box|top'. #}
{% set aQuestionsCol1 = ['questiontitlebackgroundcolor', 'questiontitlefontcolor', 'questionbackgroundcolor', 'questionhelpbackgroundcolor', 'questionhelpfontcolor', 'questionhelptextposition'] %}
{% set aQuestionsCol2 = ['questionborder', 'questionbordercolor', 'questionborderstyle', 'questiondropdown', 'questionborderradiusTL', 'questionborderradiusTR', 'questionborderradiusBL', 'questionborderradiusBR'] %}
{% set aQuestionsCol3 = ['checkboxcolor'] %}
{# 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
@ -232,6 +248,7 @@
full width of the column). Columns 2-3 stay empty. The upload block
below stays full width. #}
{% if tab.category == 'Images' %}<div class="col-md-4 images-options-column">{% endif %}
{% set qLastCol = 0 %}
{% for key in aTabKeys %}
{% set attr = aOptionAttributes.optionAttributes[key] ?? null %}
{% if attr is not null %}
@ -310,29 +327,46 @@
{% if bProgressKey and key == 'progressbarposition' %}
<div class="row action_hide_on_inherit progress-block"><div class="col-md-4">
{% endif %}
{% if bProgressKey %}{% set wrapClass = 'col-12' %}{% else %}{% set wrapClass = 'col-12 col-md-' ~ attr.width|default(2) %}{% endif %}
{# Prompt R: Questions pane — three columns; open a col-md-4 at the
first key and switch column (border-start) whenever the key's
column changes. All options in this pane stack as col-12. #}
{% set bQuestionsPane = tab.category == 'Questions' %}
{% if bQuestionsPane %}
{% set qCol = key in aQuestionsCol1 ? 1 : (key in aQuestionsCol2 ? 2 : 3) %}
{% if qCol != qLastCol %}
{% if qLastCol > 0 %}</div>{% endif %}
<div class="col-md-4{% if qLastCol > 0 %} border-start{% endif %} questions-col-{{ qCol }}">
{% set qLastCol = qCol %}
{% endif %}
{% endif %}
{% if bQuestionsPane %}{% set wrapClass = 'col-12' %}{% elseif bProgressKey %}{% set wrapClass = 'col-12' %}{% else %}{% set wrapClass = 'col-12 col-md-' ~ attr.width|default(2) %}{% endif %}
{# 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"
(options.js toggles .option-visibility via data-show-if-parent);
{# parent != '': this field is only visible when the parent option's value
is one of the show-values (default "on"; Prompt R: e.g. "box|top" for
questionborder, see aShowIfValues). options.js toggles
.option-visibility via data-show-if-parent/data-show-if-value;
the field itself is additionally disabled via data-parent/selector_radio_childfield #}
{# Prompt Q: server-side INITIAL visibility — when the parent is a buttons
group, add d-none at render time unless the parent's current value is
the show-value ("on"). Same source of truth as currentValue (stored
options JSON, fallback oParentOptions). options.js updateVisibilityByParent()
toggles the same class on change (idempotent with this initial state).
Non-buttons parents (e.g. font's self-parent dropdown) have no radio
inputs -> options.js always shows them, so no d-none here. #}
{# Prompt Q (multi-value since Prompt R): server-side INITIAL visibility —
when the parent is a buttons group, add d-none at render time unless the
parent's current value is IN the show-value list. Same source of truth
as currentValue (stored options JSON, fallback oParentOptions). options.js
updateVisibilityByParent() toggles the same class on change (idempotent
with this initial state). Non-buttons parents (e.g. font's self-parent
dropdown) have no radio inputs -> options.js always shows them, so no
d-none here. #}
{% set bParentHidden = false %}
{% set showIfValues = 'on' %}
{% if attr.parent != '' %}
{% set parentAttr = aOptionAttributes.optionAttributes[attr.parent] ?? null %}
{% set showIfValues = aShowIfValues[attr.parent] ?? 'on' %}
{% if parentAttr is not null and parentAttr.type == 'buttons' %}
{% set parentValue = bGeneralInherit ? 'inherit' : (aCurrentOptions[attr.parent] is defined ? aCurrentOptions[attr.parent] : (oParentOptions[attr.parent] is defined ? oParentOptions[attr.parent] : '')) %}
{% if parentValue != 'on' %}{% set bParentHidden = true %}{% endif %}
{% if parentValue not in showIfValues|split('|') %}{% set bParentHidden = true %}{% endif %}
{% 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="on"{% endif %}>
{% if attr.parent != '' %}data-show-if-parent="{{ attr.parent }}" data-show-if-value="{{ showIfValues }}"{% endif %}>
<div class="mb-3">
{# 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>
@ -350,13 +384,15 @@
{% for optValue in optValues %}
<input id="{{ key }}_{{ optValue }}" type="radio" name="{{ key }}" value="{{ optValue }}"
{% if currentValue == optValue %}checked{% endif %}
class="btn-check selector_option_radio_field simple_edit_options_{{ key }}"/>
class="btn-check selector_option_radio_field simple_edit_options_{{ key }}{% if attr.parent != '' %} selector_radio_childfield{% endif %}"
{% if attr.parent != '' %}data-parent="{{ attr.parent }}"{% endif %}/>
<label for="{{ key }}_{{ optValue }}" class="btn btn-outline-secondary{% if currentValue == optValue %} active{% endif %}">{{ gT(optLabels[loop.index0]|default(optValue)) }}</label>
{% endfor %}
{% if bInherit %}
<input id="{{ key }}_inherit" type="radio" name="{{ key }}" value="inherit"
{% if currentValue == 'inherit' %}checked{% endif %}
class="btn-check selector_option_radio_field simple_edit_options_{{ key }}"/>
class="btn-check selector_option_radio_field simple_edit_options_{{ key }}{% if attr.parent != '' %} selector_radio_childfield{% endif %}"
{% if attr.parent != '' %}data-parent="{{ attr.parent }}"{% endif %}/>
<label for="{{ key }}_inherit" class="btn btn-outline-secondary{% if currentValue == 'inherit' %} active{% endif %}">{{ gT("Inherit") }} [{{ oParentOptions[key] }}]</label>
{% endif %}
</div>
@ -435,8 +471,9 @@
<input type="text" name="{{ key }}" data-inheritvalue="{{ oParentOptions[key] }}"
value="{% if currentValue != '' and currentValue != 'inherit' %}{{ currentValue }}{% endif %}"
{% if bInherit %}placeholder="{{ gT("Inherit") }} [{{ gT("Inherited value:") }} {{ oParentOptions[key] }}]"{% endif %}
{% if attr.parent != '' %}data-parent="{{ attr.parent }}"{% endif %}
id="simple_edit_options_{{ key }}"
class="selector_option_value_field selector__color-picker form-control simple_edit_options_{{ key }}"/>
class="selector_option_value_field selector__color-picker form-control simple_edit_options_{{ key }}{% if attr.parent != '' %} selector_radio_childfield{% endif %}"/>
{% if bInherit %}
<div class="input-group-text">
<button class="btn btn-outline-secondary btn-xs selector__reset-colorfield-to-inherit"><i class="ri-refresh-line"></i></button>
@ -467,6 +504,7 @@
{% endif %}
{% endfor %}
{% if tab.category == 'Images' %}</div>{% endif %}
{% if tab.category == 'Questions' and qLastCol > 0 %}</div>{% endif %}
</div>
{% if tab.category == 'Images' %}