feat(options): row 197 — help/border font color choosers, box-only radii, aligned chooser columns, 'Font color for ...' labels

- questionhelpfontcolor + questionbordercolor are now 6-way color choosers
  (+custom children), both default mode 'default' (Default font color);
  resolved via cmm.cm() in custom_header.twig (legacy hex passthrough)
- border radii show only for questionborder=box (per-key show-values in
  options.twig aShowIfValuesByKey); options.js cascades hiding to nested
  conditional wrappers (questionbordercolorcustom); radii stay two
  subcolumns (border-start on TR/BR)
- chooser columns aligned with the font color: title section = one column
  (title-0: font, font color, size/options, legacy picker, title bg, body
  bg), answers-0 += checkbox chooser, help-0 = font + font color + bg
  chooser, help-1 = text position
- all font-color labels follow 'Font color for ...' / 'Custom font color
  for ...' (21 labels renamed, incl. 'Font color for question titles' and
  'Font color for answers and subquestions')
- chooser key lists synced in options.twig/options.js/build.php (+2)

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-29 16:30:39 +01:00
commit 8370a945d5
2 changed files with 113 additions and 64 deletions

View file

@ -37,9 +37,9 @@ var ThemeOptions = function () {
// row 184 / plan P3: answerstextcolor as well; row 186 / plan P4:
// questionhelpbackgroundcolor as well; row 191 / plan P6: the six per-button
// choosers (previous/next/submit button background + text color); row 195:
// checkboxcolor as well.
// checkboxcolor as well; row 197: questionhelpfontcolor + questionbordercolor.
// Must stay in sync with aColorChooserKeys in options/options.twig.
var aColorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor', 'grouptitletextcolor', 'groupdescriptiontextcolor', 'questiontitletextcolor', 'questiontitlebackgroundcolor', 'questionbackgroundcolor', 'answerstextcolor', 'questionhelpbackgroundcolor', 'checkboxcolor', 'previousbuttonbackgroundcolor', 'previousbuttontextcolor', 'nextbuttonbackgroundcolor', 'nextbuttontextcolor', 'submitbuttonbackgroundcolor', 'submitbuttontextcolor'];
var aColorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor', 'grouptitletextcolor', 'groupdescriptiontextcolor', 'questiontitletextcolor', 'questiontitlebackgroundcolor', 'questionbackgroundcolor', 'answerstextcolor', 'questionhelpbackgroundcolor', 'questionhelpfontcolor', 'questionbordercolor', 'checkboxcolor', 'previousbuttonbackgroundcolor', 'previousbuttontextcolor', 'nextbuttonbackgroundcolor', 'nextbuttontextcolor', 'submitbuttonbackgroundcolor', 'submitbuttontextcolor'];
// 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".
@ -417,6 +417,17 @@ var ThemeOptions = function () {
const updateVisibilityByParent = function() {
$('.option-visibility[data-show-if-parent]').each(function (i, wrapperEl) {
const parentName = $(wrapperEl).data('show-if-parent');
// row 197: cascade — when the parent field itself sits inside a hidden
// .option-visibility wrapper (nested conditional, e.g. questionbordercolorcustom
// whose parent questionbordercolor is a child of questionborder=none), this
// wrapper must hide as well, regardless of its own show-if-mode
const anyParent0 = $('input[name="' + parentName + '"]');
const anyParent1 = $('select[name="' + parentName + '"]');
const anyParent = anyParent0.length ? anyParent0 : anyParent1;
if (anyParent.length) {
const pw = anyParent.first().closest('.option-visibility');
if (pw.length && pw.hasClass('d-none')) { $(wrapperEl).addClass('d-none'); return; }
}
// THEME ADDITION (row 115, navbarfontcolor working example): parents with
// data-show-if-mode="disable" never hide their children — the wrapper stays
// visible and only the child control is disabled (updateChild/updateAllChildren).

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 = '20261129.4' %}
{% set OPTIONS_JS_TOKEN = '20261129.5' %}
{{ unregisterScriptFile(optionsPath ~ '/options.js') }}
{{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }}
@ -293,9 +293,14 @@
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', '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', '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
"box" (Box around), while the other border children (color/style/shadow) keep
the parent's "box|top". Looked up by the option's own key, so it wins over the
parent's entry above and lands as data-show-if-value on the wrapper. #}
{% set aShowIfValuesByKey = { 'questionborderradiusTL': 'box', 'questionborderradiusTR': 'box', 'questionborderradiusBL': 'box', 'questionborderradiusBR': 'box' } %}
{% for el in aFontElements %}{% set aShowIfValues = aShowIfValues|merge({ (el ~ 'textcolor'): 'other' }) %}{% endfor %}
{% for ck in aColorChooserKeys %}{% set aShowIfValues = aShowIfValues|merge({ (ck): 'other' }) %}{% endfor %}
@ -339,19 +344,25 @@
{ 'id': 'help', 'h3': 'Question help', 'colClass': 'col-md-4' },
{ 'id': 'border', 'h3': 'Question border', 'colClass': 'col-md-4' }
] %}
{# row 197: title-section keys (font, font color, size, options, legacy picker,
title bg chooser, body bg chooser) all stack in ONE column (title:0) so the
background choosers align with the font color; the checkbox chooser aligns
with the answers font color (answers:0); the help background chooser aligns
with the help font color (help:0), only the text position gets help:1.
NOTE: no {# #} comments inside the array literal (twig SyntaxError). #}
{% 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',
'questiontitlebackgroundcolor': 'title:0', 'questiontitlebackgroundcolorcustom': 'title:0',
'questionbackgroundcolor': 'title:0', 'questionbackgroundcolorcustom': 'title:0',
'answersfont': 'answers:0', 'answerstextcolor': 'answers:0', 'answerstextcolorcustom': 'answers:0',
'checkboxcolor': 'answers:1', 'checkboxcolorcustom': 'answers:1',
'questionhelpfont': 'help:0', 'questionhelpfontcolor': 'help:0',
'questionhelpbackgroundcolor': 'help:1', 'questionhelpbackgroundcolorcustom': 'help:1',
'questionhelptextposition': 'help:2',
'checkboxcolor': 'answers:0', 'checkboxcolorcustom': 'answers:0',
'questionhelpfont': 'help:0', 'questionhelpfontcolor': 'help:0', 'questionhelpfontcolorcustom': 'help:0',
'questionhelpbackgroundcolor': 'help:0', 'questionhelpbackgroundcolorcustom': 'help:0',
'questionhelptextposition': 'help:1',
'questionborder': 'border:0',
'questionbordercolor': 'border:1', 'questionborderstyle': 'border:1', 'questiondropdown': 'border:1',
'questionbordercolor': 'border:1', 'questionbordercolorcustom': 'border:1', 'questionborderstyle': 'border:1', 'questiondropdown': 'border:1',
'questionborderradiusTL': 'border:2', 'questionborderradiusTR': 'border:2',
'questionborderradiusBL': 'border:2', 'questionborderradiusBR': 'border:2'
} %}
@ -818,6 +829,8 @@
{% if attr.parent != '' and attr.parent != key %}
{% set parentAttr = aOptionAttributes.optionAttributes[attr.parent] ?? null %}
{% set showIfValues = aShowIfValues[attr.parent] ?? 'on' %}
{# row 197: per-key override wins (border radii = "box" only) #}
{% if aShowIfValuesByKey[key] is defined %}{% set showIfValues = aShowIfValuesByKey[key] %}{% endif %}
{% if parentAttr is not null and (parentAttr.type == 'buttons' or parentAttr.type == 'dropdown') %}
{% set parentValue = bGeneralInherit ? 'inherit' : (aCurrentOptions[attr.parent] is defined ? aCurrentOptions[attr.parent] : (oParentOptions[attr.parent] is defined ? oParentOptions[attr.parent] : '')) %}
{% if parentValue not in showIfValues|split('|') %}{% set bParentHidden = true %}{% endif %}