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:
parent
d6889067c0
commit
956324775b
2 changed files with 138 additions and 39 deletions
|
|
@ -25,9 +25,14 @@ var ThemeOptions = function () {
|
|||
// updateFieldSettings) can clobber optionObject, so the migration in colorModeUI
|
||||
// must use this snapshot.
|
||||
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
|
||||
// class selector_color_mode + swatch chips + a <key>custom colorpicker child)
|
||||
var aColorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor'];
|
||||
// class selector_color_mode + swatch chips + a <key>custom colorpicker child);
|
||||
// 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
|
||||
// (object key order = swatch chip order) — row 125: "Default background color"
|
||||
// is the SECOND choice, right after "Default font color".
|
||||
|
|
@ -847,6 +852,7 @@ var ThemeOptions = function () {
|
|||
colorModeRefreshers.push(refreshAll);
|
||||
// legacy migration: stored hex (pre-dropdown value) -> mode "other" + hex into the custom field
|
||||
var stored = legacyColorValues[key];
|
||||
var storedMode = legacyModeValues[key];
|
||||
if (typeof stored === 'string' && /^#[0-9a-fA-F]{3,8}$/.test(stored)) {
|
||||
sel.val('other');
|
||||
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
|
||||
updateAllChildren();
|
||||
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()) {
|
||||
// no (matching) stored value: fall back to the option's configured
|
||||
// default (row 125: every color-chooser option can pick its own default
|
||||
|
|
@ -946,6 +964,8 @@ var ThemeOptions = function () {
|
|||
var v = optionObject[k];
|
||||
if (typeof v === 'string' && /^#[0-9a-fA-F]{3,8}$/.test(v)) {
|
||||
legacyColorValues[k] = v;
|
||||
} else if (typeof v === 'string' && v !== '' && v !== 'inherit') {
|
||||
legacyModeValues[k] = v;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -46,7 +46,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 = '20261126.19' %}
|
||||
{% set OPTIONS_JS_TOKEN = '20261127.1' %}
|
||||
{{ unregisterScriptFile(optionsPath ~ '/options.js') }}
|
||||
{{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }}
|
||||
|
||||
|
|
@ -262,7 +262,7 @@
|
|||
|
||||
{% 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' } %}
|
||||
{% 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
|
||||
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 = [
|
||||
'grouptitlefont', 'grouptitletextcolor', 'grouptitletextcolorcustom',
|
||||
'groupdescriptionfont', 'groupdescriptiontextcolor', 'groupdescriptiontextcolorcustom',
|
||||
'grouptitlefontsize', 'grouptitlefontweight',
|
||||
'groupdescriptionfontsize', 'groupdescriptionfontweight'
|
||||
'grouptitlefont', 'grouptitletextcolor', 'grouptitletextcolorcustom', 'grouptitlefontsize', 'grouptitlefontoptions',
|
||||
'groupdescriptionfont', 'groupdescriptiontextcolor', 'groupdescriptiontextcolorcustom', 'groupdescriptionfontsize', 'groupdescriptionfontoptions'
|
||||
] %}
|
||||
{% 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
|
||||
per-element font overrides live), then the "Top of the page" tab (keys =
|
||||
|
|
@ -319,9 +321,9 @@
|
|||
{% if aImagesKeys is not empty %}
|
||||
{% set aTabs = aTabs|merge([{ 'id': 'category-images', 'label': 'Page background', 'category': 'Images', 'keys': aImagesPaneKeys }]) %}
|
||||
{% 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
|
||||
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 }]) %}
|
||||
{% for category in aOptionAttributes.categories %}
|
||||
{% 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>
|
||||
</div></div>
|
||||
{% 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">
|
||||
{% set qLastCol = 0 %}
|
||||
{% set fLastSlot = 0 %}
|
||||
|
|
@ -428,6 +437,7 @@
|
|||
{% set bFontsPane = tab.category == 'Fonts' %}
|
||||
{% set bTopPane = tab.id == 'top-of-page' %}
|
||||
{% set bImagesPane = tab.category == 'Images' %}
|
||||
{% set bGroupsPane = tab.id == 'groups' %}
|
||||
{% set fSlot = 'rest' %}
|
||||
{% if bFontsPane %}
|
||||
{% if key == 'font' %}{% set fSlot = 'f1' %}
|
||||
|
|
@ -472,8 +482,14 @@
|
|||
{% if key in ['bodybackgroundcolor', 'bodybackgroundcolorcustom', 'backgroundimage'] %}{% set fSlot = 'bg1' %}
|
||||
{% elseif key in ['backgroundimagefile', 'backgroundimagefixed', 'backgroundimagedisplay'] %}{% set fSlot = 'bg2' %}
|
||||
{% 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 %}
|
||||
{% if fSlot != fLastSlot and (bFontsPane or bTopPane or bImagesPane) %}
|
||||
{% if fSlot != fLastSlot and (bFontsPane or bTopPane or bImagesPane or bGroupsPane) %}
|
||||
{% 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">
|
||||
{% elseif fLastSlot == 'f1' or fLastSlot == 'f2' %}</div><div class="col-md-4">
|
||||
|
|
@ -504,6 +520,11 @@
|
|||
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 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 %}
|
||||
{% set fLastSlot = fSlot %}
|
||||
{% endif %}
|
||||
|
|
@ -620,7 +641,7 @@
|
|||
{% set qLastCol = qCol %}
|
||||
{% 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) #}
|
||||
{% 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
|
||||
|
|
@ -855,6 +876,9 @@
|
|||
{% endif %}
|
||||
{% 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
|
||||
(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 %}
|
||||
|
|
|
|||
Loading…
Reference in a new issue