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
4 changed files with 96 additions and 39 deletions

View file

@ -140,25 +140,35 @@
<!-- Questions <!-- Questions
HOUSE-STYLE: the colorpicker options in this section (question HOUSE-STYLE: the colorpicker options in this section (question
title/background/help/border/checkbox colors) are house-style colors. title/background/help/help-font/border/checkbox colors) are house-style
NOT house-style (structural, same for all variants): questionborder, colors. NOT house-style (structural, same for all variants):
questionborderstyle, the borderradius values, questiondropdown and questionborder, questionborderstyle, the borderradius values,
questionhelptextposition. --> questiondropdown and questionhelptextposition.
Prompt R: order = the three columns of the Questions tab (options.twig
renders them in this order): col1 colors+help, col2 border + its
conditional children, col3 checkbox color. All width=12 — inside the
pane each option stacks as col-12 in its column. The border children
carry parent="questionborder"; the show-values "box|top" cannot be an
XML attribute (core passes only `parent` through), so the multi-value
list lives in options.twig (aShowIfValues) and lands as
data-show-if-value="box|top". questionhelpfontcolor (NEW) is applied
in custom_header.twig on .question-help-container. -->
<!-- Questions --> <!-- Questions -->
<questiontitlebackgroundcolor type="colorpicker" category="Questions" width="6" title="Question title background color" options="on|off" optionlabels="Yes|No">#5e1c64</questiontitlebackgroundcolor> <questiontitlebackgroundcolor type="colorpicker" category="Questions" width="12" title="Question title background color" options="on|off" optionlabels="Yes|No">#5e1c64</questiontitlebackgroundcolor>
<questiontitlefontcolor type="colorpicker" category="Questions" width="6" title="Question title font color" options="on|off" optionlabels="Yes|No">#ffffff</questiontitlefontcolor> <questiontitlefontcolor type="colorpicker" category="Questions" width="12" title="Question title font color" options="on|off" optionlabels="Yes|No">#ffffff</questiontitlefontcolor>
<questionbackgroundcolor type="colorpicker" category="Questions" width="6" title="Question background color (not title)" options="on|off" optionlabels="Yes|No">#ffffff</questionbackgroundcolor> <questionbackgroundcolor type="colorpicker" category="Questions" width="12" title="Question background color (not title)" options="on|off" optionlabels="Yes|No">#ffffff</questionbackgroundcolor>
<questionhelpbackgroundcolor type="colorpicker" category="Questions" width="6" title="Question helpbackground color" options="on|off" optionlabels="Yes|No">#fff3cd</questionhelpbackgroundcolor> <questionhelpbackgroundcolor type="colorpicker" category="Questions" width="12" title="Question helpbackground color" options="on|off" optionlabels="Yes|No">#fff3cd</questionhelpbackgroundcolor>
<questionborder type="buttons" category="Questions" width="6" title="Question border" options="box|top|none" optionlabels="Box around|Top and bottom|None">box</questionborder> <questionhelpfontcolor type="colorpicker" category="Questions" width="12" title="Question help font color" options="on|off" optionlabels="Yes|No">#444444</questionhelpfontcolor>
<questionborderstyle type="buttons" category="Questions" width="6" title="Question border line style" options="solid|dotted|dashed" optionlabels="Solid|Dotted|Dashed">solid</questionborderstyle> <questionhelptextposition type="buttons" category="Questions" width="12" title="Question help text position" options="top|bottom" optionlabels="Top|Bottom">top</questionhelptextposition>
<questionbordercolor type="colorpicker" category="Questions" width="12" title="Question border color" options="on|off" optionlabels="Yes|No">#cccccc</questionbordercolor> <questionborder type="buttons" category="Questions" width="12" title="Question border" options="box|top|none" optionlabels="Box around|Top and bottom|None">box</questionborder>
<questionborderradiusTL type="duration" category="Questions" width="3" title="Border radius top left">5px</questionborderradiusTL> <questionbordercolor type="colorpicker" category="Questions" width="12" title="Question border color" options="on|off" optionlabels="Yes|No" parent="questionborder">#cccccc</questionbordercolor>
<questionborderradiusTR type="duration" category="Questions" width="3" title="Border radius top right">5px</questionborderradiusTR> <questionborderstyle type="buttons" category="Questions" width="12" title="Question border line style" options="solid|dotted|dashed" optionlabels="Solid|Dotted|Dashed" parent="questionborder">solid</questionborderstyle>
<questionborderradiusBL type="duration" category="Questions" width="3" title="Border radius bottom left">5px</questionborderradiusBL> <questiondropdown type="buttons" category="Questions" width="12" title="Question dropdown shadow" options="on|hover|off" optionlabels="Always|On hover only|None" parent="questionborder">hover</questiondropdown>
<questionborderradiusBR type="duration" category="Questions" width="3" title="Border radius bottom right">5px</questionborderradiusBR> <questionborderradiusTL type="duration" category="Questions" width="12" title="Border radius top left" parent="questionborder">5px</questionborderradiusTL>
<questiondropdown type="buttons" category="Questions" width="6" title="Question dropdown shadow" options="on|hover|off" optionlabels="Always|On hover only|None">hover</questiondropdown> <questionborderradiusTR type="duration" category="Questions" width="12" title="Border radius top right" parent="questionborder">5px</questionborderradiusTR>
<questionhelptextposition type="buttons" category="Questions" width="6" title="Question help text position" options="top|bottom" optionlabels="Top|Bottom">top</questionhelptextposition> <questionborderradiusBL type="duration" category="Questions" width="12" title="Border radius bottom left" parent="questionborder">5px</questionborderradiusBL>
<checkboxcolor type="colorpicker" category="Questions" width="6" title="Checkbox/radiobutton color (when checked)" options="on|off" optionlabels="Yes|No">#ff005f</checkboxcolor> <questionborderradiusBR type="duration" category="Questions" width="12" title="Border radius bottom right" parent="questionborder">5px</questionborderradiusBR>
<checkboxcolor type="colorpicker" category="Questions" width="12" title="Checkbox/radiobutton color (when checked)" options="on|off" optionlabels="Yes|No">#ff005f</checkboxcolor>
<!-- Progress --> <!-- Progress -->
<!-- Prompt N: listing order swapped — "In header" FIRST, then "Under header". <!-- Prompt N: listing order swapped — "In header" FIRST, then "Under header".

