feat(options): new Buttons tab after Questions with per-button color choosers (row 178 plan P6)

- config.xml: new 'Buttons' category directly after Questions — buttonsfont
  (full width) + 12 per-button options (Previous/Next/Submit x background+
  text, 6-way mode dropdown + custom picker, width 4); old global
  buttonstextcolor(+custom) removed (row-178 decision 7)
- options.twig: Buttons pane = h2+intro, full-width font row, one row of three
  col-md-4 columns (Previous/Next/Submit, border-start dividers); 6 new keys
  in aColorChooserKeys; OPTIONS_JS_TOKEN 20261129.4
- options.js + build.php: chooser key lists synced (+6)
- navigator.twig: respondage-btn-prev/-next/-submit classes, old global text
  color inline style removed; custom_header.twig: cmbg() macro (mode 'default'
  = no override) + per-button bg/text rules with decision-7 defaults
  (Next/Submit bg=Color 1 + text #ffffff, Previous bg=#ffffff + default font
  color)

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-29 15:48:26 +01:00
commit aae3112981

View file

@ -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 %}
<style>
@ -320,16 +328,51 @@
background: {{ aSurveyInfo.options.primarycolor }};
}
.btn-check:active+.btn-primary,
.btn-check:checked+.btn-primary,
.btn-primary.active,
.btn-primary:active,
.show>.btn-primary.dropdown-toggle,
.show > .btn-primary.dropdown-toggle,
.btn-check:active+.btn-primary,
.btn-check:checked+.btn-primary,
.btn-primary.active,
.btn-primary:active,
.show>.btn-primary.dropdown-toggle,
.show > .btn-primary.dropdown-toggle,
.btn-primary:focus {
background: {{ aSurveyInfo.options.primarycolor }};
}
{# Row 191 / row 178 plan P6: per-button colors for the navigator buttons
(classes respondage-btn-prev/-next/-submit from navigator.twig).
Backgrounds resolve via cmbg() (mode "default" = no rule = Bootstrap
default button background), text colors via cm() (mode "default" = the
default font color). Row-178 decision 7 defaults: Next/Submit background =
Color 1, text = Other ... #ffffff; Previous background = Other ... #ffffff,
text = Default font color. Legacy stored hex values pass through both
macros. The :hover/:focus/:active variants keep the same specificity as
Bootstrap's .btn-primary:hover rules above and win because this style
block is emitted later. #}
{% set sPrevBtnBg = cmm.cmbg(aSurveyInfo.options.previousbuttonbackgroundcolor|default('other'), aSurveyInfo.options.previousbuttonbackgroundcolorcustom|default('#ffffff'), aSurveyInfo.options) %}
{% set sPrevBtnColor = cmm.cm(aSurveyInfo.options.previousbuttontextcolor|default('default'), aSurveyInfo.options.previousbuttontextcolorcustom|default(''), aSurveyInfo.options) %}
{% set sNextBtnBg = cmm.cmbg(aSurveyInfo.options.nextbuttonbackgroundcolor|default('color1'), aSurveyInfo.options.nextbuttonbackgroundcolorcustom|default('#ffffff'), aSurveyInfo.options) %}
{% set sNextBtnColor = cmm.cm(aSurveyInfo.options.nextbuttontextcolor|default('other'), aSurveyInfo.options.nextbuttontextcolorcustom|default('#ffffff'), aSurveyInfo.options) %}
{% set sSubmitBtnBg = cmm.cmbg(aSurveyInfo.options.submitbuttonbackgroundcolor|default('color1'), aSurveyInfo.options.submitbuttonbackgroundcolorcustom|default('#ffffff'), aSurveyInfo.options) %}
{% set sSubmitBtnColor = cmm.cm(aSurveyInfo.options.submitbuttontextcolor|default('other'), aSurveyInfo.options.submitbuttontextcolorcustom|default('#ffffff'), aSurveyInfo.options) %}
{% if sPrevBtnBg != '' or sPrevBtnColor != '' %}
.respondage-btn-prev, .respondage-btn-prev:hover, .respondage-btn-prev:focus, .respondage-btn-prev:active {
{% if sPrevBtnBg != '' %}background: {{ sPrevBtnBg }}; border-color: {{ sPrevBtnBg }};{% endif %}
{% if sPrevBtnColor != '' %}color: {{ sPrevBtnColor }};{% endif %}
}
{% endif %}
{% if sNextBtnBg != '' or sNextBtnColor != '' %}
.respondage-btn-next, .respondage-btn-next:hover, .respondage-btn-next:focus, .respondage-btn-next:active {
{% if sNextBtnBg != '' %}background: {{ sNextBtnBg }}; border-color: {{ sNextBtnBg }};{% endif %}
{% if sNextBtnColor != '' %}color: {{ sNextBtnColor }};{% endif %}
}
{% endif %}
{% if sSubmitBtnBg != '' or sSubmitBtnColor != '' %}
.respondage-btn-submit, .respondage-btn-submit:hover, .respondage-btn-submit:focus, .respondage-btn-submit:active {
{% if sSubmitBtnBg != '' %}background: {{ sSubmitBtnBg }}; border-color: {{ sSubmitBtnBg }};{% endif %}
{% if sSubmitBtnColor != '' %}color: {{ sSubmitBtnColor }};{% endif %}
}
{% endif %}
{% set checkicon = '"\\' ~ aSurveyInfo.options.checkicon ~ '"' %}
.checkbox-item input[type="checkbox"]:checked + label::after, .checkbox-item input[type="radio"]:checked + label::after {
content: {{ checkicon }};