From ff998489b935ff680ad78adbc7e60b1afbb402de Mon Sep 17 00:00:00 2001 From: Tammo ter Hark Date: Sun, 29 Nov 2026 15:17:56 +0100 Subject: [PATCH] feat(options): Questions tab 'Question help' section; help background becomes a 6-way color chooser (row 178 plan P4) New section (h3 + first col-md-4 of a 3-column grid, only it used): questionhelpbackgroundcolor as 6-way chooser (default 'other' + custom #fff3cd, look unchanged) + questionhelpbackgroundcolorcustom, the plain help font color picker (stays plain per row-178 decision 8) and the help text position; keys moved between the answers block and the border options, legacy col 1 is empty now. questionhelpbackgroundcolor joined aColorChooserKeys (twig + js, OPTIONS_JS_TOKEN 20261129.3) and the build.php chooser migration; custom_header.twig resolves it via cm() (legacy hex passes through). Variants rebuilt, example config synced. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe --- config.xml | 27 +++++++++++++++---- options/options.js | 5 ++-- options/options.twig | 18 ++++++++----- variants/build.php | 5 ++-- .../example/respondage_respondage/config.xml | 22 ++++++++++----- views/subviews/header/custom_header.twig | 6 ++++- 6 files changed, 61 insertions(+), 22 deletions(-) diff --git a/config.xml b/config.xml index a35e1e1..a5cdcbd 100644 --- a/config.xml +++ b/config.xml @@ -473,6 +473,23 @@ #444444 + + other + + + + + + + + + #fff3cd + #444444 + top - #fff3cd - #444444 - top box #cccccc solid diff --git a/options/options.js b/options/options.js index 544c7bd..a84a4ea 100644 --- a/options/options.js +++ b/options/options.js @@ -34,9 +34,10 @@ var ThemeOptions = function () { // 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); - // row 184 / plan P3: answerstextcolor as well. + // row 184 / plan P3: answerstextcolor as well; row 186 / plan P4: + // questionhelpbackgroundcolor as well. // Must stay in sync with aColorChooserKeys in options/options.twig. - var aColorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor', 'grouptitletextcolor', 'groupdescriptiontextcolor', 'questiontitletextcolor', 'questiontitlebackgroundcolor', 'questionbackgroundcolor', 'answerstextcolor']; + var aColorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor', 'grouptitletextcolor', 'groupdescriptiontextcolor', 'questiontitletextcolor', 'questiontitlebackgroundcolor', 'questionbackgroundcolor', 'answerstextcolor', 'questionhelpbackgroundcolor']; // 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". diff --git a/options/options.twig b/options/options.twig index 2f97b2a..a018b5a 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.2' %} +{% set OPTIONS_JS_TOKEN = '20261129.3' %} {{ unregisterScriptFile(optionsPath ~ '/options.js') }} {{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }} @@ -290,9 +290,10 @@ {# row 180 / plan P2: the Questions "title" section keys joined the chooser scheme (questiontitletextcolor, questiontitlebackgroundcolor, questionbackgroundcolor); - row 184 / plan P3: answerstextcolor as well. Must stay in sync with + 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'] %} +{% set aColorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor', 'grouptitletextcolor', 'groupdescriptiontextcolor', 'questiontitletextcolor', 'questiontitlebackgroundcolor', 'questionbackgroundcolor', 'answerstextcolor', 'questionhelpbackgroundcolor'] %} {% set aShowIfValues = { 'questionborder': 'box|top', 'navbarfontcolor': 'other' } %} {% for el in aFontElements %}{% set aShowIfValues = aShowIfValues|merge({ (el ~ 'textcolor'): 'other' }) %}{% endfor %} @@ -313,7 +314,9 @@ {% set aFontsCol2 = ['defaultbackgroundcolor'] %} {% set aFontsCol3 = ['primarycolor', 'secondarycolor', 'tertiarycolor'] %} -{% set aQuestionsCol1 = ['questionhelpbackgroundcolor', 'questionhelpfontcolor', 'questionhelptextposition'] %} +{# row 186 / plan P4: the help keys moved into their own "Question help" section + (aQSlots above) — legacy column 1 is empty now #} +{% set aQuestionsCol1 = [] %} {% set aQuestionsCol2 = ['questionborder', 'questionbordercolor', 'questionborderstyle', 'questiondropdown', 'questionborderradiusTL', 'questionborderradiusTR', 'questionborderradiusBL', 'questionborderradiusBR'] %} {% set aQuestionsCol3 = ['checkboxcolor'] %} {# row 178/179 plan: the Questions pane is built from SECTIONS — each section is an @@ -328,7 +331,8 @@ {% set aQSections = [ { 'id': 'overall', 'h3': 'Overall question', 'colClass': 'col-md-4' }, { 'id': 'title', 'h3': 'Question title and body', 'colClass': 'col-md-4' }, - { 'id': 'answers', 'h3': 'Answer options and subquestions', 'colClass': 'col-md-4' } + { 'id': 'answers', 'h3': 'Answer options and subquestions', 'colClass': 'col-md-4' }, + { 'id': 'help', 'h3': 'Question help', 'colClass': 'col-md-4' } ] %} {% set aQSlots = { 'questiondistance': 'overall:0', 'questiondistancebottom': 'overall:0', @@ -336,7 +340,9 @@ 'questiontitlefontsize': 'title:0', 'questiontitlefontoptions': 'title:0', 'questiontitlefontcolor': 'title:0', 'questiontitlebackgroundcolor': 'title:1', 'questiontitlebackgroundcolorcustom': 'title:1', 'questionbackgroundcolor': 'title:2', 'questionbackgroundcolorcustom': 'title:2', - 'answersfont': 'answers:0', 'answerstextcolor': 'answers:0', 'answerstextcolorcustom': 'answers:0' + 'answersfont': 'answers:0', 'answerstextcolor': 'answers:0', 'answerstextcolorcustom': 'answers:0', + 'questionhelpbackgroundcolor': 'help:0', 'questionhelpbackgroundcolorcustom': 'help:0', + 'questionhelpfontcolor': 'help:0', 'questionhelptextposition': 'help:0' } %} {# row 147: all group-related options of the "Questions" category — they are diff --git a/variants/build.php b/variants/build.php index 085dd77..aa0cdb0 100644 --- a/variants/build.php +++ b/variants/build.php @@ -273,13 +273,14 @@ foreach ($logoPositions as $pos) { // progressbarfontcolor, bodybackgroundcolor, grouptitletextcolor, // groupdescriptiontextcolor; row 180 plan P2 adds questiontitletextcolor, // questiontitlebackgroundcolor, questionbackgroundcolor; row 184 plan P3 adds -// answerstextcolor) became mode dropdowns +// answerstextcolor; row 186 plan P4 adds questionhelpbackgroundcolor) 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']; +$colorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor', 'grouptitletextcolor', 'groupdescriptiontextcolor', 'questiontitletextcolor', 'questiontitlebackgroundcolor', 'questionbackgroundcolor', 'answerstextcolor', 'questionhelpbackgroundcolor']; $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 9acee01..49039ef 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 14:06:42 + 2026-11-29 14:13:44 vanilla_respondage @@ -353,6 +353,16 @@ default #444444 + + other + + #fff3cd + #444444 + top - #fff3cd - #444444 - top box #cccccc solid diff --git a/views/subviews/header/custom_header.twig b/views/subviews/header/custom_header.twig index c6ccc9c..6b6f96c 100644 --- a/views/subviews/header/custom_header.twig +++ b/views/subviews/header/custom_header.twig @@ -294,8 +294,12 @@ 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). #} .question-help-container, .question-valid-container { - background: {{ aSurveyInfo.options.questionhelpbackgroundcolor }}; + background: {{ cmm.cm(aSurveyInfo.options.questionhelpbackgroundcolor|default('other'), aSurveyInfo.options.questionhelpbackgroundcolorcustom|default(''), aSurveyInfo.options) }}; color: {{ aSurveyInfo.options.questionhelpfontcolor|default('') }}; }