View file

@ -311,9 +311,14 @@ var ThemeOptions = function () {
let enabled = true; let enabled = true;
if(parentEl.length) { if(parentEl.length) {
const parentOn = $(parentEl).val() === 'on'; // THEME ADDITION (Prompt R): parentEl is a SET of radios — read the
const parentChecked = $(parentEl).prop('checked') === true; // CHECKED one (not the first element) and accept any of the wrapper's
enabled = parentOn && parentChecked; // show-values (data-show-if-value, pipe-separated). Single-value
// parents ('on') behave exactly as before.
const checked = parentEl.filter(':checked');
const wrapper = $(childEl).closest('.option-visibility');
const showValues = String(wrapper.data('show-if-value') || 'on').split('|');
enabled = checked.length > 0 && showValues.indexOf(String(checked.val())) !== -1;
} }
$(childEl).prop('disabled', !enabled); $(childEl).prop('disabled', !enabled);
@ -343,7 +348,10 @@ var ThemeOptions = function () {
const updateVisibilityByParent = function() { const updateVisibilityByParent = function() {
$('.option-visibility[data-show-if-parent]').each(function (i, wrapperEl) { $('.option-visibility[data-show-if-parent]').each(function (i, wrapperEl) {
const parentName = $(wrapperEl).data('show-if-parent'); const parentName = $(wrapperEl).data('show-if-parent');
const showValue = $(wrapperEl).data('show-if-value') || 'on'; // THEME ADDITION (Prompt R): multi-value — data-show-if-value may be a
// pipe-separated list (e.g. "box|top" for questionborder); a single
// value keeps working unchanged.
const showValues = String($(wrapperEl).data('show-if-value') || 'on').split('|');
const parentInputs = $('input[name="' + parentName + '"]'); const parentInputs = $('input[name="' + parentName + '"]');
// no parent input in the markup (e.g. font's self-parent): always visible, // no parent input in the markup (e.g. font's self-parent): always visible,
// same fallback as updateChild() above // same fallback as updateChild() above
@ -352,7 +360,7 @@ var ThemeOptions = function () {
return; return;
} }
const checked = parentInputs.filter(':checked'); const checked = parentInputs.filter(':checked');
const visible = checked.length > 0 && checked.val() === String(showValue); const visible = checked.length > 0 && showValues.indexOf(String(checked.val())) !== -1;
$(wrapperEl).toggleClass('d-none', !visible); $(wrapperEl).toggleClass('d-none', !visible);
}); });
}; };

View file

@ -43,7 +43,7 @@
heuristically cached copy (the file has only Last-Modified/ETag, no Cache-Control). 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 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. #} 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') }} {{ unregisterScriptFile(optionsPath ~ '/options.js') }}
{{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }} {{ 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. #} next to it stays empty) directly below the logo hr, in this fixed order. #}
{% set aProgressKeys = ['progressbarposition', 'progressbarbackgroundcolor', 'progressbarcolor', 'progressbarfontcolor'] %} {% 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 {# 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 = 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 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 full width of the column). Columns 2-3 stay empty. The upload block
below stays full width. #} below stays full width. #}
{% if tab.category == 'Images' %}<div class="col-md-4 images-options-column">{% endif %} {% if tab.category == 'Images' %}<div class="col-md-4 images-options-column">{% endif %}
{% set qLastCol = 0 %}
{% for key in aTabKeys %} {% for key in aTabKeys %}
{% set attr = aOptionAttributes.optionAttributes[key] ?? null %} {% set attr = aOptionAttributes.optionAttributes[key] ?? null %}
{% if attr is not null %} {% if attr is not null %}
@ -310,29 +327,46 @@
{% if bProgressKey and key == 'progressbarposition' %} {% if bProgressKey and key == 'progressbarposition' %}
<div class="row action_hide_on_inherit progress-block"><div class="col-md-4"> <div class="row action_hide_on_inherit progress-block"><div class="col-md-4">
{% endif %} {% 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) #} {# 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] : '')) %} {% 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" {# parent != '': this field is only visible when the parent option's value
(options.js toggles .option-visibility via data-show-if-parent); 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 #} the field itself is additionally disabled via data-parent/selector_radio_childfield #}
{# Prompt Q: server-side INITIAL visibility — when the parent is a buttons {# Prompt Q (multi-value since Prompt R): server-side INITIAL visibility —
group, add d-none at render time unless the parent's current value is when the parent is a buttons group, add d-none at render time unless the
the show-value ("on"). Same source of truth as currentValue (stored parent's current value is IN the show-value list. Same source of truth
options JSON, fallback oParentOptions). options.js updateVisibilityByParent() as currentValue (stored options JSON, fallback oParentOptions). options.js
toggles the same class on change (idempotent with this initial state). updateVisibilityByParent() toggles the same class on change (idempotent
Non-buttons parents (e.g. font's self-parent dropdown) have no radio with this initial state). Non-buttons parents (e.g. font's self-parent
inputs -> options.js always shows them, so no d-none here. #} dropdown) have no radio inputs -> options.js always shows them, so no
d-none here. #}
{% set bParentHidden = false %} {% set bParentHidden = false %}
{% set showIfValues = 'on' %}
{% if attr.parent != '' %} {% if attr.parent != '' %}
{% set parentAttr = aOptionAttributes.optionAttributes[attr.parent] ?? null %} {% set parentAttr = aOptionAttributes.optionAttributes[attr.parent] ?? null %}
{% set showIfValues = aShowIfValues[attr.parent] ?? 'on' %}
{% if parentAttr is not null and parentAttr.type == 'buttons' %} {% 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] : '')) %} {% 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 %}
{% endif %} {% endif %}
<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="on"{% 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 incl. checkbox (Prompt G) #}
<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>
@ -350,13 +384,15 @@
{% for optValue in optValues %} {% for optValue in optValues %}
<input id="{{ key }}_{{ optValue }}" type="radio" name="{{ key }}" value="{{ optValue }}" <input id="{{ key }}_{{ optValue }}" type="radio" name="{{ key }}" value="{{ optValue }}"
{% if currentValue == optValue %}checked{% endif %} {% 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> <label for="{{ key }}_{{ optValue }}" class="btn btn-outline-secondary{% if currentValue == optValue %} active{% endif %}">{{ gT(optLabels[loop.index0]|default(optValue)) }}</label>
{% endfor %} {% endfor %}
{% if bInherit %} {% if bInherit %}
<input id="{{ key }}_inherit" type="radio" name="{{ key }}" value="inherit" <input id="{{ key }}_inherit" type="radio" name="{{ key }}" value="inherit"
{% if currentValue == 'inherit' %}checked{% endif %} {% 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> <label for="{{ key }}_inherit" class="btn btn-outline-secondary{% if currentValue == 'inherit' %} active{% endif %}">{{ gT("Inherit") }} [{{ oParentOptions[key] }}]</label>
{% endif %} {% endif %}
</div> </div>
@ -435,8 +471,9 @@
<input type="text" name="{{ key }}" data-inheritvalue="{{ oParentOptions[key] }}" <input type="text" name="{{ key }}" data-inheritvalue="{{ oParentOptions[key] }}"
value="{% if currentValue != '' and currentValue != 'inherit' %}{{ currentValue }}{% endif %}" value="{% if currentValue != '' and currentValue != 'inherit' %}{{ currentValue }}{% endif %}"
{% if bInherit %}placeholder="{{ gT("Inherit") }} [{{ gT("Inherited value:") }} {{ oParentOptions[key] }}]"{% 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 }}" 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 %} {% if bInherit %}
<div class="input-group-text"> <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> <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 %} {% endif %}
{% endfor %} {% endfor %}
{% if tab.category == 'Images' %}</div>{% endif %} {% if tab.category == 'Images' %}</div>{% endif %}
{% if tab.category == 'Questions' and qLastCol > 0 %}</div>{% endif %}
</div> </div>
{% if tab.category == 'Images' %} {% if tab.category == 'Images' %}

View file

@ -212,6 +212,7 @@
.question-help-container, .question-valid-container { .question-help-container, .question-valid-container {
background: {{ aSurveyInfo.options.questionhelpbackgroundcolor }}; background: {{ aSurveyInfo.options.questionhelpbackgroundcolor }};
color: {{ aSurveyInfo.options.questionhelpfontcolor|default('') }};
} }
.slider-handle { .slider-handle {