diff --git a/config.xml b/config.xml index 05429fd..aade0f4 100644 --- a/config.xml +++ b/config.xml @@ -410,25 +410,71 @@ Previous/Next/Submit buttons). NOT house-style (structural). --> 30px 30px + + base + other + + + + + + + + + #ffffff + 1.2rem + bold + #ffffff + color1 + + + + + + + + + #5e1c64 + defaultbackgroundcolor + + + + + + + + + #ffffff - #5e1c64 - #ffffff - #ffffff #fff3cd #444444 top @@ -441,7 +487,8 @@ 5px 5px #ff005f - - base - default - - - - - - - #444444 base default @@ -480,8 +518,6 @@ #444444 - 1.2rem - 700 #5e1c64 diff --git a/options/options.js b/options/options.js index 6876cc4..a3d17f6 100644 --- a/options/options.js +++ b/options/options.js @@ -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 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". diff --git a/options/options.twig b/options/options.twig index e906c2d..5655ca5 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 = '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 @@ {% endif %}
- {% 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 %}

- {% elseif qLastCol > 0 %}{% endif %} - {% if qCol == 4 %}

{{ gT("Overall question") }}

- {% elseif qCol > 0 %} -
+ {# 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' %}
{% endif %} + {% if qSec != lSec %} + {% if lSec != '' and lSec != 'rest' and lSec != 'legacy' %}
{% endif %} + {% if lSec != '' and lSec != 'rest' and lSec != 'legacy' %}

{% endif %} + {% if qSec != 'rest' and qSec != 'legacy' %} + {% set qSecDef = null %}{% for s in aQSections %}{% if s.id == qSec %}{% set qSecDef = s %}{% endif %}{% endfor %} +

{{ gT(qSecDef.h3) }}

+
+ {% 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 %} +
+ {% endif %} + {% set qLastSlot = qSlot %} {% endif %} {% endif %} {# row 163: inside a slot pane (Questions columns, Header, Page @@ -931,7 +958,10 @@ {% elseif fLastSlot == 'bg1' %}
{% endif %} {% endif %} - {% if tab.category == 'Questions' and qLastCol == 4 %}
{% elseif tab.category == 'Questions' and qLastCol > 0 %}{% endif %} + {% if tab.category == 'Questions' and qLastSlot != '' and qLastSlot != 'rest' %} + {% set lSecEnd = qLastSlot|split(':')[0] %} + {% if lSecEnd != 'legacy' %}{% else %}{% 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'] %}{% endif %} diff --git a/variants/build.php b/variants/build.php index 831c40e..5e01b7d 100644 --- a/variants/build.php +++ b/variants/build.php @@ -271,13 +271,14 @@ foreach ($logoPositions as $pos) { // --- Row 115/135/149/157 migration: the color-chooser options (navbarfontcolor, // headerbackgroundcolor, progressbarcolor, progressbarbackgroundcolor, // progressbarfontcolor, bodybackgroundcolor, grouptitletextcolor, -// groupdescriptiontextcolor) 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 group textcolor dropdown) maps to -// "color1"/"color2". -$colorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor', 'grouptitletextcolor', 'groupdescriptiontextcolor']; +// groupdescriptiontextcolor; row 180 plan P2 adds questiontitletextcolor, +// questiontitlebackgroundcolor, questionbackgroundcolor) 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']; $colorChooserLegacyModes = ['primary' => 'color1', 'secondary' => 'color2']; foreach ($colorChooserKeys as $ck) { if (isset($definition['options'][$ck]) @@ -295,8 +296,10 @@ foreach ($colorChooserKeys as $ck) { // --- Row 157 migration: the old fontweight json keys (400|700) became // fontoptions (normal|bold|italic|bolditalic); map the old values and remove // the old keys so the unknown-key check below does not fail on them. +// Row 180 plan P2: questiontitle joined (questiontitlefontweight -> +// questiontitlefontoptions). $fontWeightToOptions = ['400' => 'normal', '700' => 'bold']; -foreach (['grouptitle', 'groupdescription'] as $el) { +foreach (['grouptitle', 'groupdescription', 'questiontitle'] as $el) { $oldKey = $el . 'fontweight'; if (isset($definition['options'][$oldKey])) { $w = (string) $definition['options'][$oldKey]; diff --git a/variants/example/respondage_respondage/config.xml b/variants/example/respondage_respondage/config.xml index 19f7090..a1fad72 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 13:20:28 + 2026-11-29 13:44:56 vanilla_respondage @@ -167,7 +167,8 @@ "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. --> - other + default + #444444 - other - #eeeeee + defaultbackgroundcolor + + #ffffff - ./files/logo.png - 15 + ./files/logo-left.png + 30 on on off - off - 15 + ./files/logo.png + 30 on on off - off - 15 + ./files/logo-right.png + 30 on on off @@ -247,11 +249,14 @@ background = COLUMN 2, progress font color = COLUMN 3 (with an extra tip underneath). Defaults: progress bar color = Color 1, progress background = Default background color, progress font color = Default font color. --> - other + color1 + #5e1c64 - other + defaultbackgroundcolor + #eeeeee - other + default + #ffffff - other - #dddddd + defaultbackgroundcolor + + #ffffff 30px 30px + + base + other + + #ffffff + 1.2rem + bold + #ffffff + color1 + + #5e1c64 + defaultbackgroundcolor + + #ffffff - #5e1c64 - #ffffff - #ffffff #fff3cd #444444 top @@ -343,7 +374,8 @@ 5px 5px #ff005f - - base - default - - #444444 base default @@ -367,8 +395,6 @@ default #444444 - 1.2rem - 700 #5e1c64 lightyellow diff --git a/views/subviews/header/custom_header.twig b/views/subviews/header/custom_header.twig index 31419b8..c6ccc9c 100644 --- a/views/subviews/header/custom_header.twig +++ b/views/subviews/header/custom_header.twig @@ -21,10 +21,11 @@ headerbackgroundcolor, the progress bar colors and bodybackgroundcolor below (navbarfontcolor keeps its own inline expression further down). Modes: default|defaultbackgroundcolor| color1|color2|color3|other, or a raw hex (legacy stored value) which passes - through directly. #} + through directly. Row 180 / plan P2: legacy modes "primary"/"secondary" of the + old 4-way textcolor dropdowns map to color1/color2 as well. #} {% macro cm(mode, custom, opts) -%} {%- set m = mode|default('') -%} - {{- m matches '/^#[0-9a-fA-F]{3,8}$/' ? m : (m == 'color1' ? opts.primarycolor|default('') : (m == 'color2' ? opts.secondarycolor|default('') : (m == 'color3' ? opts.tertiarycolor|default('') : (m == 'defaultbackgroundcolor' ? opts.defaultbackgroundcolor|default('') : (m == 'other' ? custom|default('') : opts.fontcolor|default('')))))) -}} + {{- m matches '/^#[0-9a-fA-F]{3,8}$/' ? m : (m == 'color1' or m == 'primary' ? opts.primarycolor|default('') : (m == 'color2' or m == 'secondary' ? opts.secondarycolor|default('') : (m == 'color3' ? opts.tertiarycolor|default('') : (m == 'defaultbackgroundcolor' ? opts.defaultbackgroundcolor|default('') : (m == 'other' ? custom|default('') : opts.fontcolor|default('')))))) -}} {%- endmacro %} {% import _self as cmm %} @@ -56,11 +57,25 @@ color: {{ aSurveyInfo.options.fontcolor }}; } + {# Row 180 / plan P2: the question title now uses the color-chooser scheme — + questiontitletextcolor + questiontitletextcolorcustom (text) and + questiontitlebackgroundcolor + questiontitlebackgroundcolorcustom + (background), resolved via cm() (default modes: text "other" per row 178, + background "color1"; legacy stored hex passes through). The CHOOSER wins + when the mode key exists in the stored options; a row from before P2 (no + questiontitletextcolor key) falls back to the legacy plain picker + questiontitlefontcolor. questiontitlefontoptions (normal|bold|italic| + bolditalic) replaces questiontitlefontweight (400|700) — a legacy stored + weight is mapped like the group title/description (row 157). #} + {% set sQTitleFontOptions = aSurveyInfo.options.questiontitlefontoptions|default(aSurveyInfo.options.questiontitlefontweight|default('700') == '700' ? 'bold' : 'normal') %} + {% set sQTitleBackgroundColor = cmm.cm(aSurveyInfo.options.questiontitlebackgroundcolor|default('color1'), aSurveyInfo.options.questiontitlebackgroundcolorcustom|default(''), aSurveyInfo.options) %} + {% set sQTitleTextColor = aSurveyInfo.options.questiontitletextcolor is defined ? cmm.cm(aSurveyInfo.options.questiontitletextcolor, aSurveyInfo.options.questiontitletextcolorcustom|default(''), aSurveyInfo.options) : aSurveyInfo.options.questiontitlefontcolor|default('') %} .question-title-container { font-size: {{ aSurveyInfo.options.questiontitlefontsize }}; - font-weight: {{ aSurveyInfo.options.questiontitlefontweight }}; - background: {{ aSurveyInfo.options.questiontitlebackgroundcolor }}; - color: {{ aSurveyInfo.options.questiontitlefontcolor }}; + font-weight: {{ sQTitleFontOptions == 'bold' or sQTitleFontOptions == 'bolditalic' ? '700' : '400' }}; + font-style: {{ sQTitleFontOptions == 'italic' or sQTitleFontOptions == 'bolditalic' ? 'italic' : 'normal' }}; + background: {{ sQTitleBackgroundColor }}; + color: {{ sQTitleTextColor }}; } {# Row 157: group title/description font OPTIONS (config.xml fontoptions: @@ -271,8 +286,12 @@ color: {{ sProgressBarFontColor }}; } + {# Row 180 / plan P2: the question body background is a color chooser now + (questionbackgroundcolor, default mode "defaultbackgroundcolor", + + questionbackgroundcolorcustom for "other"); a legacy stored hex passes + through cm() directly. #} .question-container, #welcome-container { - background: {{ aSurveyInfo.options.questionbackgroundcolor }}; + background: {{ cmm.cm(aSurveyInfo.options.questionbackgroundcolor|default('defaultbackgroundcolor'), aSurveyInfo.options.questionbackgroundcolorcustom|default(''), aSurveyInfo.options) }}; } .question-help-container, .question-valid-container { @@ -289,8 +308,8 @@ } .bg-primary{ - background-color: {{ aSurveyInfo.options.questiontitlebackgroundcolor }}; - color: {{ aSurveyInfo.options.questiontitlefontcolor }}; + background-color: {{ sQTitleBackgroundColor }}; + color: {{ sQTitleTextColor }}; } .btn-primary:hover, .btn-primary:focus { diff --git a/views/subviews/survey/question_subviews/question_text_container.twig b/views/subviews/survey/question_subviews/question_text_container.twig index c413df2..a61accd 100644 --- a/views/subviews/survey/question_subviews/question_text_container.twig +++ b/views/subviews/survey/question_subviews/question_text_container.twig @@ -23,11 +23,16 @@ "questiontitlefont", type fontselect). "base" = same as the base font: no extra class, the element inherits the body font. #} {% set sQuestionTitleFont = aSurveyInfo.options.questiontitlefont|default('base') %} -{# Prompt U: per-element text color — mode default -> fontcolor, primary -> - primarycolor, secondary -> secondarycolor, other -> questiontitletextcolorcustom. - Emitted as an inline style on the element below. #} -{% set sQuestionTitleTextColorMode = aSurveyInfo.options.questiontitletextcolor|default('default') %} -{% set sQuestionTitleTextColor = sQuestionTitleTextColorMode == 'primary' ? aSurveyInfo.options.primarycolor|default('') : (sQuestionTitleTextColorMode == 'secondary' ? aSurveyInfo.options.secondarycolor|default('') : (sQuestionTitleTextColorMode == 'other' ? aSurveyInfo.options.questiontitletextcolorcustom|default('') : aSurveyInfo.options.fontcolor|default(''))) %} +{# Prompt U / row 180 plan P2: per-element text color — now the 6-way color-chooser + scheme (default|defaultbackgroundcolor|color1|color2|color3|other) with + questiontitletextcolorcustom for "other". Legacy modes of the old 4-way dropdown + (primary|secondary) map to color1/color2, a raw hex passes through. When the + mode key is absent entirely (row from before Prompt U) no inline style is + emitted here — custom_header.twig then falls back to the legacy plain picker + questiontitlefontcolor. Emitted as an inline style on the element below. #} +{% set sQuestionTitleTextColorMode = aSurveyInfo.options.questiontitletextcolor is defined ? aSurveyInfo.options.questiontitletextcolor : '' %} +{% set oQ = aSurveyInfo.options %} +{% set sQuestionTitleTextColor = sQuestionTitleTextColorMode == '' ? '' : (sQuestionTitleTextColorMode matches '/^#[0-9a-fA-F]{3,8}$/' ? sQuestionTitleTextColorMode : (sQuestionTitleTextColorMode == 'color1' or sQuestionTitleTextColorMode == 'primary' ? oQ.primarycolor|default('') : (sQuestionTitleTextColorMode == 'color2' or sQuestionTitleTextColorMode == 'secondary' ? oQ.secondarycolor|default('') : (sQuestionTitleTextColorMode == 'color3' ? oQ.tertiarycolor|default('') : (sQuestionTitleTextColorMode == 'defaultbackgroundcolor' ? oQ.defaultbackgroundcolor|default('') : (sQuestionTitleTextColorMode == 'other' ? oQ.questiontitletextcolorcustom|default('') : oQ.fontcolor|default(''))))))) %}