feat(options): Groups tab with intro and two columns; group colors become color choosers; font options Normal|Bold|Italic|Bold italic

Row 157. Groups pane gets a full-width h2 'Groups' + explanatory text and a
two-column slot layout: col 1 = group title options (font, color, custom,
size, font options), col 2 = same for the group description (singular wording).
grouptitletextcolor/groupdescriptiontextcolor switch from the old 4-way
dropdown to the row-135 color chooser (6 modes, default 'Default font color',
swatch chips, grayed-out custom picker unless 'other'); legacy stored modes
primary/secondary and raw hex migrate client-side (options.js) and in the views.
The old *fontweight keys (400|700) become *fontoptions (normal|bold|italic|
bolditalic), mapped to font-weight/font-style in custom_header.twig with a
legacy 400/700 fallback until theme reset. build.php migrates variant jsons
(chooser hex/modes + fontweight keys). OPTIONS_JS_TOKEN 20261127.1.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-27 02:50:06 +01:00
commit 956324775b
7 changed files with 138 additions and 39 deletions

View file

@ -440,24 +440,40 @@
<option value="other">Other…</option> <option value="other">Other…</option>
</dropdownoptions></answerstextcolor> </dropdownoptions></answerstextcolor>
<answerstextcolorcustom type="colorpicker" category="Questions" width="12" title="Custom text color for answers and help texts" parent="answerstextcolor">#444444</answerstextcolorcustom> <answerstextcolorcustom type="colorpicker" category="Questions" width="12" title="Custom text color for answers and help texts" parent="answerstextcolor">#444444</answerstextcolorcustom>
<!-- Row 157: the group options are shown in the dedicated "Groups" tab (pulled
out of the Questions category by aGroupKeys in options.twig, laid out in
two columns there: col 1 = group title, col 2 = group description).
grouptitletextcolor/groupdescriptiontextcolor use the color-chooser scheme
(row 135 pattern: mode dropdown default|defaultbackgroundcolor|color1|
color2|color3|other + <key>custom child, default "Default font color" =
mode "default"); a legacy stored mode "primary"/"secondary" (old 4-mode
dropdown) or a raw hex migrates client-side in options.js, and the views
accept both. The old <el>fontweight keys (400|700) became <el>fontoptions
(normal|bold|italic|bolditalic) — font-style included; custom_header.twig
maps them to font-weight/font-style. Defaults keep the old look: title
bold, description normal. -->
<grouptitlefont type="fontselect" category="Questions" width="4" title="Font for group titles">base</grouptitlefont> <grouptitlefont type="fontselect" category="Questions" width="4" title="Font for group titles">base</grouptitlefont>
<grouptitletextcolor type="dropdown" category="Questions" width="12" title="Text color for group titles" options="default|primary|secondary|other" optionlabels="Default font color|Primary color|Secondary color|Other…">default <grouptitletextcolor type="dropdown" category="Questions" width="12" title="Group title color" options="default|defaultbackgroundcolor|color1|color2|color3|other" optionlabels="Default font color|Default background color|Color 1|Color 2|Color 3|Other ...">default
<dropdownoptions> <dropdownoptions>
<option value="default" data-default="1">[Default font color]</option> <option value="default" data-default="1">[Default font color]</option>
<option value="primary">Primary color</option> <option value="defaultbackgroundcolor">Default background color</option>
<option value="secondary">Secondary color</option> <option value="color1">Color 1</option>
<option value="other">Other…</option> <option value="color2">Color 2</option>
<option value="color3">Color 3</option>
<option value="other">Other ...</option>
</dropdownoptions></grouptitletextcolor> </dropdownoptions></grouptitletextcolor>
<grouptitletextcolorcustom type="colorpicker" category="Questions" width="12" title="Custom text color for group titles" parent="grouptitletextcolor">#444444</grouptitletextcolorcustom> <grouptitletextcolorcustom type="colorpicker" category="Questions" width="12" title="Custom group title color (for 'Other ...')" parent="grouptitletextcolor">#444444</grouptitletextcolorcustom>
<groupdescriptionfont type="fontselect" category="Questions" width="4" title="Font for group descriptions">base</groupdescriptionfont> <groupdescriptionfont type="fontselect" category="Questions" width="4" title="Font for group description">base</groupdescriptionfont>
<groupdescriptiontextcolor type="dropdown" category="Questions" width="12" title="Text color for group descriptions" options="default|primary|secondary|other" optionlabels="Default font color|Primary color|Secondary color|Other…">default <groupdescriptiontextcolor type="dropdown" category="Questions" width="12" title="Group description color" options="default|defaultbackgroundcolor|color1|color2|color3|other" optionlabels="Default font color|Default background color|Color 1|Color 2|Color 3|Other ...">default
<dropdownoptions> <dropdownoptions>
<option value="default" data-default="1">[Default font color]</option> <option value="default" data-default="1">[Default font color]</option>
<option value="primary">Primary color</option> <option value="defaultbackgroundcolor">Default background color</option>
<option value="secondary">Secondary color</option> <option value="color1">Color 1</option>
<option value="other">Other…</option> <option value="color2">Color 2</option>
<option value="color3">Color 3</option>
<option value="other">Other ...</option>
</dropdownoptions></groupdescriptiontextcolor> </dropdownoptions></groupdescriptiontextcolor>
<groupdescriptiontextcolorcustom type="colorpicker" category="Questions" width="12" title="Custom text color for group descriptions" parent="groupdescriptiontextcolor">#444444</groupdescriptiontextcolorcustom> <groupdescriptiontextcolorcustom type="colorpicker" category="Questions" width="12" title="Custom group description color (for 'Other ...')" parent="groupdescriptiontextcolor">#444444</groupdescriptiontextcolorcustom>
<buttonsfont type="fontselect" category="Questions" width="4" title="Font for the buttons (Previous/Next/Submit)">base</buttonsfont> <buttonsfont type="fontselect" category="Questions" width="4" title="Font for the buttons (Previous/Next/Submit)">base</buttonsfont>
<buttonstextcolor type="dropdown" category="Questions" width="12" title="Text color for the buttons (Previous/Next/Submit)" options="default|primary|secondary|other" optionlabels="Default font color|Primary color|Secondary color|Other…">default <buttonstextcolor type="dropdown" category="Questions" width="12" title="Text color for the buttons (Previous/Next/Submit)" options="default|primary|secondary|other" optionlabels="Default font color|Primary color|Secondary color|Other…">default
<dropdownoptions> <dropdownoptions>
@ -470,9 +486,9 @@
<questiontitlefontsize type="buttons" category="Questions" width="6" title="Question title font size" options="1.0rem|1.2rem|1.5rem|2.0rem|20px|24px" optionlabels="Same as Base Font Size(BFS)|1.2 BFS|1.5 BFS|2.0 BFS|20px|24px">1.2rem</questiontitlefontsize> <questiontitlefontsize type="buttons" category="Questions" width="6" title="Question title font size" options="1.0rem|1.2rem|1.5rem|2.0rem|20px|24px" optionlabels="Same as Base Font Size(BFS)|1.2 BFS|1.5 BFS|2.0 BFS|20px|24px">1.2rem</questiontitlefontsize>
<questiontitlefontweight type="buttons" category="Questions" width="6" title="Question title font weight" options="400|700" optionlabels="Normal|Bold">700</questiontitlefontweight> <questiontitlefontweight type="buttons" category="Questions" width="6" title="Question title font weight" options="400|700" optionlabels="Normal|Bold">700</questiontitlefontweight>
<grouptitlefontsize type="buttons" category="Questions" width="6" title="Group title font size" options="1.0rem|1.2rem|1.5rem|2.0rem|20px|24px" optionlabels="Same as Base Font Size(BFS)|1.2 BFS|1.5 BFS|2.0 BFS|20px|24px">2.0rem</grouptitlefontsize> <grouptitlefontsize type="buttons" category="Questions" width="6" title="Group title font size" options="1.0rem|1.2rem|1.5rem|2.0rem|20px|24px" optionlabels="Same as Base Font Size(BFS)|1.2 BFS|1.5 BFS|2.0 BFS|20px|24px">2.0rem</grouptitlefontsize>
<grouptitlefontweight type="buttons" category="Questions" width="6" title="Group title font weight" options="400|700" optionlabels="Normal|Bold">700</grouptitlefontweight> <grouptitlefontoptions type="buttons" category="Questions" width="6" title="Group title font options" options="normal|bold|italic|bolditalic" optionlabels="Normal|Bold|Italic|Bold italic">bold</grouptitlefontoptions>
<groupdescriptionfontsize type="buttons" category="Questions" width="6" title="Group description font size" options="1.0rem|1.2rem|1.5rem|2.0rem|20px|24px" optionlabels="Same as Base Font Size(BFS)|1.2 BFS|1.5 BFS|2.0 BFS|20px|24px">1.2rem</groupdescriptionfontsize> <groupdescriptionfontsize type="buttons" category="Questions" width="6" title="Group description font size" options="1.0rem|1.2rem|1.5rem|2.0rem|20px|24px" optionlabels="Same as Base Font Size(BFS)|1.2 BFS|1.5 BFS|2.0 BFS|20px|24px">1.2rem</groupdescriptionfontsize>
<groupdescriptionfontweight type="buttons" category="Questions" width="6" title="Group description font weight" options="400|700" optionlabels="Normal|Bold">400</groupdescriptionfontweight> <groupdescriptionfontoptions type="buttons" category="Questions" width="6" title="Group description font options" options="normal|bold|italic|bolditalic" optionlabels="Normal|Bold|Italic|Bold italic">normal</groupdescriptionfontoptions>
</options> </options>
<!-- Here datas about how LimeSurvey should load the theme --> <!-- Here datas about how LimeSurvey should load the theme -->

