From 8370a945d5fbca60b7d6095b07c9f6a53f0e6df1 Mon Sep 17 00:00:00 2001 From: Tammo ter Hark Date: Sun, 29 Nov 2026 16:30:39 +0100 Subject: [PATCH] =?UTF-8?q?feat(options):=20row=20197=20=E2=80=94=20help/b?= =?UTF-8?q?order=20font=20color=20choosers,=20box-only=20radii,=20aligned?= =?UTF-8?q?=20chooser=20columns,=20'Font=20color=20for=20...'=20labels?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- config.xml | 60 ++++++++++++------- options/options.js | 15 ++++- options/options.twig | 31 +++++++--- variants/build.php | 5 +- .../example/respondage_respondage/config.xml | 48 ++++++++------- views/subviews/header/custom_header.twig | 18 +++--- 6 files changed, 113 insertions(+), 64 deletions(-) diff --git a/config.xml b/config.xml index 4f5ef48..3715e11 100644 --- a/config.xml +++ b/config.xml @@ -201,7 +201,7 @@ "Default background color", "Color 1", "Color 2", "Color 3", "Other ..." — options.js appends each entry's live hexcode in brackets (for "Other ..." the custom color's hex) and bolds the default. --> - default + default @@ -210,7 +210,7 @@ - #444444 + #444444 @@ -318,7 +318,7 @@ #eeeeee - default + default @@ -327,7 +327,7 @@ - #ffffff + #ffffff base - default + default @@ -385,11 +385,11 @@ - #444444 + #444444 2.0rem bold base - default + default @@ -398,7 +398,7 @@ - #444444 + #444444 1.2rem normal @@ -425,7 +425,7 @@ defaults below are house-style specific (set per variant json; build.php migrates legacy hex/mode values). --> base - other + other @@ -434,10 +434,10 @@ - #ffffff + #ffffff 1.2rem bold - #ffffff + #ffffff color1 @@ -465,7 +465,7 @@ options). answerstextcolor uses the color-chooser scheme like the P2 title colors; default mode stays "default" (Default font color). --> base - default + default @@ -474,7 +474,7 @@ - #444444 + #444444 base - #444444 + default + + + + + + + + + #444444 color3 @@ -519,7 +528,16 @@ lives in options.twig (aShowIfValues) and lands as data-show-if-value="box|top". --> box - #cccccc + default + + + + + + + + + #cccccc solid hover 5px @@ -579,7 +597,7 @@ #ffffff - default + default @@ -588,7 +606,7 @@ - #444444 + #444444 color1 @@ -599,7 +617,7 @@ #ffffff - other + other @@ -608,7 +626,7 @@ - #ffffff + #ffffff color1 @@ -619,7 +637,7 @@ #ffffff - other + other @@ -628,7 +646,7 @@ - #ffffff + #ffffff #5e1c64 diff --git a/options/options.js b/options/options.js index 479858f..6d304f8 100644 --- a/options/options.js +++ b/options/options.js @@ -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). diff --git a/options/options.twig b/options/options.twig index 86eb973..9b18f4a 100644 --- a/options/options.twig +++ b/options/options.twig @@ -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 %} diff --git a/variants/build.php b/variants/build.php index 6218190..77c4d91 100644 --- a/variants/build.php +++ b/variants/build.php @@ -274,14 +274,15 @@ foreach ($logoPositions as $pos) { // groupdescriptiontextcolor; row 180 plan P2 adds questiontitletextcolor, // 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) became mode +// P6 adds the six per-button choosers; row 195 adds checkboxcolor; row 197 adds +// questionhelpfontcolor + questionbordercolor) became mode // dropdowns // (default|defaultbackgroundcolor|color1|color2|color3|other) with a custom // colorpicker child. A legacy HEX value in the json means "custom color": map it // to mode "other" and move the hex into the 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', 'checkboxcolor', 'previousbuttonbackgroundcolor', 'previousbuttontextcolor', 'nextbuttonbackgroundcolor', 'nextbuttontextcolor', 'submitbuttonbackgroundcolor', 'submitbuttontextcolor']; +$colorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor', 'grouptitletextcolor', 'groupdescriptiontextcolor', 'questiontitletextcolor', 'questiontitlebackgroundcolor', 'questionbackgroundcolor', 'answerstextcolor', 'questionhelpbackgroundcolor', 'questionhelpfontcolor', 'questionbordercolor', 'checkboxcolor', 'previousbuttonbackgroundcolor', 'previousbuttontextcolor', 'nextbuttonbackgroundcolor', 'nextbuttontextcolor', 'submitbuttonbackgroundcolor', 'submitbuttontextcolor']; $colorChooserLegacyModes = ['primary' => 'color1', 'secondary' => 'color2']; foreach ($colorChooserKeys as $ck) { if (isset($definition['options'][$ck]) diff --git a/variants/example/respondage_respondage/config.xml b/variants/example/respondage_respondage/config.xml index ada3f0c..98c4839 100644 --- a/variants/example/respondage_respondage/config.xml +++ b/variants/example/respondage_respondage/config.xml @@ -31,7 +31,7 @@ 3.3.0 3 <strong>Example variant of Respondage Vanilla</strong><br>Public example of a build output: only a few house-style option values differ, all views, CSS and JS are inherited from the mother theme via extends. - 2026-11-29 15:12:23 + 2026-11-29 15:22:03 vanilla_respondage @@ -169,9 +169,9 @@ "Default background color", "Color 1", "Color 2", "Color 3", "Other ..." — options.js appends each entry's live hexcode in brackets (for "Other ..." the custom color's hex) and bolds the default. --> - default + default - #444444 + #444444 @@ -257,9 +257,9 @@ defaultbackgroundcolor #eeeeee - default + default - #ffffff + #ffffff base - default + default - #444444 + #444444 2.0rem bold base - default + default - #444444 + #444444 1.2rem normal @@ -333,12 +333,12 @@ defaults below are house-style specific (set per variant json; build.php migrates legacy hex/mode values). --> base - other + other - #ffffff + #ffffff 1.2rem bold - #ffffff + #ffffff color1 #5e1c64 @@ -352,9 +352,9 @@ options). answerstextcolor uses the color-chooser scheme like the P2 title colors; default mode stays "default" (Default font color). --> base - default + default - #444444 + #444444 base - #444444 + default + + #444444 color3 #fff3cd @@ -385,7 +387,9 @@ lives in options.twig (aShowIfValues) and lands as data-show-if-value="box|top". --> box - #cccccc + default + + #cccccc solid hover 5px @@ -438,21 +442,21 @@ other #ffffff - default + default - #444444 + #444444 color1 #ffffff - other + other - #ffffff + #ffffff color1 #ffffff - other + other - #ffffff + #ffffff #5e1c64 lightyellow diff --git a/views/subviews/header/custom_header.twig b/views/subviews/header/custom_header.twig index 8e762b9..84509cf 100644 --- a/views/subviews/header/custom_header.twig +++ b/views/subviews/header/custom_header.twig @@ -135,7 +135,7 @@ .save-form, #surveys-list-container, .privacy { - border: 1px {{ aSurveyInfo.options.questionborderstyle }} {{ aSurveyInfo.options.questionbordercolor }}; + border: 1px {{ aSurveyInfo.options.questionborderstyle }} {{ cmm.cm(aSurveyInfo.options.questionbordercolor|default('default'), aSurveyInfo.options.questionbordercolorcustom|default('#cccccc'), aSurveyInfo.options) }}; } {% endif %} @@ -145,7 +145,7 @@ .save-form, #surveys-list-container, .privacy { - border-top: 1px {{ aSurveyInfo.options.questionborderstyle }} {{ aSurveyInfo.options.questionbordercolor }}; + border-top: 1px {{ aSurveyInfo.options.questionborderstyle }} {{ cmm.cm(aSurveyInfo.options.questionbordercolor|default('default'), aSurveyInfo.options.questionbordercolorcustom|default('#cccccc'), aSurveyInfo.options) }}; } {% endif %} @@ -302,13 +302,15 @@ background: {{ cmm.cm(aSurveyInfo.options.questionbackgroundcolor|default('defaultbackgroundcolor'), aSurveyInfo.options.questionbackgroundcolorcustom|default(''), aSurveyInfo.options) }}; } - {# Row 186 / plan P4: the question help background is a color chooser now - (questionhelpbackgroundcolor, default mode "other" + custom #fff3cd so the - look stays as before; a legacy stored hex passes through cm()). The help - font color stays the plain picker questionhelpfontcolor (row-178 decision 8). #} + {# Row 186 / plan P4, revised row 196/197: the question help background is a + color chooser (questionhelpbackgroundcolor, default mode "color3" since row + 196; a legacy stored hex passes through cm()) AND the help font color is a + chooser too (questionhelpfontcolor, 6-way + questionhelpfontcolorcustom, + default mode "default" = the default font color; legacy hex passes through + cm() as well). #} .question-help-container, .question-valid-container { - background: {{ cmm.cm(aSurveyInfo.options.questionhelpbackgroundcolor|default('other'), aSurveyInfo.options.questionhelpbackgroundcolorcustom|default(''), aSurveyInfo.options) }}; - color: {{ aSurveyInfo.options.questionhelpfontcolor|default('') }}; + background: {{ cmm.cm(aSurveyInfo.options.questionhelpbackgroundcolor|default('color3'), aSurveyInfo.options.questionhelpbackgroundcolorcustom|default('#fff3cd'), aSurveyInfo.options) }}; + color: {{ cmm.cm(aSurveyInfo.options.questionhelpfontcolor|default('default'), aSurveyInfo.options.questionhelpfontcolorcustom|default('#444444'), aSurveyInfo.options) }}; } .slider-handle {