feat(options): Questions tab 'Question title and body' section with 6-way color choosers (row 178 plan P2)

config.xml: new section keys questiontitlefont/textcolor(+custom)/fontsize/
fontoptions + legacy fontcolor (col 1), questiontitlebackgroundcolor(+custom)
(col 2), questionbackgroundcolor(+custom) (col 3); old width-12 Prompt-U keys
and plain colorpickers replaced; questiontitlefontweight -> questiontitlefontoptions.
options.twig: title section slots (were prepared in P1), 3 keys join
aColorChooserKeys, OPTIONS_JS_TOKEN 20261129.1. options.js: same 3 keys in its
aColorChooserKeys. Views: choosers resolved via cm() (chooser wins; legacy hex
and primary/secondary modes pass through; legacy picker used when the mode key
is absent); fontoptions mapped to weight/style with legacy fontweight fallback.
build.php: chooser migration list + questiontitle fontweight migration.
All 3 variants rebuilt (defensie legacy hex -> other+custom), 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-29 14:45:57 +01:00
commit 14eb1c2a99
2 changed files with 214 additions and 92 deletions

View file

@ -31,8 +31,11 @@ var ThemeOptions = function () {
var legacyModeValues = {};
// row 135: all options that use the color-chooser scheme (mode dropdown with
// class selector_color_mode + swatch chips + a <key>custom colorpicker child);
// row 157: the group title/description text colors joined the scheme
var aColorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor', 'grouptitletextcolor', 'groupdescriptiontextcolor'];
// row 157: the group title/description text colors joined the scheme;
// row 180 / plan P2: the Questions "title" section keys as well
// (questiontitletextcolor, questiontitlebackgroundcolor, questionbackgroundcolor).
// Must stay in sync with aColorChooserKeys in options/options.twig.
var aColorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor', 'grouptitletextcolor', 'groupdescriptiontextcolor', 'questiontitletextcolor', 'questiontitlebackgroundcolor', 'questionbackgroundcolor'];
// the 5 presets, in the SAME order as the dropdown options in config.xml
// (object key order = swatch chip order) — row 125: "Default background color"
// is the SECOND choice, right after "Default font color".

View file

@ -47,7 +47,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 = '20261127.1' %}
{% set OPTIONS_JS_TOKEN = '20261129.1' %}
{{ unregisterScriptFile(optionsPath ~ '/options.js') }}
{{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }}
@ -269,7 +269,7 @@
{% set aFontElements = ['questiontitle', 'answers', 'grouptitle', 'groupdescription', 'buttons'] %}
{% set aColorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor', 'grouptitletextcolor', 'groupdescriptiontextcolor'] %}
{% set aColorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor', 'grouptitletextcolor', 'groupdescriptiontextcolor', 'questiontitletextcolor', 'questiontitlebackgroundcolor', 'questionbackgroundcolor'] %}
{% set aShowIfValues = { 'questionborder': 'box|top', 'navbarfontcolor': 'other' } %}
{% for el in aFontElements %}{% set aShowIfValues = aShowIfValues|merge({ (el ~ 'textcolor'): 'other' }) %}{% endfor %}
@ -290,12 +290,26 @@
{% set aFontsCol2 = ['defaultbackgroundcolor'] %}
{% set aFontsCol3 = ['primarycolor', 'secondarycolor', 'tertiarycolor'] %}
{% set aQuestionsCol1 = ['questiontitlebackgroundcolor', 'questiontitlefontcolor', 'questionbackgroundcolor', 'questionhelpbackgroundcolor', 'questionhelpfontcolor', 'questionhelptextposition'] %}
{% set aQuestionsCol1 = ['questionhelpbackgroundcolor', 'questionhelpfontcolor', 'questionhelptextposition'] %}
{% set aQuestionsCol2 = ['questionborder', 'questionbordercolor', 'questionborderstyle', 'questiondropdown', 'questionborderradiusTL', 'questionborderradiusTR', 'questionborderradiusBL', 'questionborderradiusBR'] %}
{% set aQuestionsCol3 = ['checkboxcolor'] %}
{# row 179 / plan P1: the "Overall question" section at the top of the Questions
pane — qCol 4, rendered as ONE col-md-6 column, followed by a full-width hr #}
{% set aQuestionsOverall = ['questiondistance', 'questiondistancebottom'] %}
{# row 178/179 plan: the Questions pane is built from SECTIONS — each section is an
h3 + its own row of columns and ends with a full-width hr. aQSections lists the
sections (id, h3, colClass); aQSlots maps each option key to "sectionId:colIndex".
Keys not in aQSlots fall back to the legacy columns aQuestionsCol1/2/3 ("legacy:N")
or the full-width rest ("rest"). P1 added "overall", P2 added "title"; P3-P5 add
the remaining sections. #}
{% set aQSections = [
{ 'id': 'overall', 'h3': 'Overall question', 'colClass': 'col-md-6' },
{ 'id': 'title', 'h3': 'Question title and body', 'colClass': 'col-md-4' }
] %}
{% set aQSlots = {
'questiondistance': 'overall:0', 'questiondistancebottom': 'overall:0',
'questiontitlefont': 'title:0', 'questiontitletextcolor': 'title:0', 'questiontitletextcolorcustom': 'title:0',
'questiontitlefontsize': 'title:0', 'questiontitlefontoptions': 'title:0', 'questiontitlefontcolor': 'title:0',
'questiontitlebackgroundcolor': 'title:1', 'questiontitlebackgroundcolorcustom': 'title:1',
'questionbackgroundcolor': 'title:2', 'questionbackgroundcolorcustom': 'title:2'
} %}
{# row 147: all group-related options of the "Questions" category — they are
pulled out of the Questions tab into a dedicated "Groups" tab (aGroupsTab below).
@ -460,7 +474,7 @@
</div></div>
{% endif %}
<div class="row action_hide_on_inherit">
{% set qLastCol = 0 %}
{% set qLastSlot = '' %}
{% set fLastSlot = 0 %}
{% for key in aTabKeys %}
{% set attr = aOptionAttributes.optionAttributes[key] ?? null %}
@ -667,18 +681,31 @@
{% elseif key not in aLogoKeys %}
{% set bQuestionsPane = tab.category == 'Questions' %}
{% if bQuestionsPane %}
{# row 179: qCol 4 = the "Overall question" section (one
col-md-6), leaving it emits a full-width hr; border-start
only between the grid columns 1-3 #}
{% set qCol = key in aQuestionsOverall ? 4 : (key in aQuestionsCol1 ? 1 : (key in aQuestionsCol2 ? 2 : (key in aQuestionsCol3 ? 3 : 0))) %}
{% if qCol != qLastCol %}
{% if qLastCol == 4 %}</div></div><div class="row action_hide_on_inherit"><div class="col-12"><hr class="questions-section-hr"></div></div>
{% elseif qLastCol > 0 %}</div>{% endif %}
{% if qCol == 4 %}<div class="row action_hide_on_inherit questions-section-intro"><div class="col-12"><h3>{{ gT("Overall question") }}</h3></div></div><div class="row action_hide_on_inherit questions-overall-row"><div class="col-md-6 questions-col-overall">
{% elseif qCol > 0 %}
<div class="col-md-4{% if qLastCol in [1, 2, 3] %} border-start{% endif %} questions-col-{{ qCol }}">
{# row 178 plan: slot "section:colIndex" from aQSlots, legacy
columns as "legacy:N", full-width rest as "rest". On a
section change: close the column (+ section row), emit the
full-width hr after the finished section, then the new h3
and section row. border-start only between columns of the
same section/legacy grid #}
{% set qSlot = aQSlots[key] ?? (key in aQuestionsCol1 ? 'legacy:1' : (key in aQuestionsCol2 ? 'legacy:2' : (key in aQuestionsCol3 ? 'legacy:3' : 'rest'))) %}
{% if qSlot != qLastSlot %}
{% set qSec = qSlot|split(':')[0] %}{% set qCi = qSlot|split(':')[1] %}
{% set lSec = qLastSlot|split(':')[0] %}{% set lCi = qLastSlot|split(':')[1] %}
{% if qLastSlot != '' and qLastSlot != 'rest' %}</div>{% endif %}
{% if qSec != lSec %}
{% if lSec != '' and lSec != 'rest' and lSec != 'legacy' %}</div>{% endif %}
{% if lSec != '' and lSec != 'rest' and lSec != 'legacy' %}<div class="row action_hide_on_inherit"><div class="col-12"><hr class="questions-section-hr"></div></div>{% endif %}
{% if qSec != 'rest' and qSec != 'legacy' %}
{% set qSecDef = null %}{% for s in aQSections %}{% if s.id == qSec %}{% set qSecDef = s %}{% endif %}{% endfor %}
<div class="row action_hide_on_inherit questions-section-intro"><div class="col-12"><h3>{{ gT(qSecDef.h3) }}</h3></div></div>
<div class="row action_hide_on_inherit questions-section questions-section-{{ qSec }}">
{% endif %}
{% endif %}
{% set qLastCol = qCol %}
{% if qSec != 'rest' %}
{% if qSec == 'legacy' %}{% set qColClass = 'col-md-4' %}{% else %}{% set qSecDef = null %}{% for s in aQSections %}{% if s.id == qSec %}{% set qSecDef = s %}{% endif %}{% endfor %}{% set qColClass = qSecDef.colClass %}{% endif %}
<div class="{{ qColClass }}{% if qSec == lSec and qCi != '0' %} border-start{% endif %}{% if qSec == 'legacy' and lSec == 'legacy' and lCi != '0' %} border-start{% endif %} questions-col-{{ qSec }}-{{ qCi }}">
{% endif %}
{% set qLastSlot = qSlot %}
{% endif %}
{% endif %}
{# row 163: inside a slot pane (Questions columns, Header, Page
@ -931,7 +958,10 @@
{% elseif fLastSlot == 'bg1' %}</div>
{% endif %}
{% endif %}
{% if tab.category == 'Questions' and qLastCol == 4 %}</div></div>{% elseif tab.category == 'Questions' and qLastCol > 0 %}</div>{% endif %}
{% if tab.category == 'Questions' and qLastSlot != '' and qLastSlot != 'rest' %}
{% set lSecEnd = qLastSlot|split(':')[0] %}
{% if lSecEnd != 'legacy' %}</div></div>{% else %}</div>{% endif %}
{% endif %}
{# row 157: close the open Groups column (each groups slot opens exactly
one div: the col-md-6) #}
{% if tab.id == 'groups' and fLastSlot in ['g1', 'g2'] %}</div>{% endif %}