View file

@ -25,9 +25,14 @@ var ThemeOptions = function () {
// updateFieldSettings) can clobber optionObject, so the migration in colorModeUI // updateFieldSettings) can clobber optionObject, so the migration in colorModeUI
// must use this snapshot. // must use this snapshot.
var legacyColorValues = {}; var legacyColorValues = {};
// row 157: legacy non-hex MODE values of the chooser options (e.g. "primary"/
// "secondary" stored by the old 4-way grouptitle/groupdescription textcolor
// dropdowns) — mapped to color1/color2 in colorModeUI
var legacyModeValues = {};
// row 135: all options that use the color-chooser scheme (mode dropdown with // row 135: all options that use the color-chooser scheme (mode dropdown with
// class selector_color_mode + swatch chips + a <key>custom colorpicker child) // class selector_color_mode + swatch chips + a <key>custom colorpicker child);
var aColorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor']; // row 157: the group title/description text colors joined the scheme
var aColorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor', 'grouptitletextcolor', 'groupdescriptiontextcolor'];
// the 5 presets, in the SAME order as the dropdown options in config.xml // 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" // (object key order = swatch chip order) — row 125: "Default background color"
// is the SECOND choice, right after "Default font color". // is the SECOND choice, right after "Default font color".
@ -847,6 +852,7 @@ var ThemeOptions = function () {
colorModeRefreshers.push(refreshAll); colorModeRefreshers.push(refreshAll);
// legacy migration: stored hex (pre-dropdown value) -> mode "other" + hex into the custom field // legacy migration: stored hex (pre-dropdown value) -> mode "other" + hex into the custom field
var stored = legacyColorValues[key]; var stored = legacyColorValues[key];
var storedMode = legacyModeValues[key];
if (typeof stored === 'string' && /^#[0-9a-fA-F]{3,8}$/.test(stored)) { if (typeof stored === 'string' && /^#[0-9a-fA-F]{3,8}$/.test(stored)) {
sel.val('other'); sel.val('other');
if (customInput.length && !/^#[0-9a-fA-F]{3,8}$/.test(String(customInput.val() || ''))) { if (customInput.length && !/^#[0-9a-fA-F]{3,8}$/.test(String(customInput.val() || ''))) {
@ -855,6 +861,18 @@ var ThemeOptions = function () {
// re-evaluate the child's disabled state for the migrated mode // re-evaluate the child's disabled state for the migrated mode
updateAllChildren(); updateAllChildren();
updateVisibilityByParent(); updateVisibilityByParent();
} else if (typeof storedMode === 'string' && storedMode !== '' && !sel.find('option[value="' + storedMode + '"]').length) {
// row 157: legacy mode of the old 4-way <el>textcolor dropdowns
// (primary|secondary) has no option in the 6-mode chooser -> map it
// (primary -> color1, secondary -> color2); "default"/"other" still
// exist as options and need no mapping
var legacyModeMap = { 'primary': 'color1', 'secondary': 'color2' };
var mapped = legacyModeMap[storedMode];
if (mapped && sel.find('option[value="' + mapped + '"]').length) {
sel.val(mapped);
updateAllChildren();
updateVisibilityByParent();
}
} else if (!sel.val()) { } else if (!sel.val()) {
// no (matching) stored value: fall back to the option's configured // no (matching) stored value: fall back to the option's configured
// default (row 125: every color-chooser option can pick its own default // default (row 125: every color-chooser option can pick its own default
@ -946,6 +964,8 @@ var ThemeOptions = function () {
var v = optionObject[k]; var v = optionObject[k];
if (typeof v === 'string' && /^#[0-9a-fA-F]{3,8}$/.test(v)) { if (typeof v === 'string' && /^#[0-9a-fA-F]{3,8}$/.test(v)) {
legacyColorValues[k] = v; legacyColorValues[k] = v;
} else if (typeof v === 'string' && v !== '' && v !== 'inherit') {
legacyModeValues[k] = v;
} }
}); });
}); });

