feat(options): row 221 — align Questions-tab color columns + move slider handle color into the answers section

Request 1: options.js generalizes the Header-tab column alignment
(alignHeaderColumns, measured padding-top) to the Questions tab via
alignQuestionColumns(): in the 'Question title and body' section columns 2
and 3 are top-aligned with the title text-color chooser in column 1; in
'Answer options and subquestions' column 2 (checkbox color) aligns with the
answers text color; in 'Question help' column 2 (help background) aligns with
the help font color. Runs on run(), on any shown.bs.tab and on resize (hidden
panes measure 0 and no-op).

Request 2: the orphaned full-width 'Slider handle color' picker at the bottom
of the Questions tab becomes a 6-way color chooser (default color2) with a
sliderhandlecolorcustom child, placed in the THIRD column of 'Answer options
and subquestions' (aQSlots answers:2). custom_header.twig resolves it via
cm() (legacy stored hex passes through). variants/build.php maps legacy hex
json values of variants to mode 'other' + custom child; all variants rebuilt
(defensie, erasmus) + example config synced.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-30 10:01:49 +01:00
commit e9c0ac5c14
6 changed files with 92 additions and 28 deletions

View file

@ -502,6 +502,22 @@
<option value="other">Other ...</option>
</dropdownoptions></checkboxcolor>
<checkboxcolorcustom type="colorpicker" category="Questions" width="4" title="Custom checkbox/radiobutton color (for 'Other ...')" parent="checkboxcolor">#ff005f</checkboxcolorcustom>
<!-- row 221: the slider handle color is a 6-way color chooser (default
"color2", like checkboxcolor) in the THIRD column of the "Answer options
and subquestions" section (aQSlots answers:2 in options.twig) — no
longer an orphaned full-width row at the bottom of the Questions pane.
Applied in custom_header.twig via cm(); variants/build.php maps a legacy
hex json value to mode "other" + sliderhandlecolorcustom. -->
<sliderhandlecolor type="dropdown" category="Questions" width="4" title="Slider handle color" options="default|defaultbackgroundcolor|color1|color2|color3|other" optionlabels="Default font color|Default background color|Color 1|Color 2|Color 3|Other ...">color2
<dropdownoptions>
<option value="default">Default font color</option>
<option value="defaultbackgroundcolor">Default background color</option>
<option value="color1">Color 1</option>
<option value="color2" data-default="1">[Color 2]</option>
<option value="color3">Color 3</option>
<option value="other">Other ...</option>
</dropdownoptions></sliderhandlecolor>
<sliderhandlecolorcustom type="colorpicker" category="Questions" width="4" title="Custom slider handle color (for 'Other ...')" parent="sliderhandlecolor">#5e1c64</sliderhandlecolorcustom>
<!-- Row 178 plan P4 (row 186, revised row 195): section "Question help"
(options.twig) — a three-column grid (col-md-4, width 4):
col 1 = the font chooser for the help text + the help font color (stays a
@ -556,10 +572,6 @@
<questionborderradiusTR type="duration" category="Questions" width="4" title="Border radius top right" parent="questionborder">5px</questionborderradiusTR>
<questionborderradiusBL type="duration" category="Questions" width="4" title="Border radius bottom left" parent="questionborder">5px</questionborderradiusBL>
<questionborderradiusBR type="duration" category="Questions" width="4" title="Border radius bottom right" parent="questionborder">5px</questionborderradiusBR>
<!-- row 204: the slider handle color moved here from the removed Colors
category — sliders appear inside questions, so it renders as a full-width
row at the end of the Questions pane (applied in custom_header.twig) -->
<sliderhandlecolor type="colorpicker" category="Questions" width="12" title="Slider handle color" options="on|off" optionlabels="Yes|No">#5e1c64</sliderhandlecolor>
<!-- Questions
HOUSE-STYLE: the colorpicker options in this section (question
title/background/help/help-font/border/checkbox colors) are house-style
@ -665,7 +677,8 @@
<submitbuttontextcolorcustom type="colorpicker" category="Buttons" width="4" title="Custom font color for the Submit button (for 'Other ...')" parent="submitbuttontextcolor">#ffffff</submitbuttontextcolorcustom>
<!-- row 204: the Colors category is gone — its last two options moved to
Page background (privacybackgroundcolor) and Questions (sliderhandlecolor),
Page background (privacybackgroundcolor) and Questions (sliderhandlecolor,
since row 221 a 6-way chooser in the answers section, not a full-width row),
so every remaining category is a visible tab again. -->
<!-- Other options tab (options.twig LAST tab): width 12 = full-width rows. -->

View file

@ -926,16 +926,47 @@ var ThemeOptions = function () {
if (diff > 0) { bgCol[0].style.paddingTop = diff + 'px'; }
};
// THEME ADDITION (row 142): re-measure the header column alignment when the
// Top-of-page tab is (re)shown or the window resizes — at page load that pane
// is usually hidden (display:none), where getBoundingClientRect returns 0 and
// no offset would be applied, so the one-shot run() call alone is not enough.
var bindHeaderAlignTriggers = function () {
document.addEventListener('shown.bs.tab', function (e) {
var t = e.target && e.target.getAttribute ? e.target.getAttribute('data-bs-target') : null;
if (t === '#top-of-page') { setTimeout(alignHeaderColumns, 0); }
// THEME ADDITION (row 221): the same measured top-alignment as the Header tab,
// applied to the Questions tab sections — the color chooser column(s) listed in
// targets get a padding-top so their first control aligns with the font-color
// chooser (ref) in the first column of the same section:
// title section: cols 2+3 (title bg, body bg) align with the title text color
// answers section: col 2 (checkbox color) aligns with the answers text color
// help section: col 2 (help bg) aligns with the help font color
var aQuestionColumnAlign = [
{ sec: 'title', ref: 'questiontitletextcolor', targets: ['questiontitlebackgroundcolor', 'questionbackgroundcolor'] },
{ sec: 'answers', ref: 'answerstextcolor', targets: ['checkboxcolor'] },
{ sec: 'help', ref: 'questionhelpfontcolor', targets: ['questionhelpbackgroundcolor'] }
];
var alignQuestionColumns = function () {
$.each(aQuestionColumnAlign, function (i, cfg) {
var row = globalForm.find('.questions-section-' + cfg.sec).first();
var refField = globalForm.find('#simple_edit_options_' + cfg.ref);
if (!row.length || !refField.length) { return; }
var refWrap = refField.closest('.mb-3');
if (!refWrap.length || !refWrap[0].getBoundingClientRect) { return; }
var refTop = refWrap[0].getBoundingClientRect().top;
$.each(cfg.targets, function (j, tkey) {
var tField = globalForm.find('#simple_edit_options_' + tkey);
if (!tField.length) { return; }
var tCol = tField.closest('.questions-section-' + cfg.sec + ' .col-md-4');
if (!tCol.length || !tCol[0].getBoundingClientRect) { return; }
var diff = refTop - tCol[0].getBoundingClientRect().top;
if (diff > 0) { tCol[0].style.paddingTop = diff + 'px'; }
});
});
window.addEventListener('resize', function () { alignHeaderColumns(); });
};
var alignAllColumns = function () { alignHeaderColumns(); alignQuestionColumns(); };
// THEME ADDITION (row 142, generalized row 221): re-measure the column
// alignment when a tab is (re)shown or the window resizes — at page load the
// non-active panes are hidden (display:none), where getBoundingClientRect
// returns 0 and no offset would be applied, so the one-shot run() call alone
// is not enough. Running on ANY shown tab is safe: hidden panes measure 0 and
// the aligners no-op (diff > 0 guard).
var bindHeaderAlignTriggers = function () {
document.addEventListener('shown.bs.tab', function () { setTimeout(alignAllColumns, 0); });
window.addEventListener('resize', function () { alignAllColumns(); });
};
// Shared delegated handlers for ALL chooser dropdowns (row 122/135): a REAL user
@ -1021,8 +1052,10 @@ var ThemeOptions = function () {
safeStep('bindColorModeDelegates', bindColorModeDelegates);
// THEME ADDITION (row 136/142): align the header background color (col 2) with
// the text color option (col 1) in the Top-of-the-page tab
// the text color option (col 1) in the Top-of-the-page tab; row 221: the same
// for the Questions tab sections (title cols 2+3, answers col 2, help col 2)
safeStep('alignHeaderColumns', alignHeaderColumns);
safeStep('alignQuestionColumns', alignQuestionColumns);
safeStep('bindHeaderAlignTriggers', bindHeaderAlignTriggers);
// THEME ADDITION (row 133): restore the options tab the user was on before
@ -1070,9 +1103,9 @@ var ThemeOptions = function () {
var id = sessionStorage.getItem(tabStorageKey());
if (id) {
activateTab(id);
// row 142: if the restored tab is Top-of-page, re-measure the header
// column alignment now that the pane is visible
if (id === 'tab-top-of-page') { setTimeout(alignHeaderColumns, 0); }
// row 142 / row 221: re-measure the column alignment(s) now that the
// restored pane is visible
setTimeout(alignAllColumns, 0);
}
} catch (e) { /* storage unavailable — keep the first tab */ }
};

View file

@ -310,7 +310,7 @@
row 184 / plan P3: answerstextcolor as well; row 186 / plan P4:
questionhelpbackgroundcolor as well. Must stay in sync with
aColorChooserKeys in options/options.js. #}
{% set aColorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor', 'grouptitletextcolor', 'groupdescriptiontextcolor', 'questiontitletextcolor', 'questiontitlebackgroundcolor', 'questionbackgroundcolor', 'answerstextcolor', 'questionhelpbackgroundcolor', 'questionhelpfontcolor', 'questionbordercolor', 'checkboxcolor', 'previousbuttonbackgroundcolor', 'previousbuttontextcolor', 'nextbuttonbackgroundcolor', 'nextbuttontextcolor', 'submitbuttonbackgroundcolor', 'submitbuttontextcolor'] %}
{% set aColorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor', 'grouptitletextcolor', 'groupdescriptiontextcolor', 'questiontitletextcolor', 'questiontitlebackgroundcolor', 'questionbackgroundcolor', 'answerstextcolor', 'questionhelpbackgroundcolor', 'questionhelpfontcolor', 'questionbordercolor', 'checkboxcolor', 'sliderhandlecolor', 'previousbuttonbackgroundcolor', 'previousbuttontextcolor', 'nextbuttonbackgroundcolor', 'nextbuttontextcolor', 'submitbuttonbackgroundcolor', 'submitbuttontextcolor'] %}
{% set aShowIfValues = { 'questionborder': 'box|top', 'navbarfontcolor': 'other' } %}
{# row 197: per-KEY show-value override — the four border radii show ONLY for
@ -366,7 +366,8 @@
so related choosers sit next to each other on one row:
title: col 1 = font + font color (+custom) + size + options + legacy picker (P2),
col 2 = title background chooser (+custom), col 3 = body background chooser (+custom)
answers: col 1 = font + font color (+custom), col 2 = checkbox/radiobutton chooser (+custom) (row 195)
answers: col 1 = font + font color (+custom), col 2 = checkbox/radiobutton chooser (+custom) (row 195),
col 3 = slider handle color chooser (+custom) (row 221)
help: col 1 = help font + font color (+custom), col 2 = help background chooser (+custom),
col 3 = help text position (row 195)
border: col 1 = border type, col 2 = color/style/shadow children, col 3 = the four radii (2x2)
@ -381,6 +382,7 @@
'questionbackgroundcolor': 'title:2', 'questionbackgroundcolorcustom': 'title:2',
'answersfont': 'answers:0', 'answerstextcolor': 'answers:0', 'answerstextcolorcustom': 'answers:0',
'checkboxcolor': 'answers:1', 'checkboxcolorcustom': 'answers:1',
'sliderhandlecolor': 'answers:2', 'sliderhandlecolorcustom': 'answers:2',
'questionhelpfont': 'help:0', 'questionhelpfontcolor': 'help:0', 'questionhelpfontcolorcustom': 'help:0',
'questionhelpbackgroundcolor': 'help:1', 'questionhelpbackgroundcolorcustom': 'help:1',
'questionhelptextposition': 'help:2',

View file

@ -275,14 +275,14 @@ foreach ($logoPositions as $pos) {
// questiontitlebackgroundcolor, questionbackgroundcolor; row 184 plan P3 adds
// answerstextcolor; row 186 plan P4 adds questionhelpbackgroundcolor; row 191 plan
// P6 adds the six per-button choosers; row 195 adds checkboxcolor; row 197 adds
// questionhelpfontcolor + questionbordercolor) became mode
// questionhelpfontcolor + questionbordercolor; row 221 adds sliderhandlecolor) became mode
// dropdowns
// (default|defaultbackgroundcolor|color1|color2|color3|other) with a <key>custom
// colorpicker child. A legacy HEX value in the json means "custom color": map it
// to mode "other" and move the hex into the <key>custom child, so the variant
// default stays valid for the dropdown. A legacy mode "primary"/"secondary"
// (old 4-way textcolor dropdown) maps to "color1"/"color2".
$colorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor', 'grouptitletextcolor', 'groupdescriptiontextcolor', 'questiontitletextcolor', 'questiontitlebackgroundcolor', 'questionbackgroundcolor', 'answerstextcolor', 'questionhelpbackgroundcolor', 'questionhelpfontcolor', 'questionbordercolor', 'checkboxcolor', 'previousbuttonbackgroundcolor', 'previousbuttontextcolor', 'nextbuttonbackgroundcolor', 'nextbuttontextcolor', 'submitbuttonbackgroundcolor', 'submitbuttontextcolor'];
$colorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor', 'grouptitletextcolor', 'groupdescriptiontextcolor', 'questiontitletextcolor', 'questiontitlebackgroundcolor', 'questionbackgroundcolor', 'answerstextcolor', 'questionhelpbackgroundcolor', 'questionhelpfontcolor', 'questionbordercolor', 'checkboxcolor', 'sliderhandlecolor', 'previousbuttonbackgroundcolor', 'previousbuttontextcolor', 'nextbuttonbackgroundcolor', 'nextbuttontextcolor', 'submitbuttonbackgroundcolor', 'submitbuttontextcolor'];
$colorChooserLegacyModes = ['primary' => 'color1', 'secondary' => 'color2'];
foreach ($colorChooserKeys as $ck) {
if (isset($definition['options'][$ck])

View file

@ -375,6 +375,22 @@
<checkboxcolor type="dropdown" category="Questions" width="4" title="Checkbox/radiobutton color (when checked)" options="default|defaultbackgroundcolor|color1|color2|color3|other" optionlabels="Default font color|Default background color|Color 1|Color 2|Color 3|Other ...">color2
<dropdownoptions><option value="default">Default font color</option><option value="defaultbackgroundcolor">Default background color</option><option value="color1">Color 1</option><option value="color2" data-default="1">[Color 2]</option><option value="color3">Color 3</option><option value="other">Other ...</option></dropdownoptions></checkboxcolor>
<checkboxcolorcustom type="colorpicker" category="Questions" width="4" title="Custom checkbox/radiobutton color (for 'Other ...')" parent="checkboxcolor">#ff005f</checkboxcolorcustom>
<!-- row 221: the slider handle color is a 6-way color chooser (default
"color2", like checkboxcolor) in the THIRD column of the "Answer options
and subquestions" section (aQSlots answers:2 in options.twig) — no
longer an orphaned full-width row at the bottom of the Questions pane.
Applied in custom_header.twig via cm(); variants/build.php maps a legacy
hex json value to mode "other" + sliderhandlecolorcustom. -->
<sliderhandlecolor type="dropdown" category="Questions" width="4" title="Slider handle color" options="default|defaultbackgroundcolor|color1|color2|color3|other" optionlabels="Default font color|Default background color|Color 1|Color 2|Color 3|Other ...">color2
<dropdownoptions>
<option value="default">Default font color</option>
<option value="defaultbackgroundcolor">Default background color</option>
<option value="color1">Color 1</option>
<option value="color2" data-default="1">[Color 2]</option>
<option value="color3">Color 3</option>
<option value="other">Other ...</option>
</dropdownoptions></sliderhandlecolor>
<sliderhandlecolorcustom type="colorpicker" category="Questions" width="4" title="Custom slider handle color (for 'Other ...')" parent="sliderhandlecolor">#5e1c64</sliderhandlecolorcustom>
<!-- Row 178 plan P4 (row 186, revised row 195): section "Question help"
(options.twig) — a three-column grid (col-md-4, width 4):
col 1 = the font chooser for the help text + the help font color (stays a
@ -408,10 +424,6 @@
<questionborderradiusTR type="duration" category="Questions" width="4" title="Border radius top right" parent="questionborder">5px</questionborderradiusTR>
<questionborderradiusBL type="duration" category="Questions" width="4" title="Border radius bottom left" parent="questionborder">5px</questionborderradiusBL>
<questionborderradiusBR type="duration" category="Questions" width="4" title="Border radius bottom right" parent="questionborder">5px</questionborderradiusBR>
<!-- row 204: the slider handle color moved here from the removed Colors
category — sliders appear inside questions, so it renders as a full-width
row at the end of the Questions pane (applied in custom_header.twig) -->
<sliderhandlecolor type="colorpicker" category="Questions" width="12" title="Slider handle color" options="on|off" optionlabels="Yes|No">#5e1c64</sliderhandlecolor>
<!-- Questions
HOUSE-STYLE: the colorpicker options in this section (question
title/background/help/help-font/border/checkbox colors) are house-style
@ -474,7 +486,8 @@
<dropdownoptions><option value="default">Default font color</option><option value="defaultbackgroundcolor">Default background color</option><option value="color1">Color 1</option><option value="color2">Color 2</option><option value="color3">Color 3</option><option value="other" data-default="1">[Other ...]</option></dropdownoptions></submitbuttontextcolor>
<submitbuttontextcolorcustom type="colorpicker" category="Buttons" width="4" title="Custom font color for the Submit button (for 'Other ...')" parent="submitbuttontextcolor">#ffffff</submitbuttontextcolorcustom>
<!-- row 204: the Colors category is gone — its last two options moved to
Page background (privacybackgroundcolor) and Questions (sliderhandlecolor),
Page background (privacybackgroundcolor) and Questions (sliderhandlecolor,
since row 221 a 6-way chooser in the answers section, not a full-width row),
so every remaining category is a visible tab again. -->
<!-- Other options tab (options.twig LAST tab): width 12 = full-width rows. -->
<!-- Prompt O: the five "Other options" are width=12, so they stack in ONE

View file

@ -336,8 +336,11 @@
color: {{ cmm.cm(aSurveyInfo.options.questionhelpfontcolor|default('default'), aSurveyInfo.options.questionhelpfontcolorcustom|default('#444444'), aSurveyInfo.options) }};
}
{# row 221: sliderhandlecolor is a 6-way color chooser (default "color2") with a
sliderhandlecolorcustom child — resolve via cm(); a legacy stored hex passes
through cm() directly. #}
.slider-handle {
background: {{ aSurveyInfo.options.sliderhandlecolor }};
background: {{ cmm.cm(aSurveyInfo.options.sliderhandlecolor|default('color2'), aSurveyInfo.options.sliderhandlecolorcustom|default('#5e1c64'), aSurveyInfo.options) }};
}
.btn-primary {