diff --git a/config.xml b/config.xml index cd8eac0..3d3d658 100644 --- a/config.xml +++ b/config.xml @@ -536,29 +536,81 @@ in custom_header.twig on .question-help-container. --> #ff005f - - base - default + + base + other + + + + + + + + + #ffffff + default - - - - - #444444 + + + + + + + #444444 + color1 + + + + + + + + + #ffffff + other + + + + + + + + + #ffffff + color1 + + + + + + + + + #ffffff + other + + + + + + + + + #ffffff #5e1c64 diff --git a/options/options.js b/options/options.js index a84a4ea..f5bc452 100644 --- a/options/options.js +++ b/options/options.js @@ -35,9 +35,10 @@ var ThemeOptions = function () { // row 180 / plan P2: the Questions "title" section keys as well // (questiontitletextcolor, questiontitlebackgroundcolor, questionbackgroundcolor); // row 184 / plan P3: answerstextcolor as well; row 186 / plan P4: - // questionhelpbackgroundcolor as well. + // questionhelpbackgroundcolor as well; row 191 / plan P6: the six per-button + // choosers (previous/next/submit button background + text color). // 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']; + var aColorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor', 'grouptitletextcolor', 'groupdescriptiontextcolor', 'questiontitletextcolor', 'questiontitlebackgroundcolor', 'questionbackgroundcolor', 'answerstextcolor', 'questionhelpbackgroundcolor', '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". diff --git a/options/options.twig b/options/options.twig index 1866401..966990f 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.3' %} +{% set OPTIONS_JS_TOKEN = '20261129.4' %} {{ unregisterScriptFile(optionsPath ~ '/options.js') }} {{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }} @@ -293,7 +293,7 @@ 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'] %} +{% set aColorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor', 'grouptitletextcolor', 'groupdescriptiontextcolor', 'questiontitletextcolor', 'questiontitlebackgroundcolor', 'questionbackgroundcolor', 'answerstextcolor', 'questionhelpbackgroundcolor', 'previousbuttonbackgroundcolor', 'previousbuttontextcolor', 'nextbuttonbackgroundcolor', 'nextbuttontextcolor', 'submitbuttonbackgroundcolor', 'submitbuttontextcolor'] %} {% set aShowIfValues = { 'questionborder': 'box|top', 'navbarfontcolor': 'other' } %} {% for el in aFontElements %}{% set aShowIfValues = aShowIfValues|merge({ (el ~ 'textcolor'): 'other' }) %}{% endfor %} @@ -364,6 +364,14 @@ {% set aGroupCol1 = ['grouptitlefont', 'grouptitletextcolor', 'grouptitletextcolorcustom', 'grouptitlefontsize', 'grouptitlefontoptions'] %} {% set aGroupCol2 = ['groupdescriptionfont', 'groupdescriptiontextcolor', 'groupdescriptiontextcolorcustom', 'groupdescriptionfontsize', 'groupdescriptionfontoptions'] %} +{# row 191 / row 178 plan P6: the Buttons pane — a full-width font row at the top + (buttonsfont), then ONE row with three col-md-4 columns: col 1 = Previous, + col 2 = Next, col 3 = Submit (row-178 decision 1); each column holds that + button's background color chooser (+custom) and text color chooser (+custom). #} +{% set aButtonsCol1 = ['previousbuttonbackgroundcolor', 'previousbuttonbackgroundcolorcustom', 'previousbuttontextcolor', 'previousbuttontextcolorcustom'] %} +{% set aButtonsCol2 = ['nextbuttonbackgroundcolor', 'nextbuttonbackgroundcolorcustom', 'nextbuttontextcolor', 'nextbuttontextcolorcustom'] %} +{% set aButtonsCol3 = ['submitbuttonbackgroundcolor', 'submitbuttonbackgroundcolorcustom', 'submitbuttontextcolor', 'submitbuttontextcolorcustom'] %} + {# Tab list: FIRST the "Default font and colors" tab (where the default/base font and the default colors are chosen), then the "Header" tab tab (keys = aTopOfPageKeys), then row 147: the "Page background" tab (the @@ -514,6 +522,13 @@

{{ gT("Questions are the core of a survey. Here you create your own design of how questions are displayed to your respondent.") }}

