feat(options): Default fonts and colors tab with Default font/colors sections (Prompt Y)

- Tab renamed to "Default fonts and colors" with full-width h2+p intro
  ("Default font"), 3-col row font/fontcolor/fontsize, hr, "Default colors"
  h2+p, 3-col row primarycolor ("Color 1 (primary)")/secondarycolor/new
  tertiarycolor ("Color 3", #dddddd)
- headerfont moved to Top of page Header section col 2 above navbarfontcolor;
  progressbarfont to Progress bar first row col 3 (col 2 stays empty)
- headertextcolor(+custom)/progressbartextcolor(+custom) removed from
  config.xml (covered by navbarfontcolor/progressbarfontcolor; views fall
  back to fontcolor via |default)
- 21 per-element font/color/size options moved Fonts -> Questions, rendered
  full width below the 3 question columns
- variants rebuilt (defensie/erasmus/respondage); example variant config
  synced

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-25 14:23:24 +01:00
commit 089ddc5642

View file

@ -142,13 +142,16 @@
Values are stored per option key, so moving them here does not change any stored
value. The order of this list is the order shown in the tab. #}
{% set aTopOfPageKeys = [
'headerbackgroundcolor', 'navbarfontcolor',
'headerbackgroundcolor', 'headerfont', 'navbarfontcolor',
'headersticky', 'headerstickycomputer', 'headerstickytablet', 'headerstickymobile',
'brandlogofile', 'brandlogotopmargin', 'brandshowoncomputer', 'brandshowontablet', 'brandshowonmobile',
'centerlogofile', 'centerlogotopmargin', 'centershowoncomputer', 'centershowontablet', 'centershowonmobile',
'rightlogofile', 'rightlogotopmargin', 'rightshowoncomputer', 'rightshowontablet', 'rightshowonmobile',
'progressbarposition', 'progressbarbackgroundcolor', 'progressbarcolor', 'progressbarfontcolor'
'progressbarposition', 'progressbarfont', 'progressbarbackgroundcolor', 'progressbarcolor', 'progressbarfontcolor'
] %}
{# Prompt Y: 'headerfont' sits in column 2 of the Header section, ABOVE navbarfontcolor
(the menu-item color); 'progressbarfont' sits in column 3 of the first Progress bar
row (column 1 = progressbarposition, column 2 stays empty). #}
{# Prompt M: the logo keys are rendered as ONE dedicated 3-column block (triggered at
the first logo key, 'brandlogofile') and skipped in the generic per-key loop. #}
@ -172,7 +175,12 @@
colors" pane. Per element <el> the keys are <el>font (fontselect),
<el>textcolor (dropdown default|primary|secondary|other) and
<el>textcolorcustom (colorpicker, visible only when <el>textcolor = "other"). #}
{% set aFontElements = ['header', 'progressbar', 'questiontitle', 'answers', 'grouptitle', 'groupdescription', 'buttons'] %}
{% set aFontElements = ['questiontitle', 'answers', 'grouptitle', 'groupdescription', 'buttons'] %}
{# Prompt Y: only these five elements still have a <el>textcolor dropdown (parent of
<el>textcolorcustom, show-value "other" via aShowIfValues below). The header and
progressbar textcolor keys were removed from config.xml — their colors are set in
the Top of the page tab (navbarfontcolor / progressbarfontcolor) — so header and
progressbar are no longer in aFontElements. #}
{# Prompt R: multi-value show lists per parent key, rendered as
data-show-if-value (e.g. "box|top" for questionborder). Core passes only the
@ -183,16 +191,14 @@
{% set aShowIfValues = { 'questionborder': 'box|top' } %}
{% for el in aFontElements %}{% set aShowIfValues = aShowIfValues|merge({ (el ~ 'textcolor'): 'other' }) %}{% endfor %}
{# Prompt U: the Fonts pane is rendered as "Fonts and colors" with a special
layout: a TOP ROW (col 1: font/fontcolor/fontsize; col 2: primarycolor/
secondarycolor; col 3 empty), an hr, then one combo row per element in
aFontElements (col 1: <el>font, col 2: <el>textcolor, col 3:
<el>textcolorcustom), then the remaining Fonts options (sizes/weights)
stacked as usual ("rest"). config.xml lists the Fonts options in exactly
this order, so the generic loop meets them slot by slot and opens/closes
the containers on slot change (fLastSlot). #}
{% set aFontsTop1 = ['font', 'fontcolor', 'fontsize'] %}
{% set aFontsTop2 = ['primarycolor', 'secondarycolor'] %}
{# Prompt Y: the Fonts pane ("Default fonts and colors") has exactly six options in
two 3-column rows: row 1 = font | fontcolor | fontsize (one per column), then a
full-width hr + "Default colors" intro (h2+p), then row 2 = primarycolor |
secondarycolor | tertiarycolor (one per column). The per-element combos and the
size/weight options moved to the Questions tab; headerfont/progressbarfont moved
to Top of the page. Slots f1-f3 (row 1) and c1-c3 (row 2). #}
{% set aFontsRow1 = ['font', 'fontcolor', 'fontsize'] %}
{% set aFontsRow2 = ['primarycolor', 'secondarycolor', 'tertiarycolor'] %}
{# Prompt R: the Questions pane renders as THREE columns (col-md-4, border-start
between them) with explicit key lists. config.xml lists the Questions options
@ -211,7 +217,7 @@
stay stable regardless of the tab order. #}
{% set aTabs = [] %}
{% if 'Fonts' in aOptionAttributes.categories %}
{% set aTabs = [{ 'id': 'category-fonts', 'label': 'Fonts and colors', 'category': 'Fonts', 'keys': null }] %}
{% set aTabs = [{ 'id': 'category-fonts', 'label': 'Default fonts and colors', 'category': 'Fonts', 'keys': null }] %}
{% endif %}
{% set aTabs = aTabs|merge([{ 'id': 'top-of-page', 'label': 'Top of the page', 'category': 'Top of the page', 'keys': aTopOfPageKeys }]) %}
{% for category in aOptionAttributes.categories %}
@ -276,6 +282,15 @@
<p>{{ gT("The header is the top part of the page, possibly containing the name of the survey, logo's and a menu. In this part of the options you can make this header more or less distinguishable from the rest of the page and you can choose if the logo should stay on top of the page after scrolling (sticky) or not.") }}</p>
</div></div>
{% endif %}
{% if tab.id == 'category-fonts' %}
{# Prompt Y: intro of the "Default fonts and colors" pane — full-width h2 + p,
translatable via gT(). (Typo in the owner's source fixed: "you version" ->
"your version".) #}
<div class="row action_hide_on_inherit fonts-intro"><div class="col-12">
<h2>{{ gT("Default font") }}</h2>
<p>{{ gT("Here you choose the default font, the font that is used on most places in your version of the theme.") }}</p>
</div></div>
{% endif %}
<div class="row action_hide_on_inherit">
{# Prompt P: in the Images pane use the three-column grid like the logo
block (Prompt M), but fill ONLY column 1 — all Images options stack
@ -297,26 +312,29 @@
{% set bTopPane = tab.id == 'top-of-page' %}
{% set fSlot = 'rest' %}
{% if bFontsPane %}
{% if key in aFontsTop1 %}{% set fSlot = 'top1' %}
{% elseif key in aFontsTop2 %}{% set fSlot = 'top2' %}
{% else %}
{% for el in aFontElements %}
{% if key == el ~ 'font' %}{% set fSlot = 'combo1' %}
{% elseif key == el ~ 'textcolor' %}{% set fSlot = 'combo2' %}
{% elseif key == el ~ 'textcolorcustom' %}{% set fSlot = 'combo3' %}{% endif %}
{% endfor %}
{# Prompt Y: two 3-column rows — f1/f2/f3 = font/fontcolor/fontsize,
c1/c2/c3 = primary/secondary/tertiary color. #}
{% if key == 'font' %}{% set fSlot = 'f1' %}
{% elseif key == 'fontcolor' %}{% set fSlot = 'f2' %}
{% elseif key == 'fontsize' %}{% set fSlot = 'f3' %}
{% elseif key == 'primarycolor' %}{% set fSlot = 'c1' %}
{% elseif key == 'secondarycolor' %}{% set fSlot = 'c2' %}
{% elseif key == 'tertiarycolor' %}{% set fSlot = 'c3' %}
{% endif %}
{% elseif bTopPane %}
{# Prompt X: Top-of-page sections — Header (3 cols:
headerbackgroundcolor | navbarfontcolor | sticky group), hr,
Logos (h2+p, then the logo block, then its hr), Progress bar
(h2+p, position in col 1 with empty cols 2-3, then a colors row
with one colorpicker per column, in current order). #}
{# Prompt X/Y: Top-of-page sections — Header (3 cols:
headerbackgroundcolor | headerfont above navbarfontcolor |
sticky group), hr, Logos (h2+p, then the logo block, then its
hr), Progress bar (h2+p, first row: position in col 1, col 2
empty, progressbarfont in col 3; then a colors row with one
colorpicker per column, in current order). #}
{% if key in aLogoKeys %}{% set fSlot = 'logo' %}
{% elseif key == 'headerbackgroundcolor' %}{% set fSlot = 'h1' %}
{% elseif key == 'headerfont' %}{% set fSlot = 'hf' %}
{% elseif key == 'navbarfontcolor' %}{% set fSlot = 'h2' %}
{% elseif key in aTopStickyKeys %}{% set fSlot = 'h3' %}
{% elseif key == 'progressbarposition' %}{% set fSlot = 'ppos' %}
{% elseif key == 'progressbarfont' %}{% set fSlot = 'pfont' %}
{% elseif key == 'progressbarbackgroundcolor' %}{% set fSlot = 'pcol1' %}
{% elseif key == 'progressbarcolor' %}{% set fSlot = 'pcol2' %}
{% elseif key == 'progressbarfontcolor' %}{% set fSlot = 'pcol3' %}
@ -324,20 +342,25 @@
{% endif %}
{% if fSlot != fLastSlot and (bFontsPane or bTopPane) %}
{% if bFontsPane %}
{% if fLastSlot == 'top2' %}</div><div class="col-md-4"></div></div><div class="row action_hide_on_inherit"><div class="col-12"><hr class="fonts-hr"></div></div>{% endif %}
{% if fLastSlot == 'combo3' %}</div></div>{% endif %}
{% if fSlot == 'top1' %}<div class="row fonts-top-row"><div class="col-md-4">
{% elseif fSlot == 'top2' %}</div><div class="col-md-4">
{% elseif fSlot == 'combo1' %}<div class="row font-combo-row"><div class="col-md-4">
{% elseif fSlot == 'combo2' %}</div><div class="col-md-4">
{% elseif fSlot == 'combo3' %}</div><div class="col-md-4">
{# Prompt Y: row 1 (f1/f2/f3) is opened at f1; at f3 the row is
closed and row 2 (c1/c2/c3) opens after hr + "Default colors"
intro; within a row each new slot just moves to the next
col-md-4. #}
{% if fLastSlot == 'f3' %}</div></div><div class="row action_hide_on_inherit"><div class="col-12"><hr class="fonts-hr"></div></div><div class="row action_hide_on_inherit fonts-section-intro"><div class="col-12"><h2>{{ gT("Default colors") }}</h2><p>{{ gT("The default colors are your most used colors.") }}</p></div></div><div class="row action_hide_on_inherit fonts-colors-row"><div class="col-md-4">
{% elseif fLastSlot == 'f1' or fLastSlot == 'f2' or fLastSlot == 'c1' or fLastSlot == 'c2' %}</div><div class="col-md-4">
{% endif %}
{% if fSlot == 'f1' %}<div class="row action_hide_on_inherit fonts-top-row"><div class="col-md-4">
{% endif %}
{% else %}
{# top-of-page transitions: close previous slot, open new slot #}
{# top-of-page transitions: close previous slot, open new slot.
Header: col 1 = h1, col 2 = hf stacked above h2, col 3 = h3.
Progress bar: first row = ppos in col 1, empty col 2, pfont in
col 3; then the colors row (pcol1/pcol2/pcol3). #}
{% if fLastSlot == 'h1' or fLastSlot == 'h2' %}</div><div class="col-md-4">
{% elseif fLastSlot == 'h3' %}</div></div><div class="row action_hide_on_inherit"><div class="col-12"><hr class="top-section-hr"></div></div><div class="row action_hide_on_inherit top-section-intro"><div class="col-12"><h2>{{ gT("Logos") }}</h2><p>{{ gT("In this theme there are three positions for separate logos, but it is up to you which positions you want to fill.") }}</p></div></div>
{% elseif fLastSlot == 'logo' %}<div class="row action_hide_on_inherit top-section-intro"><div class="col-12"><h2>{{ gT("Progress bar") }}</h2><p>{{ gT("The progress bar can be switched on/off per survey in the survey settings. Here in this section you can choose how the progress bar looks when displayed.") }}</p></div></div>
{% elseif fLastSlot == 'ppos' %}</div><div class="col-md-4"></div><div class="col-md-4"></div></div><div class="row action_hide_on_inherit progress-colors-row"><div class="col-md-4">
{% elseif fLastSlot == 'ppos' %}</div><div class="col-md-4"></div><div class="col-md-4">
{% elseif fLastSlot == 'pfont' %}</div></div><div class="row action_hide_on_inherit progress-colors-row"><div class="col-md-4">
{% elseif fLastSlot == 'pcol1' or fLastSlot == 'pcol2' %}</div><div class="col-md-4">
{% endif %}
{% if fSlot == 'h1' %}<div class="row action_hide_on_inherit top-section-header"><div class="col-md-4">
@ -414,13 +437,18 @@
{% elseif key not in aLogoKeys %}
{# Prompt R: Questions pane — three columns; open a col-md-4 at the
first key and switch column (border-start) whenever the key's
column changes. All options in this pane stack as col-12. #}
column changes. All options in the columns stack as col-12.
Prompt Y: keys in none of the three column lists (the per-element
font/color/size options moved here) get qCol 0 = "rest": the open
column is closed and they render full width below the columns. #}
{% set bQuestionsPane = tab.category == 'Questions' %}
{% if bQuestionsPane %}
{% set qCol = key in aQuestionsCol1 ? 1 : (key in aQuestionsCol2 ? 2 : 3) %}
{% set qCol = key in aQuestionsCol1 ? 1 : (key in aQuestionsCol2 ? 2 : (key in aQuestionsCol3 ? 3 : 0)) %}
{% if qCol != qLastCol %}
{% if qLastCol > 0 %}</div>{% endif %}
{% if qCol > 0 %}
<div class="col-md-4{% if qLastCol > 0 %} border-start{% endif %} questions-col-{{ qCol }}">
{% endif %}
{% set qLastCol = qCol %}
{% endif %}
{% endif %}