View file

@ -46,7 +46,7 @@
heuristically cached copy (the file has only Last-Modified/ETag, no Cache-Control). 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 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. #} options/options.js changes, so every browser fetches the new file once. #}
{% set OPTIONS_JS_TOKEN = '20261126.19' %} {% set OPTIONS_JS_TOKEN = '20261127.1' %}
{{ unregisterScriptFile(optionsPath ~ '/options.js') }} {{ unregisterScriptFile(optionsPath ~ '/options.js') }}
{{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }} {{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }}
@ -262,7 +262,7 @@
{% set aFontElements = ['questiontitle', 'answers', 'grouptitle', 'groupdescription', 'buttons'] %} {% set aFontElements = ['questiontitle', 'answers', 'grouptitle', 'groupdescription', 'buttons'] %}
{% set aColorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor'] %} {% set aColorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor', 'grouptitletextcolor', 'groupdescriptiontextcolor'] %}
{% set aShowIfValues = { 'questionborder': 'box|top', 'navbarfontcolor': 'other' } %} {% set aShowIfValues = { 'questionborder': 'box|top', 'navbarfontcolor': 'other' } %}
{% for el in aFontElements %}{% set aShowIfValues = aShowIfValues|merge({ (el ~ 'textcolor'): 'other' }) %}{% endfor %} {% for el in aFontElements %}{% set aShowIfValues = aShowIfValues|merge({ (el ~ 'textcolor'): 'other' }) %}{% endfor %}
@ -285,13 +285,15 @@
{# row 147: all group-related options of the "Questions" category — they are {# 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). pulled out of the Questions tab into a dedicated "Groups" tab (aGroupsTab below).
Values are stored per option key, so moving them does not change stored values. #} Values are stored per option key, so moving them does not change stored values.
Row 157: the Groups pane is laid out in TWO columns (slots g1/g2 below):
col 1 = group title options, col 2 = group description options. #}
{% set aGroupKeys = [ {% set aGroupKeys = [
'grouptitlefont', 'grouptitletextcolor', 'grouptitletextcolorcustom', 'grouptitlefont', 'grouptitletextcolor', 'grouptitletextcolorcustom', 'grouptitlefontsize', 'grouptitlefontoptions',
'groupdescriptionfont', 'groupdescriptiontextcolor', 'groupdescriptiontextcolorcustom', 'groupdescriptionfont', 'groupdescriptiontextcolor', 'groupdescriptiontextcolorcustom', 'groupdescriptionfontsize', 'groupdescriptionfontoptions'
'grouptitlefontsize', 'grouptitlefontweight',
'groupdescriptionfontsize', 'groupdescriptionfontweight'
] %} ] %}
{% set aGroupCol1 = ['grouptitlefont', 'grouptitletextcolor', 'grouptitletextcolorcustom', 'grouptitlefontsize', 'grouptitlefontoptions'] %}
{% set aGroupCol2 = ['groupdescriptionfont', 'groupdescriptiontextcolor', 'groupdescriptiontextcolorcustom', 'groupdescriptionfontsize', 'groupdescriptionfontoptions'] %}
{# Tab list: FIRST the "Fonts" tab (where the default/base font is chosen and the {# Tab list: FIRST the "Fonts" tab (where the default/base font is chosen and the
per-element font overrides live), then the "Top of the page" tab (keys = per-element font overrides live), then the "Top of the page" tab (keys =
@ -319,9 +321,9 @@
{% if aImagesKeys is not empty %} {% if aImagesKeys is not empty %}
{% set aTabs = aTabs|merge([{ 'id': 'category-images', 'label': 'Page background', 'category': 'Images', 'keys': aImagesPaneKeys }]) %} {% set aTabs = aTabs|merge([{ 'id': 'category-images', 'label': 'Page background', 'category': 'Images', 'keys': aImagesPaneKeys }]) %}
{% endif %} {% endif %}
{# row 147: dedicated "Groups" tab with all group-related options (aGroupKeys). {# row 147/157: dedicated "Groups" tab with all group-related options (aGroupKeys).
category 'Groups' (no config.xml category of that name) so the pane renders the category 'Groups' (no config.xml category of that name) so the pane renders the
normal width-based grid instead of the Questions 3-column layout. #} slot layout below instead of the Questions 3-column grid. #}
{% set aTabs = aTabs|merge([{ 'id': 'groups', 'label': 'Groups', 'category': 'Groups', 'keys': aGroupKeys }]) %} {% set aTabs = aTabs|merge([{ 'id': 'groups', 'label': 'Groups', 'category': 'Groups', 'keys': aGroupKeys }]) %}
{% for category in aOptionAttributes.categories %} {% for category in aOptionAttributes.categories %}
{% if category != 'Fonts' and category != 'Top of the page' and category != 'Colors' and category != 'Images' and category != 'Simple options' %} {% if category != 'Fonts' and category != 'Top of the page' and category != 'Colors' and category != 'Images' and category != 'Simple options' %}
@ -414,6 +416,13 @@
<p>{{ gT("Set the page background here. Either just a solid color or an image.") }}</p> <p>{{ gT("Set the page background here. Either just a solid color or an image.") }}</p>
</div></div> </div></div>
{% endif %} {% endif %}
{% if tab.id == 'groups' %}
{# row 157: full-width intro of the Groups tab, above the two columns #}
<div class="row action_hide_on_inherit groups-intro"><div class="col-12">
<h2>{{ gT("Groups") }}</h2>
<p>{{ gT("Groups are more or less the same as pages. In the survey settings you can decide to show or hide the group title and the group description. Here you choose how they look when shown.") }}</p>
</div></div>
{% endif %}
<div class="row action_hide_on_inherit"> <div class="row action_hide_on_inherit">
{% set qLastCol = 0 %} {% set qLastCol = 0 %}
{% set fLastSlot = 0 %} {% set fLastSlot = 0 %}
@ -428,6 +437,7 @@
{% set bFontsPane = tab.category == 'Fonts' %} {% set bFontsPane = tab.category == 'Fonts' %}
{% set bTopPane = tab.id == 'top-of-page' %} {% set bTopPane = tab.id == 'top-of-page' %}
{% set bImagesPane = tab.category == 'Images' %} {% set bImagesPane = tab.category == 'Images' %}
{% set bGroupsPane = tab.id == 'groups' %}
{% set fSlot = 'rest' %} {% set fSlot = 'rest' %}
{% if bFontsPane %} {% if bFontsPane %}
{% if key == 'font' %}{% set fSlot = 'f1' %} {% if key == 'font' %}{% set fSlot = 'f1' %}
@ -472,8 +482,14 @@
{% if key in ['bodybackgroundcolor', 'bodybackgroundcolorcustom', 'backgroundimage'] %}{% set fSlot = 'bg1' %} {% if key in ['bodybackgroundcolor', 'bodybackgroundcolorcustom', 'backgroundimage'] %}{% set fSlot = 'bg1' %}
{% elseif key in ['backgroundimagefile', 'backgroundimagefixed', 'backgroundimagedisplay'] %}{% set fSlot = 'bg2' %} {% elseif key in ['backgroundimagefile', 'backgroundimagefixed', 'backgroundimagedisplay'] %}{% set fSlot = 'bg2' %}
{% endif %} {% endif %}
{% elseif bGroupsPane %}
{# row 157: Groups pane — TWO columns: col 1 (g1) = group title
options, col 2 (g2) = group description options #}
{% if key in aGroupCol1 %}{% set fSlot = 'g1' %}
{% elseif key in aGroupCol2 %}{% set fSlot = 'g2' %}
{% endif %}
{% endif %} {% endif %}
{% if fSlot != fLastSlot and (bFontsPane or bTopPane or bImagesPane) %} {% if fSlot != fLastSlot and (bFontsPane or bTopPane or bImagesPane or bGroupsPane) %}
{% if bFontsPane %} {% if bFontsPane %}
{% 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-3"> {% 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-3">
{% elseif fLastSlot == 'f1' or fLastSlot == 'f2' %}</div><div class="col-md-4"> {% elseif fLastSlot == 'f1' or fLastSlot == 'f2' %}</div><div class="col-md-4">
@ -504,6 +520,11 @@
bg1 key opens col 1 #} bg1 key opens col 1 #}
{% if fLastSlot == 'bg1' %}</div><div class="col-md-4 border-start images-col-2 option-visibility{% if bgImgVal != 'on' %} d-none{% endif %}" data-show-if-parent="backgroundimage" data-show-if-value="on">{% endif %} {% if fLastSlot == 'bg1' %}</div><div class="col-md-4 border-start images-col-2 option-visibility{% if bgImgVal != 'on' %} d-none{% endif %}" data-show-if-parent="backgroundimage" data-show-if-value="on">{% endif %}
{% if fSlot == 'bg1' %}<div class="col-md-4 images-col-1">{% endif %} {% if fSlot == 'bg1' %}<div class="col-md-4 images-col-1">{% endif %}
{% elseif bGroupsPane %}
{# row 157: Groups transitions — g1 -> g2 closes col 1 and opens
col 2 (border-start); the first g1 key opens col 1 #}
{% if fLastSlot == 'g1' %}</div><div class="col-md-6 border-start groups-col-2">{% endif %}
{% if fSlot == 'g1' %}<div class="col-md-6 groups-col-1">{% endif %}
{% endif %} {% endif %}
{% set fLastSlot = fSlot %} {% set fLastSlot = fSlot %}
{% endif %} {% endif %}
@ -620,7 +641,7 @@
{% set qLastCol = qCol %} {% set qLastCol = qCol %}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if bQuestionsPane or bTopPane 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 (bFontsPane and fSlot != 'rest') %}{% set wrapClass = 'col-12' %}{% else %}{% set wrapClass = 'col-12 col-md-' ~ attr.width|default(2) %}{% endif %}
{# server-side current value for this option (checked/selected/value) #} {# server-side current value for this option (checked/selected/value) #}
{% set currentValue = bGeneralInherit ? 'inherit' : (aCurrentOptions[key] is defined ? aCurrentOptions[key] : (oParentOptions[key] is defined ? oParentOptions[key] : '')) %} {% set currentValue = bGeneralInherit ? 'inherit' : (aCurrentOptions[key] is defined ? aCurrentOptions[key] : (oParentOptions[key] is defined ? oParentOptions[key] : '')) %}
{# parent != '': this field is only visible when the parent option's value {# parent != '': this field is only visible when the parent option's value
@ -855,6 +876,9 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if tab.category == 'Questions' and qLastCol > 0 %}</div>{% endif %} {% if tab.category == 'Questions' and qLastCol > 0 %}</div>{% 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'] %}</div>{% endif %}
{# close an open slot container at the end of a Fonts/Top-of-page pane {# 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) #} (every non-logo, non-rest slot has exactly two open divs: row + col) #}
{% if (tab.category == 'Fonts' or tab.id == 'top-of-page') and fLastSlot != 0 and fLastSlot != 'rest' and fLastSlot != 'logo' %}</div></div>{% endif %} {% if (tab.category == 'Fonts' or tab.id == 'top-of-page') and fLastSlot != 0 and fLastSlot != 'rest' and fLastSlot != 'logo' %}</div></div>{% endif %}

View file

@ -268,19 +268,40 @@ foreach ($logoPositions as $pos) {
} }
} }
// --- Row 115/135/149 migration: the color-chooser options (navbarfontcolor, // --- Row 115/135/149/157 migration: the color-chooser options (navbarfontcolor,
// headerbackgroundcolor, progressbarcolor, progressbarbackgroundcolor, // headerbackgroundcolor, progressbarcolor, progressbarbackgroundcolor,
// progressbarfontcolor, bodybackgroundcolor) became mode dropdowns (default|defaultbackgroundcolor| // progressbarfontcolor, bodybackgroundcolor, grouptitletextcolor,
// groupdescriptiontextcolor) became mode dropdowns (default|defaultbackgroundcolor|
// color1|color2|color3|other) with a <key>custom colorpicker child. A legacy HEX // color1|color2|color3|other) with a <key>custom colorpicker child. A legacy HEX
// value in the json means "custom color": map it to mode "other" and move the hex // value in the json means "custom color": map it to mode "other" and move the hex
// into the <key>custom child, so the variant default stays valid for the dropdown. // into the <key>custom child, so the variant default stays valid for the dropdown.
$colorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor']; // A legacy mode "primary"/"secondary" (old 4-way group textcolor dropdown) maps to
// "color1"/"color2".
$colorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor', 'grouptitletextcolor', 'groupdescriptiontextcolor'];
$colorChooserLegacyModes = ['primary' => 'color1', 'secondary' => 'color2'];
foreach ($colorChooserKeys as $ck) { foreach ($colorChooserKeys as $ck) {
if (isset($definition['options'][$ck]) if (isset($definition['options'][$ck])
&& is_string($definition['options'][$ck]) && is_string($definition['options'][$ck])
&& preg_match('/^#[0-9a-fA-F]{3,8}$/', $definition['options'][$ck])) { && preg_match('/^#[0-9a-fA-F]{3,8}$/', $definition['options'][$ck])) {
$definition['options'][$ck . 'custom'] = $definition['options'][$ck]; $definition['options'][$ck . 'custom'] = $definition['options'][$ck];
$definition['options'][$ck] = 'other'; $definition['options'][$ck] = 'other';
} elseif (isset($definition['options'][$ck])
&& is_string($definition['options'][$ck])
&& isset($colorChooserLegacyModes[$definition['options'][$ck]])) {
$definition['options'][$ck] = $colorChooserLegacyModes[$definition['options'][$ck]];
}
}
// --- Row 157 migration: the old <el>fontweight json keys (400|700) became
// <el>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.
$fontWeightToOptions = ['400' => 'normal', '700' => 'bold'];
foreach (['grouptitle', 'groupdescription'] as $el) {
$oldKey = $el . 'fontweight';
if (isset($definition['options'][$oldKey])) {
$w = (string) $definition['options'][$oldKey];
$definition['options'][$el . 'fontoptions'] = $fontWeightToOptions[$w] ?? 'normal';
unset($definition['options'][$oldKey]);
} }
} }

View file

@ -63,14 +63,22 @@
color: {{ aSurveyInfo.options.questiontitlefontcolor }}; color: {{ aSurveyInfo.options.questiontitlefontcolor }};
} }
{# Row 157: group title/description font OPTIONS (config.xml <el>fontoptions:
normal|bold|italic|bolditalic) mapped to font-weight + font-style. Until the
theme is reset, a legacy stored <el>fontweight ("400"/"700") is mapped onto
the new values; the defaults keep the old look (title bold, description normal). #}
{% set sGroupTitleFontOptions = aSurveyInfo.options.grouptitlefontoptions|default(aSurveyInfo.options.grouptitlefontweight|default('700') == '700' ? 'bold' : 'normal') %}
{% set sGroupDescFontOptions = aSurveyInfo.options.groupdescriptionfontoptions|default(aSurveyInfo.options.groupdescriptionfontweight|default('400') == '700' ? 'bold' : 'normal') %}
.group-title { .group-title {
font-size: {{ aSurveyInfo.options.grouptitlefontsize }}; font-size: {{ aSurveyInfo.options.grouptitlefontsize }};
font-weight: {{ aSurveyInfo.options.grouptitlefontweight }}; font-weight: {{ sGroupTitleFontOptions == 'bold' or sGroupTitleFontOptions == 'bolditalic' ? '700' : '400' }};
font-style: {{ sGroupTitleFontOptions == 'italic' or sGroupTitleFontOptions == 'bolditalic' ? 'italic' : 'normal' }};
} }
.group-description { .group-description {
font-size: {{ aSurveyInfo.options.groupdescriptionfontsize }}; font-size: {{ aSurveyInfo.options.groupdescriptionfontsize }};
font-weight: {{ aSurveyInfo.options.groupdescriptionfontweight }}; font-weight: {{ sGroupDescFontOptions == 'bold' or sGroupDescFontOptions == 'bolditalic' ? '700' : '400' }};
font-style: {{ sGroupDescFontOptions == 'italic' or sGroupDescFontOptions == 'bolditalic' ? 'italic' : 'normal' }};
} }
.privacy-block, .privacy .form-check { .privacy-block, .privacy .form-check {

View file

@ -22,11 +22,16 @@
"groupdescriptionfont", type fontselect). "base" = same as the base font: "groupdescriptionfont", type fontselect). "base" = same as the base font:
no extra class, inherits body font. #} no extra class, inherits body font. #}
{% set sGroupDescFont = aSurveyInfo.options.groupdescriptionfont|default('base') %} {% set sGroupDescFont = aSurveyInfo.options.groupdescriptionfont|default('base') %}
{# Prompt U: per-element text color — mode default -> fontcolor, primary -> {# Row 157: group description color is a color-chooser now (mode dropdown
primarycolor, secondary -> secondarycolor, other -> groupdescriptiontextcolorcustom. default|defaultbackgroundcolor|color1|color2|color3|other, like navbarfontcolor
Emitted as an inline style on the element below. #} in custom_header.twig). Resolve the effective color: default -> fontcolor,
defaultbackgroundcolor -> defaultbackgroundcolor, color1/2/3 ->
primary/secondary/tertiarycolor, other -> groupdescriptiontextcolorcustom. A raw
hex (legacy stored value) passes through directly; the legacy modes "primary"/
"secondary" of the old 4-way dropdown map to color1/color2. Emitted as an inline
style on the element below. #}
{% set sGroupDescTextColorMode = aSurveyInfo.options.groupdescriptiontextcolor|default('default') %} {% set sGroupDescTextColorMode = aSurveyInfo.options.groupdescriptiontextcolor|default('default') %}
{% set sGroupDescTextColor = sGroupDescTextColorMode == 'primary' ? aSurveyInfo.options.primarycolor|default('') : (sGroupDescTextColorMode == 'secondary' ? aSurveyInfo.options.secondarycolor|default('') : (sGroupDescTextColorMode == 'other' ? aSurveyInfo.options.groupdescriptiontextcolorcustom|default('') : aSurveyInfo.options.fontcolor|default(''))) %} {% set sGroupDescTextColor = sGroupDescTextColorMode matches '/^#[0-9a-fA-F]{3,8}$/' ? sGroupDescTextColorMode : ((sGroupDescTextColorMode == 'color1' or sGroupDescTextColorMode == 'primary') ? aSurveyInfo.options.primarycolor|default('') : ((sGroupDescTextColorMode == 'color2' or sGroupDescTextColorMode == 'secondary') ? aSurveyInfo.options.secondarycolor|default('') : (sGroupDescTextColorMode == 'color3' ? aSurveyInfo.options.tertiarycolor|default('') : (sGroupDescTextColorMode == 'defaultbackgroundcolor' ? aSurveyInfo.options.defaultbackgroundcolor|default('') : (sGroupDescTextColorMode == 'other' ? aSurveyInfo.options.groupdescriptiontextcolorcustom|default('') : aSurveyInfo.options.fontcolor|default('')))))) %}
{% if aGroup.showgroupinfo == 'D' or aGroup.showgroupinfo == 'B' %} {% if aGroup.showgroupinfo == 'D' or aGroup.showgroupinfo == 'B' %}
{% if aGroup.description != '' %} {% if aGroup.description != '' %}

View file

@ -22,11 +22,16 @@
{# THEME ADDITION: font for the group title (config.xml option "grouptitlefont", {# THEME ADDITION: font for the group title (config.xml option "grouptitlefont",
type fontselect). "base" = same as the base font: no extra class, inherits body font. #} type fontselect). "base" = same as the base font: no extra class, inherits body font. #}
{% set sGroupTitleFont = aSurveyInfo.options.grouptitlefont|default('base') %} {% set sGroupTitleFont = aSurveyInfo.options.grouptitlefont|default('base') %}
{# Prompt U: per-element text color — mode default -> fontcolor, primary -> {# Row 157: group title color is a color-chooser now (mode dropdown
primarycolor, secondary -> secondarycolor, other -> grouptitletextcolorcustom. default|defaultbackgroundcolor|color1|color2|color3|other, like navbarfontcolor
Emitted as an inline style on the element below. #} in custom_header.twig). Resolve the effective color: default -> fontcolor,
defaultbackgroundcolor -> defaultbackgroundcolor, color1/2/3 ->
primary/secondary/tertiarycolor, other -> grouptitletextcolorcustom. A raw hex
(legacy stored value) passes through directly; the legacy modes "primary"/
"secondary" of the old 4-way dropdown map to color1/color2. Emitted as an inline
style on the element below. #}
{% set sGroupTitleTextColorMode = aSurveyInfo.options.grouptitletextcolor|default('default') %} {% set sGroupTitleTextColorMode = aSurveyInfo.options.grouptitletextcolor|default('default') %}
{% set sGroupTitleTextColor = sGroupTitleTextColorMode == 'primary' ? aSurveyInfo.options.primarycolor|default('') : (sGroupTitleTextColorMode == 'secondary' ? aSurveyInfo.options.secondarycolor|default('') : (sGroupTitleTextColorMode == 'other' ? aSurveyInfo.options.grouptitletextcolorcustom|default('') : aSurveyInfo.options.fontcolor|default(''))) %} {% set sGroupTitleTextColor = sGroupTitleTextColorMode matches '/^#[0-9a-fA-F]{3,8}$/' ? sGroupTitleTextColorMode : ((sGroupTitleTextColorMode == 'color1' or sGroupTitleTextColorMode == 'primary') ? aSurveyInfo.options.primarycolor|default('') : ((sGroupTitleTextColorMode == 'color2' or sGroupTitleTextColorMode == 'secondary') ? aSurveyInfo.options.secondarycolor|default('') : (sGroupTitleTextColorMode == 'color3' ? aSurveyInfo.options.tertiarycolor|default('') : (sGroupTitleTextColorMode == 'defaultbackgroundcolor' ? aSurveyInfo.options.defaultbackgroundcolor|default('') : (sGroupTitleTextColorMode == 'other' ? aSurveyInfo.options.grouptitletextcolorcustom|default('') : aSurveyInfo.options.fontcolor|default('')))))) %}
{% if aGroup.showgroupinfo == 'N' or aGroup.showgroupinfo == 'B' %} {% if aGroup.showgroupinfo == 'N' or aGroup.showgroupinfo == 'B' %}
<div class="{{ aSurveyInfo.class.grouptitle }} text-center h3 space-col {% if sGroupTitleFont != 'base' %}font-{{ sGroupTitleFont }}{% endif %}" {% if sGroupTitleTextColor != '' %}style="color: {{ sGroupTitleTextColor }};"{% endif %} {{ aSurveyInfo.attr.grouptitle }}> <div class="{{ aSurveyInfo.class.grouptitle }} text-center h3 space-col {% if sGroupTitleFont != 'base' %}font-{{ sGroupTitleFont }}{% endif %}" {% if sGroupTitleTextColor != '' %}style="color: {{ sGroupTitleTextColor }};"{% endif %} {{ aSurveyInfo.attr.grouptitle }}>
{{ processString(aGroup.name, false, 3, {'GID': aGroup.gid}) }} {{ processString(aGroup.name, false, 3, {'GID': aGroup.gid}) }}