{% endif %} + {% if tab.category == 'Buttons' %} + {# row 191 / plan P6: h2 + intro of the Buttons tab #} +
+

{{ gT("Buttons") }}

+

{{ gT("The buttons at the bottom of each page of the survey: Previous, Next and Submit. Here you choose the font and the colors of each of them.") }}

+
+ {% endif %}
{% set qLastSlot = '' %} {% set fLastSlot = 0 %} @@ -529,6 +544,7 @@ {% set bTopPane = tab.id == 'top-of-page' %} {% set bImagesPane = tab.category == 'Page background' %} {% set bGroupsPane = tab.id == 'groups' %} + {% set bButtonsPane = tab.category == 'Buttons' %} {% set fSlot = 'rest' %} {% if bFontsPane %} {# row 174: one row, three col-md-4 columns — col 1 (fc1) = @@ -578,8 +594,16 @@ {% if key in aGroupCol1 %}{% set fSlot = 'g1' %} {% elseif key in aGroupCol2 %}{% set fSlot = 'g2' %} {% endif %} + {% elseif bButtonsPane %} + {# row 191 / plan P6: Buttons pane — bfont = the full-width font + row (buttonsfont), b1/b2/b3 = the Previous/Next/Submit columns #} + {% if key == 'buttonsfont' %}{% set fSlot = 'bfont' %} + {% elseif key in aButtonsCol1 %}{% set fSlot = 'b1' %} + {% elseif key in aButtonsCol2 %}{% set fSlot = 'b2' %} + {% elseif key in aButtonsCol3 %}{% set fSlot = 'b3' %} + {% endif %} {% endif %} - {% if fSlot != fLastSlot and (bFontsPane or bTopPane or bImagesPane or bGroupsPane) %} + {% if fSlot != fLastSlot and (bFontsPane or bTopPane or bImagesPane or bGroupsPane or bButtonsPane) %} {% if bFontsPane %} {# row 174: column change inside the single fonts row — close the previous col-md-4, open the next one #} @@ -615,6 +639,16 @@ col 2 (border-start); the first g1 key opens col 1 #} {% if fLastSlot == 'g1' %}
{% endif %} {% if fSlot == 'g1' %}
{% endif %} + {% elseif bButtonsPane %} + {# row 191 / plan P6: Buttons transitions — bfont -> b1 closes the + font row (row+col) and opens the buttons row + col 1 (Previous); + b1 -> b2 -> b3 move to the next col-md-4 with a border-start + divider (row-178 decision 4 style, like the Groups columns) #} + {% if fLastSlot == 'bfont' %}
{% endif %} + {% if fLastSlot == 'b1' %}
{% endif %} + {% if fLastSlot == 'b2' %}
{% endif %} + {% if fSlot == 'bfont' %}
{% endif %} + {% if fSlot == 'b1' %}
{% endif %} {% endif %} {% set fLastSlot = fSlot %} {% endif %} @@ -755,7 +789,7 @@ plain grid panes. Without bImagesPane here the wrappers rendered col-12 col-md- INSIDE the col-md-6 slot column, i.e. only the left part of each column was used. #} - {% if bQuestionsPane or bTopPane or bGroupsPane or bImagesPane or (bFontsPane and fSlot != 'rest') %}{% set wrapClass = 'col-12' %}{% else %}{% set wrapClass = 'col-12 col-md-' ~ attr.width|default(2) %}{% endif %} + {% if bQuestionsPane or bTopPane or bGroupsPane or bImagesPane or bButtonsPane or (bFontsPane and fSlot != 'rest') %}{% set wrapClass = 'col-12' %}{% else %}{% set wrapClass = 'col-12 col-md-' ~ attr.width|default(2) %}{% endif %} {# row 188 / plan P5: inside the "Question border" section's radius subcolumn the four radius options form two rows of two — their wrappers are half the column (col-md-6) instead of col-12 #} @@ -1014,6 +1048,9 @@ {# 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 %} + {# row 191 / plan P6: close the open Buttons slot (bfont opened row+col-12, + b1/b2/b3 opened one col inside the buttons row — both close two divs) #} + {% if tab.category == 'Buttons' and fLastSlot in ['bfont', 'b1', 'b2', 'b3'] %}
{% endif %} {# close an open slot container at the end of a Fonts/Top-of-page pane (every non-logo, non-rest slot has exactly two open divs: row + col) #} {% if (tab.category == 'Default font and colors' or tab.id == 'top-of-page') and fLastSlot != 0 and fLastSlot != 'rest' and fLastSlot != 'logo' %}
{% endif %} diff --git a/variants/build.php b/variants/build.php index aa0cdb0..dbfda22 100644 --- a/variants/build.php +++ b/variants/build.php @@ -273,14 +273,15 @@ foreach ($logoPositions as $pos) { // progressbarfontcolor, bodybackgroundcolor, grouptitletextcolor, // groupdescriptiontextcolor; row 180 plan P2 adds questiontitletextcolor, // questiontitlebackgroundcolor, questionbackgroundcolor; row 184 plan P3 adds -// answerstextcolor; row 186 plan P4 adds questionhelpbackgroundcolor) became mode +// answerstextcolor; row 186 plan P4 adds questionhelpbackgroundcolor; row 191 plan +// P6 adds the six per-button choosers) 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']; +$colorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor', 'grouptitletextcolor', 'groupdescriptiontextcolor', 'questiontitletextcolor', 'questiontitlebackgroundcolor', 'questionbackgroundcolor', 'answerstextcolor', 'questionhelpbackgroundcolor', '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 437f14f..49d5046 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:23:13 + 2026-11-29 14:39:51 vanilla_respondage @@ -409,24 +409,39 @@ in custom_header.twig on .question-help-container. --> #ff005f - - base - default - - #444444 + + base + other + + #ffffff + default + + #444444 + color1 + + #ffffff + other + + #ffffff + color1 + + #ffffff + other + + #ffffff #5e1c64 lightyellow diff --git a/views/subviews/header/custom_header.twig b/views/subviews/header/custom_header.twig index 6b6f96c..e72867a 100644 --- a/views/subviews/header/custom_header.twig +++ b/views/subviews/header/custom_header.twig @@ -27,6 +27,14 @@ {%- set m = mode|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 %} +{# Row 191 / row 178 plan P6: like cm(), but for BACKGROUND choosers — mode + "default" means "no override" (empty string), so the Bootstrap button default + (btn-primary / btn-outline-secondary) stays; all other modes resolve the same + way as cm(). Used for the per-button background colors of the navigator. #} +{% macro cmbg(mode, custom, opts) -%} + {%- set m = mode|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('') : ''))))) -}} +{%- endmacro %} {% import _self as cmm %}