feat(options): roll the color-chooser scheme out to 4 more options (row 135)
The experimental color-chooser (mode dropdown + swatch chips + custom picker, previously only navbarfontcolor) now also covers, with the owner-specified defaults: - headerbackgroundcolor — default "Default background color" (slot h1) - progressbarcolor — COLUMN 1 of the progress colors row (was col 2), default Color 1 - progressbarbackgroundcolor — COLUMN 2 (was col 1), default Default background color - progressbarfontcolor — column 3, default Default font color, with an extra tip underneath: "Make this font color the same color as the color of the progress bar when you do not want to see the progress in %." Each option is a dropdown (default|defaultbackgroundcolor|color1|color2|color3| other) whose own default carries data-default="1" + [ ] in config.xml, plus a <key>custom colorpicker child (parent, disable-mode, data-keep-value). options.js generalized navbarColorModeUI to colorModeUI(key) over aColorChooserKeys with shared presets, one delegated change handler for select.selector_color_mode, and per-key legacy hex migration (stored hex -> mode "other" + hex into the custom child). custom_header.twig resolves the modes via a local cm() macro (import _self, same pattern as nav_bar.twig); raw hex passes through. build.php migrates legacy hex values in variant jsons for all 5 chooser keys. OPTIONS_JS_TOKEN -> 20261126.14. Verified: render tc=618 (all 5 selects with per-option [ ] default, progress row col order, tip present, divs balanced, options.js?v=20261126.14), jsdom 7/7 incl. new options_color_choosers.test.js (5 choosers, legacy migration, chips, layout, tip) and the navbar test re-scoped to its own chips; live survey 282267 with legacy hex AND with modes (color2 -> #888888, defaultbackgroundcolor -> #ffffff; DB row restored); export exit 0; build.php lints. Variants not rebuilt (deferred). Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
57c7009ec2
commit
cfbb4c983b
5 changed files with 184 additions and 63 deletions
61
config.xml
61
config.xml
|
|
@ -205,8 +205,27 @@
|
||||||
<!-- Various colors -->
|
<!-- Various colors -->
|
||||||
<!-- Backgrounds of navbar/page stay plain colorpickers (owner decision
|
<!-- Backgrounds of navbar/page stay plain colorpickers (owner decision
|
||||||
2026-11-26, row 115): they are mostly NOT one of the default colors,
|
2026-11-26, row 115): they are mostly NOT one of the default colors,
|
||||||
default white #ffffff. -->
|
default white #ffffff. EXCEPTION (row 135): the HEADER background color
|
||||||
<headerbackgroundcolor type="colorpicker" category="Colors" width="12" title="Header background color" options="on|off" optionlabels="Yes|No">#ffffff</headerbackgroundcolor>
|
is part of the color-chooser scheme below — default "Default background
|
||||||
|
color". -->
|
||||||
|
<!-- Row 135: the color-chooser scheme (mode dropdown + swatch chips + custom
|
||||||
|
picker; see navbarfontcolor) rolled out to four more options. Defaults per
|
||||||
|
owner (row 135): header background = Default background color, progress
|
||||||
|
bar color = Color 1, progress background = Default background color,
|
||||||
|
progress font color = Default font color. The <option data-default="1">
|
||||||
|
carries the [ ] marker of that option's own default. A legacy stored HEX
|
||||||
|
value migrates client-side to mode "other" + hex into the <key>custom
|
||||||
|
child (options.js colorModeUI), and the views accept a raw hex directly. -->
|
||||||
|
<headerbackgroundcolor type="dropdown" category="Colors" width="12" title="Header background color" options="default|defaultbackgroundcolor|color1|color2|color3|other" optionlabels="Default font color|Default background color|Color 1|Color 2|Color 3|Other ...">defaultbackgroundcolor
|
||||||
|
<dropdownoptions>
|
||||||
|
<option value="default">Default font color</option>
|
||||||
|
<option value="defaultbackgroundcolor" data-default="1">[Default background color]</option>
|
||||||
|
<option value="color1">Color 1</option>
|
||||||
|
<option value="color2">Color 2</option>
|
||||||
|
<option value="color3">Color 3</option>
|
||||||
|
<option value="other">Other ...</option>
|
||||||
|
</dropdownoptions></headerbackgroundcolor>
|
||||||
|
<headerbackgroundcolorcustom type="colorpicker" category="Colors" width="12" title="Custom header background color (used when 'Other ...' is chosen)" parent="headerbackgroundcolor">#ffffff</headerbackgroundcolorcustom>
|
||||||
<!-- Working example (row 115, reordered + relabelled row 125): menu item color
|
<!-- Working example (row 115, reordered + relabelled row 125): menu item color
|
||||||
as a preset dropdown. The KEY navbarfontcolor is kept (stored DB values
|
as a preset dropdown. The KEY navbarfontcolor is kept (stored DB values
|
||||||
stay attached); the type changes colorpicker -> dropdown with modes
|
stay attached); the type changes colorpicker -> dropdown with modes
|
||||||
|
|
@ -242,9 +261,41 @@
|
||||||
</dropdownoptions></navbarfontcolor>
|
</dropdownoptions></navbarfontcolor>
|
||||||
<navbarfontcolorcustom type="colorpicker" category="Colors" width="12" title="Custom menu item color (used when 'Other ...' is chosen)" parent="navbarfontcolor">#444444</navbarfontcolorcustom>
|
<navbarfontcolorcustom type="colorpicker" category="Colors" width="12" title="Custom menu item color (used when 'Other ...' is chosen)" parent="navbarfontcolor">#444444</navbarfontcolorcustom>
|
||||||
<sliderhandlecolor type="colorpicker" category="Colors" width="12" title="Slider handle color" options="on|off" optionlabels="Yes|No">#5e1c64</sliderhandlecolor>
|
<sliderhandlecolor type="colorpicker" category="Colors" width="12" title="Slider handle color" options="on|off" optionlabels="Yes|No">#5e1c64</sliderhandlecolor>
|
||||||
<progressbarbackgroundcolor type="colorpicker" category="Colors" width="12" title="Progress bar background color" options="on|off" optionlabels="Yes|No">#eeeeee</progressbarbackgroundcolor>
|
<!-- Row 135: progress bar colors as color-choosers. Layout in the "Top of the
|
||||||
<progressbarcolor type="colorpicker" category="Colors" width="12" title="Progress bar color" options="on|off" optionlabels="Yes|No">#5e1c64</progressbarcolor>
|
page" tab (options.twig slots): progress bar color = COLUMN 1, progress
|
||||||
<progressbarfontcolor type="colorpicker" category="Colors" width="12" title="Progress bar font color" options="on|off" optionlabels="Yes|No">#ffffff</progressbarfontcolor>
|
background = COLUMN 2, progress font color = COLUMN 3 (with an extra tip
|
||||||
|
underneath). Defaults: progress bar color = Color 1, progress background =
|
||||||
|
Default background color, progress font color = Default font color. -->
|
||||||
|
<progressbarcolor type="dropdown" category="Colors" width="12" title="Progress bar color" options="default|defaultbackgroundcolor|color1|color2|color3|other" optionlabels="Default font color|Default background color|Color 1|Color 2|Color 3|Other ...">color1
|
||||||
|
<dropdownoptions>
|
||||||
|
<option value="default">Default font color</option>
|
||||||
|
<option value="defaultbackgroundcolor">Default background color</option>
|
||||||
|
<option value="color1" data-default="1">[Color 1]</option>
|
||||||
|
<option value="color2">Color 2</option>
|
||||||
|
<option value="color3">Color 3</option>
|
||||||
|
<option value="other">Other ...</option>
|
||||||
|
</dropdownoptions></progressbarcolor>
|
||||||
|
<progressbarcolorcustom type="colorpicker" category="Colors" width="12" title="Custom progress bar color (used when 'Other ...' is chosen)" parent="progressbarcolor">#5e1c64</progressbarcolorcustom>
|
||||||
|
<progressbarbackgroundcolor type="dropdown" category="Colors" width="12" title="Progress bar background color" options="default|defaultbackgroundcolor|color1|color2|color3|other" optionlabels="Default font color|Default background color|Color 1|Color 2|Color 3|Other ...">defaultbackgroundcolor
|
||||||
|
<dropdownoptions>
|
||||||
|
<option value="default">Default font color</option>
|
||||||
|
<option value="defaultbackgroundcolor" data-default="1">[Default background color]</option>
|
||||||
|
<option value="color1">Color 1</option>
|
||||||
|
<option value="color2">Color 2</option>
|
||||||
|
<option value="color3">Color 3</option>
|
||||||
|
<option value="other">Other ...</option>
|
||||||
|
</dropdownoptions></progressbarbackgroundcolor>
|
||||||
|
<progressbarbackgroundcolorcustom type="colorpicker" category="Colors" width="12" title="Custom progress bar background color (used when 'Other ...' is chosen)" parent="progressbarbackgroundcolor">#eeeeee</progressbarbackgroundcolorcustom>
|
||||||
|
<progressbarfontcolor type="dropdown" category="Colors" width="12" title="Progress bar font color" options="default|defaultbackgroundcolor|color1|color2|color3|other" optionlabels="Default font color|Default background color|Color 1|Color 2|Color 3|Other ...">default
|
||||||
|
<dropdownoptions>
|
||||||
|
<option value="default" data-default="1">[Default font color]</option>
|
||||||
|
<option value="defaultbackgroundcolor">Default background color</option>
|
||||||
|
<option value="color1">Color 1</option>
|
||||||
|
<option value="color2">Color 2</option>
|
||||||
|
<option value="color3">Color 3</option>
|
||||||
|
<option value="other">Other ...</option>
|
||||||
|
</dropdownoptions></progressbarfontcolor>
|
||||||
|
<progressbarfontcolorcustom type="colorpicker" category="Colors" width="12" title="Custom progress bar font color (used when 'Other ...' is chosen)" parent="progressbarfontcolor">#ffffff</progressbarfontcolorcustom>
|
||||||
<privacybackgroundcolor type="colorpicker" category="Colors" width="12" title="Privacy background color" options="on|off" optionlabels="Yes|No">lightyellow</privacybackgroundcolor>
|
<privacybackgroundcolor type="colorpicker" category="Colors" width="12" title="Privacy background color" options="on|off" optionlabels="Yes|No">lightyellow</privacybackgroundcolor>
|
||||||
<!-- fonts
|
<!-- fonts
|
||||||
HOUSE-STYLE: the whole Fonts section (font choice, fontsize and all
|
HOUSE-STYLE: the whole Fonts section (font choice, fontsize and all
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,21 @@ var ThemeOptions = function () {
|
||||||
"general_inherit": 1
|
"general_inherit": 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// THEME ADDITION (row 115): legacy hex value of navbarfontcolor, captured right
|
// THEME ADDITION (row 115, generalized row 135): legacy hex values of the
|
||||||
// after parseOptionObject — later startup steps (prepareSelectField val() with a
|
// color-chooser options, captured right after parseOptionObject — later startup
|
||||||
// non-matching value, then updateFieldSettings) can clobber optionObject, so the
|
// steps (prepareSelectField val() with a non-matching value, then
|
||||||
// migration in navbarColorModeUI must use this snapshot.
|
// updateFieldSettings) can clobber optionObject, so the migration in colorModeUI
|
||||||
var legacyNavbarFontColor = null;
|
// must use this snapshot.
|
||||||
|
var legacyColorValues = {};
|
||||||
|
// 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'];
|
||||||
|
// 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".
|
||||||
|
var colorPresets = { 'default': 'fontcolor', 'defaultbackgroundcolor': 'defaultbackgroundcolor', 'color1': 'primarycolor', 'color2': 'secondarycolor', 'color3': 'tertiarycolor' };
|
||||||
|
// one refreshAll per chooser, called by the shared delegated handlers
|
||||||
|
var colorModeRefreshers = [];
|
||||||
|
|
||||||
// THEME FIX: on the GLOBAL theme-options page the hidden #optionCssFiles can
|
// THEME FIX: on the GLOBAL theme-options page the hidden #optionCssFiles can
|
||||||
// hold the literal string "inherit" (not JSON) — an unguarded JSON.parse then
|
// hold the literal string "inherit" (not JSON) — an unguarded JSON.parse then
|
||||||
|
|
@ -735,25 +745,21 @@ var ThemeOptions = function () {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// THEME ADDITION (row 115, working example on navbarfontcolor only): preset-dropdown
|
// THEME ADDITION (row 115 on navbarfontcolor, generalized row 135 to every key in
|
||||||
// UI for the "Menu item color in header" option.
|
// aColorChooserKeys): preset-dropdown UI for a color-chooser option.
|
||||||
// - option labels of the navbarfontcolor dropdown get the LIVE hex of the preset
|
// - option labels of the dropdown get the LIVE hex of the preset they point at
|
||||||
// they point at ("Color 1 [#5e1c64]" — values read from the stored options JSON /
|
// ("Color 1 [#5e1c64]" — values read from the stored options JSON /
|
||||||
// the fields' data-inheritvalue, so they also work at survey level with inherit)
|
// the fields' data-inheritvalue, so they also work at survey level with inherit)
|
||||||
// - clickable swatch chips next to the dropdown (one per preset; click = choose it)
|
// - clickable swatch chips next to the dropdown (one per preset; click = choose it)
|
||||||
// - an "effective color" swatch appended to the custom picker's input group, showing
|
// - an "effective color" swatch appended to the custom picker's input group, showing
|
||||||
// the color that is actually applied for the current mode (overwritable by picking
|
// the color that is actually applied for the current mode (overwritable by picking
|
||||||
// another color when mode is "other")
|
// another color when mode is "other")
|
||||||
// - legacy migration: a stored HEX value of navbarfontcolor (from before the option
|
// - legacy migration: a stored HEX value (from before the option became a
|
||||||
// became a dropdown) selects mode "other" and moves the hex into navbarfontcolorcustom
|
// dropdown) selects mode "other" and moves the hex into the <key>custom child
|
||||||
var navbarColorModeUI = function () {
|
var colorModeUI = function (key) {
|
||||||
var sel = globalForm.find('select[name="navbarfontcolor"]');
|
var sel = globalForm.find('select[name="' + key + '"]');
|
||||||
if (!sel.length) { return; }
|
if (!sel.length) { return; }
|
||||||
// row 124/125: 5 presets, in the SAME order as the dropdown options in
|
var presets = colorPresets;
|
||||||
// config.xml (object key order = swatch chip order) — row 125: the
|
|
||||||
// "Default background color" is the SECOND choice, right after "Same as
|
|
||||||
// default font color".
|
|
||||||
var presets = { 'default': 'fontcolor', 'defaultbackgroundcolor': 'defaultbackgroundcolor', 'color1': 'primarycolor', 'color2': 'secondarycolor', 'color3': 'tertiarycolor' };
|
|
||||||
// row 126/134: the option's DEFAULT choice — the config.xml <option data-default="1">
|
// row 126/134: the option's DEFAULT choice — the config.xml <option data-default="1">
|
||||||
// (same value as the <default> element text). In the dropdown LIST it is
|
// (same value as the <default> element text). In the dropdown LIST it is
|
||||||
// enclosed in [ ] (bolding <option> is not rendered by every browser — row 134);
|
// enclosed in [ ] (bolding <option> is not rendered by every browser — row 134);
|
||||||
|
|
@ -764,9 +770,10 @@ var ThemeOptions = function () {
|
||||||
|| sel.data('inheritvalue')
|
|| sel.data('inheritvalue')
|
||||||
|| sel.find('option').not('[value="inherit"]').first().attr('value')
|
|| sel.find('option').not('[value="inherit"]').first().attr('value')
|
||||||
|| '');
|
|| '');
|
||||||
var customInput = globalForm.find('input[name="navbarfontcolorcustom"]');
|
var customInput = globalForm.find('input[name="' + key + 'custom"]');
|
||||||
var currentColor = function (key) {
|
var rowLabel = String(sel.closest('.mb-3').find('.form-label').first().text() || key);
|
||||||
var f = globalForm.find('#simple_edit_options_' + key);
|
var currentColor = function (ckey) {
|
||||||
|
var f = globalForm.find('#simple_edit_options_' + ckey);
|
||||||
var v = f.val();
|
var v = f.val();
|
||||||
if (!v) { v = f.data('inheritvalue'); }
|
if (!v) { v = f.data('inheritvalue'); }
|
||||||
return v ? String(v) : '';
|
return v ? String(v) : '';
|
||||||
|
|
@ -850,11 +857,12 @@ var ThemeOptions = function () {
|
||||||
}
|
}
|
||||||
var c = effectiveColor();
|
var c = effectiveColor();
|
||||||
sw.css('background', c || 'transparent');
|
sw.css('background', c || 'transparent');
|
||||||
sw.attr('title', c ? 'Effective menu item color: ' + c : 'Effective menu item color: (none)');
|
sw.attr('title', c ? 'Effective color (' + rowLabel + '): ' + c : 'Effective color (' + rowLabel + '): (none)');
|
||||||
};
|
};
|
||||||
var refreshAll = function () { refreshLabels(); refreshChips(); refreshEffective(); };
|
var refreshAll = function () { refreshLabels(); refreshChips(); refreshEffective(); };
|
||||||
|
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 = legacyNavbarFontColor;
|
var stored = legacyColorValues[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() || ''))) {
|
||||||
|
|
@ -876,13 +884,22 @@ var ThemeOptions = function () {
|
||||||
}
|
}
|
||||||
refreshAll();
|
refreshAll();
|
||||||
sel.on('change', refreshAll);
|
sel.on('change', refreshAll);
|
||||||
// Delegated backup: a REAL user change event bubbles natively to document even
|
|
||||||
// when an earlier direct handler threw (jQuery only aborts synthetic triggers),
|
|
||||||
// so the active outline still moves on the chosen swatch (row 122).
|
|
||||||
$(document).on('change', 'select[name="navbarfontcolor"]', refreshAll);
|
|
||||||
if (customInput.length) { customInput.on('input change', refreshAll); }
|
if (customInput.length) { customInput.on('input change', refreshAll); }
|
||||||
$.each(['fontcolor', 'primarycolor', 'secondarycolor', 'tertiarycolor', 'defaultbackgroundcolor'], function (i, key) {
|
};
|
||||||
globalForm.find('#simple_edit_options_' + key).on('input change', refreshAll);
|
|
||||||
|
// Shared delegated handlers for ALL chooser dropdowns (row 122/135): a REAL user
|
||||||
|
// change event bubbles natively to document even when an earlier direct handler
|
||||||
|
// threw (jQuery only aborts synthetic triggers), so the active outline still moves
|
||||||
|
// on the chosen swatch. Bound once, calling every chooser's refreshAll.
|
||||||
|
var bindColorModeDelegates = function () {
|
||||||
|
$(document).on('change', 'select.selector_color_mode', function () {
|
||||||
|
$.each(colorModeRefreshers, function (i, fn) { try { fn(); } catch (e) { /* keep the others running */ } });
|
||||||
|
});
|
||||||
|
// live hex labels/chips update when one of the shared color fields changes
|
||||||
|
$.each(['fontcolor', 'primarycolor', 'secondarycolor', 'tertiarycolor', 'defaultbackgroundcolor'], function (i, ckey) {
|
||||||
|
globalForm.find('#simple_edit_options_' + ckey).on('input change', function () {
|
||||||
|
$.each(colorModeRefreshers, function (j, fn) { try { fn(); } catch (e) { /* ignore */ } });
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -906,13 +923,16 @@ var ThemeOptions = function () {
|
||||||
var run = function () {
|
var run = function () {
|
||||||
safeStep('parseOptionObject', parseOptionObject);
|
safeStep('parseOptionObject', parseOptionObject);
|
||||||
|
|
||||||
// THEME ADDITION (row 115): snapshot a legacy hex navbarfontcolor before other
|
// THEME ADDITION (row 115, generalized row 135): snapshot a legacy hex value of
|
||||||
// startup steps can clobber optionObject (prepareSelectField + updateFieldSettings)
|
// every color-chooser option before other startup steps can clobber
|
||||||
safeStep('captureNavbarLegacy', function () {
|
// optionObject (prepareSelectField + updateFieldSettings)
|
||||||
var v = optionObject['navbarfontcolor'];
|
safeStep('captureLegacyColorValues', function () {
|
||||||
if (typeof v === 'string' && /^#[0-9a-fA-F]{3,8}$/.test(v)) {
|
$.each(aColorChooserKeys, function (i, k) {
|
||||||
legacyNavbarFontColor = v;
|
var v = optionObject[k];
|
||||||
}
|
if (typeof v === 'string' && /^#[0-9a-fA-F]{3,8}$/.test(v)) {
|
||||||
|
legacyColorValues[k] = v;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
safeStep('startupGeneralInherit', startupGeneralInherit);
|
safeStep('startupGeneralInherit', startupGeneralInherit);
|
||||||
|
|
@ -937,11 +957,15 @@ var ThemeOptions = function () {
|
||||||
// THEME ADDITION: set initial visibility of conditional fields
|
// THEME ADDITION: set initial visibility of conditional fields
|
||||||
safeStep('updateVisibilityByParent', updateVisibilityByParent);
|
safeStep('updateVisibilityByParent', updateVisibilityByParent);
|
||||||
|
|
||||||
// THEME ADDITION (row 115): preset-dropdown UI for navbarfontcolor (labels,
|
// THEME ADDITION (row 115, generalized row 135): preset-dropdown UI for every
|
||||||
// swatch chips, effective-color swatch, legacy hex migration) — AFTER
|
// color-chooser option (labels with live hex, swatch chips, effective-color
|
||||||
// parseOptionObject (needs the stored optionObject) and AFTER
|
// swatch, legacy hex migration) — AFTER parseOptionObject (needs the stored
|
||||||
// updateAllChildren/updateVisibilityByParent (mode "other" enables the child)
|
// optionObject) and AFTER updateAllChildren/updateVisibilityByParent
|
||||||
safeStep('navbarColorModeUI', navbarColorModeUI);
|
// (mode "other" enables the child)
|
||||||
|
$.each(aColorChooserKeys, function (i, k) {
|
||||||
|
safeStep('colorModeUI:' + k, function () { colorModeUI(k); });
|
||||||
|
});
|
||||||
|
safeStep('bindColorModeDelegates', bindColorModeDelegates);
|
||||||
|
|
||||||
// THEME ADDITION (row 133): restore the options tab the user was on before
|
// THEME ADDITION (row 133): restore the options tab the user was on before
|
||||||
// Save (after a save the page reloads on the first tab)
|
// Save (after a save the page reloads on the first tab)
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,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.13' %}
|
{% set OPTIONS_JS_TOKEN = '20261126.14' %}
|
||||||
{{ 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') }}
|
||||||
|
|
||||||
|
|
@ -224,12 +224,13 @@
|
||||||
Values are stored per option key, so moving them here does not change any stored
|
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. #}
|
value. The order of this list is the order shown in the tab. #}
|
||||||
{% set aTopOfPageKeys = [
|
{% set aTopOfPageKeys = [
|
||||||
'headerbackgroundcolor', 'headerfont', 'navbarfontcolor', 'navbarfontcolorcustom',
|
'headerbackgroundcolor', 'headerbackgroundcolorcustom', 'headerfont', 'navbarfontcolor', 'navbarfontcolorcustom',
|
||||||
'headersticky', 'headerstickycomputer', 'headerstickytablet', 'headerstickymobile',
|
'headersticky', 'headerstickycomputer', 'headerstickytablet', 'headerstickymobile',
|
||||||
'brandlogofile', 'brandlogotopmargin', 'brandshowoncomputer', 'brandshowontablet', 'brandshowonmobile',
|
'brandlogofile', 'brandlogotopmargin', 'brandshowoncomputer', 'brandshowontablet', 'brandshowonmobile',
|
||||||
'centerlogofile', 'centerlogotopmargin', 'centershowoncomputer', 'centershowontablet', 'centershowonmobile',
|
'centerlogofile', 'centerlogotopmargin', 'centershowoncomputer', 'centershowontablet', 'centershowonmobile',
|
||||||
'rightlogofile', 'rightlogotopmargin', 'rightshowoncomputer', 'rightshowontablet', 'rightshowonmobile',
|
'rightlogofile', 'rightlogotopmargin', 'rightshowoncomputer', 'rightshowontablet', 'rightshowonmobile',
|
||||||
'progressbarposition', 'progressbarfont', 'progressbarbackgroundcolor', 'progressbarcolor', 'progressbarfontcolor'
|
'progressbarposition', 'progressbarfont', 'progressbarcolor', 'progressbarcolorcustom',
|
||||||
|
'progressbarbackgroundcolor', 'progressbarbackgroundcolorcustom', 'progressbarfontcolor', 'progressbarfontcolorcustom'
|
||||||
] %}
|
] %}
|
||||||
{% set aLogoKeys = [
|
{% set aLogoKeys = [
|
||||||
'brandlogofile', 'brandlogotopmargin', 'brandshowoncomputer', 'brandshowontablet', 'brandshowonmobile',
|
'brandlogofile', 'brandlogotopmargin', 'brandshowoncomputer', 'brandshowontablet', 'brandshowonmobile',
|
||||||
|
|
@ -244,8 +245,11 @@
|
||||||
|
|
||||||
{% set aFontElements = ['questiontitle', 'answers', 'grouptitle', 'groupdescription', 'buttons'] %}
|
{% set aFontElements = ['questiontitle', 'answers', 'grouptitle', 'groupdescription', 'buttons'] %}
|
||||||
|
|
||||||
|
{% set aColorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor'] %}
|
||||||
|
|
||||||
{% 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 %}
|
||||||
|
{% for ck in aColorChooserKeys %}{% set aShowIfValues = aShowIfValues|merge({ (ck): 'other' }) %}{% endfor %}
|
||||||
|
|
||||||
{# How a parented option behaves when the parent's value is NOT in the show-values:
|
{# How a parented option behaves when the parent's value is NOT in the show-values:
|
||||||
default 'hide' = wrapper gets d-none; 'disable' = wrapper STAYS VISIBLE but the
|
default 'hide' = wrapper gets d-none; 'disable' = wrapper STAYS VISIBLE but the
|
||||||
|
|
@ -253,6 +257,7 @@
|
||||||
options.js keeps its stored value across saves. Working example: navbarfontcolor
|
options.js keeps its stored value across saves. Working example: navbarfontcolor
|
||||||
(row 115) — the custom color picker stays visible next to the mode dropdown. #}
|
(row 115) — the custom color picker stays visible next to the mode dropdown. #}
|
||||||
{% set aShowIfMode = { 'navbarfontcolor': 'disable' } %}
|
{% set aShowIfMode = { 'navbarfontcolor': 'disable' } %}
|
||||||
|
{% for ck in aColorChooserKeys %}{% set aShowIfMode = aShowIfMode|merge({ (ck): 'disable' }) %}{% endfor %}
|
||||||
|
|
||||||
{% set aFontsRow1 = ['font', 'fontcolor', 'fontsize'] %}
|
{% set aFontsRow1 = ['font', 'fontcolor', 'fontsize'] %}
|
||||||
{% set aFontsRow2 = ['primarycolor', 'secondarycolor', 'tertiarycolor'] %}
|
{% set aFontsRow2 = ['primarycolor', 'secondarycolor', 'tertiarycolor'] %}
|
||||||
|
|
@ -366,15 +371,22 @@
|
||||||
{% elseif bTopPane %}
|
{% elseif bTopPane %}
|
||||||
{% if key in aLogoKeys %}{% set fSlot = 'logo' %}
|
{% if key in aLogoKeys %}{% set fSlot = 'logo' %}
|
||||||
{% elseif key == 'headerbackgroundcolor' %}{% set fSlot = 'h1' %}
|
{% elseif key == 'headerbackgroundcolor' %}{% set fSlot = 'h1' %}
|
||||||
|
{% elseif key == 'headerbackgroundcolorcustom' %}{% set fSlot = 'h1' %}
|
||||||
{% elseif key == 'headerfont' %}{% set fSlot = 'hf' %}
|
{% elseif key == 'headerfont' %}{% set fSlot = 'hf' %}
|
||||||
{% elseif key == 'navbarfontcolor' %}{% set fSlot = 'h2' %}
|
{% elseif key == 'navbarfontcolor' %}{% set fSlot = 'h2' %}
|
||||||
{% elseif key == 'navbarfontcolorcustom' %}{% set fSlot = 'h2' %}
|
{% elseif key == 'navbarfontcolorcustom' %}{% set fSlot = 'h2' %}
|
||||||
{% elseif key in aTopStickyKeys %}{% set fSlot = 'h3' %}
|
{% elseif key in aTopStickyKeys %}{% set fSlot = 'h3' %}
|
||||||
{% elseif key == 'progressbarposition' %}{% set fSlot = 'ppos' %}
|
{% elseif key == 'progressbarposition' %}{% set fSlot = 'ppos' %}
|
||||||
{% elseif key == 'progressbarfont' %}{% set fSlot = 'pfont' %}
|
{% elseif key == 'progressbarfont' %}{% set fSlot = 'pfont' %}
|
||||||
{% elseif key == 'progressbarbackgroundcolor' %}{% set fSlot = 'pcol1' %}
|
{# row 135: progress bar colors row — col 1 = progress bar color,
|
||||||
{% elseif key == 'progressbarcolor' %}{% set fSlot = 'pcol2' %}
|
col 2 = progress background, col 3 = progress font color
|
||||||
|
(custom children share their parent's column) #}
|
||||||
|
{% elseif key == 'progressbarcolor' %}{% set fSlot = 'pcol1' %}
|
||||||
|
{% elseif key == 'progressbarcolorcustom' %}{% set fSlot = 'pcol1' %}
|
||||||
|
{% elseif key == 'progressbarbackgroundcolor' %}{% set fSlot = 'pcol2' %}
|
||||||
|
{% elseif key == 'progressbarbackgroundcolorcustom' %}{% set fSlot = 'pcol2' %}
|
||||||
{% elseif key == 'progressbarfontcolor' %}{% set fSlot = 'pcol3' %}
|
{% elseif key == 'progressbarfontcolor' %}{% set fSlot = 'pcol3' %}
|
||||||
|
{% elseif key == 'progressbarfontcolorcustom' %}{% set fSlot = 'pcol3' %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if fSlot != fLastSlot and (bFontsPane or bTopPane) %}
|
{% if fSlot != fLastSlot and (bFontsPane or bTopPane) %}
|
||||||
|
|
@ -559,6 +571,7 @@
|
||||||
{% if attr.parent != '' %}{% set ddClasses = ddClasses ~ ' selector_radio_childfield' %}{% endif %}
|
{% if attr.parent != '' %}{% set ddClasses = ddClasses ~ ' selector_radio_childfield' %}{% endif %}
|
||||||
{% if tab.category == 'Images' %}{% set ddClasses = ddClasses ~ ' selector_image_selector' %}{% endif %}
|
{% if tab.category == 'Images' %}{% set ddClasses = ddClasses ~ ' selector_image_selector' %}{% endif %}
|
||||||
{% if key == 'font' %}{% set ddClasses = ddClasses ~ ' selector_fontselect' %}{% endif %}
|
{% if key == 'font' %}{% set ddClasses = ddClasses ~ ' selector_fontselect' %}{% endif %}
|
||||||
|
{% if key in aColorChooserKeys %}{% set ddClasses = ddClasses ~ ' selector_color_mode' %}{% endif %}
|
||||||
<select class="{{ ddClasses }}"
|
<select class="{{ ddClasses }}"
|
||||||
{% if attr.parent != '' %}data-parent="{{ attr.parent }}"{% endif %}
|
{% if attr.parent != '' %}data-parent="{{ attr.parent }}"{% endif %}
|
||||||
data-inheritvalue="{{ oParentOptions[key] }}"
|
data-inheritvalue="{{ oParentOptions[key] }}"
|
||||||
|
|
@ -642,6 +655,12 @@
|
||||||
id="simple_edit_options_{{ key }}" name="{{ key }}"
|
id="simple_edit_options_{{ key }}" name="{{ key }}"
|
||||||
title="{{ gT("Inherited value:") }} {{ oParentOptions[key] }}"/>
|
title="{{ gT("Inherited value:") }} {{ oParentOptions[key] }}"/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{# row 135: extra tip underneath the whole "Progress bar font color"
|
||||||
|
option (attached to its custom child, which renders last in the
|
||||||
|
same column, so the tip sits at the bottom of the option) #}
|
||||||
|
{% if key == 'progressbarfontcolorcustom' %}
|
||||||
|
<div class="form-text mt-1">{{ gT("Make this font color the same color as the color of the progress bar when you do not want to see the progress in %.") }}</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -268,15 +268,20 @@ foreach ($logoPositions as $pos) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Row 115 migration: navbarfontcolor became a mode dropdown (default|color1|
|
// --- Row 115/135 migration: the color-chooser options (navbarfontcolor,
|
||||||
// color2|color3|other) with a navbarfontcolorcustom colorpicker child. A legacy HEX
|
// headerbackgroundcolor, progressbarcolor, progressbarbackgroundcolor,
|
||||||
|
// progressbarfontcolor) became mode dropdowns (default|defaultbackgroundcolor|
|
||||||
|
// 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 navbarfontcolorcustom, so the variant default stays valid for the dropdown.
|
// into the <key>custom child, so the variant default stays valid for the dropdown.
|
||||||
if (isset($definition['options']['navbarfontcolor'])
|
$colorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor'];
|
||||||
&& is_string($definition['options']['navbarfontcolor'])
|
foreach ($colorChooserKeys as $ck) {
|
||||||
&& preg_match('/^#[0-9a-fA-F]{3,8}$/', $definition['options']['navbarfontcolor'])) {
|
if (isset($definition['options'][$ck])
|
||||||
$definition['options']['navbarfontcolorcustom'] = $definition['options']['navbarfontcolor'];
|
&& is_string($definition['options'][$ck])
|
||||||
$definition['options']['navbarfontcolor'] = 'other';
|
&& preg_match('/^#[0-9a-fA-F]{3,8}$/', $definition['options'][$ck])) {
|
||||||
|
$definition['options'][$ck . 'custom'] = $definition['options'][$ck];
|
||||||
|
$definition['options'][$ck] = 'other';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$optionsNode = $xpath->query('//options')->item(0);
|
$optionsNode = $xpath->query('//options')->item(0);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,18 @@
|
||||||
|
|
||||||
{# Custom logo option #}
|
{# Custom logo option #}
|
||||||
{# Custom backgroud option #}
|
{# Custom backgroud option #}
|
||||||
|
|
||||||
|
{# Row 135: resolve a color-chooser MODE value to the effective color — used for
|
||||||
|
headerbackgroundcolor and the progress bar colors below (navbarfontcolor keeps
|
||||||
|
its own inline expression further down). Modes: default|defaultbackgroundcolor|
|
||||||
|
color1|color2|color3|other, or a raw hex (legacy stored value) which passes
|
||||||
|
through directly. #}
|
||||||
|
{% macro cm(mode, custom, opts) -%}
|
||||||
|
{%- set m = mode|default('') -%}
|
||||||
|
{{- m matches '/^#[0-9a-fA-F]{3,8}$/' ? m : (m == 'color1' ? opts.primarycolor|default('') : (m == 'color2' ? opts.secondarycolor|default('') : (m == 'color3' ? opts.tertiarycolor|default('') : (m == 'defaultbackgroundcolor' ? opts.defaultbackgroundcolor|default('') : (m == 'other' ? custom|default('') : opts.fontcolor|default('')))))) -}}
|
||||||
|
{%- endmacro %}
|
||||||
|
{% import _self as cmm %}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
html, body {
|
html, body {
|
||||||
font-size: {{ aSurveyInfo.options.fontsize }} !important;
|
font-size: {{ aSurveyInfo.options.fontsize }} !important;
|
||||||
|
|
@ -141,8 +153,12 @@
|
||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{# Row 135: headerbackgroundcolor is a MODE dropdown now (see navbarfontcolor
|
||||||
|
below) — resolve the effective color via the shared partial. Default mode
|
||||||
|
"defaultbackgroundcolor"; a legacy stored hex passes through. #}
|
||||||
|
{% set sHeaderBackgroundColor = cmm.cm(aSurveyInfo.options.headerbackgroundcolor|default('defaultbackgroundcolor'), aSurveyInfo.options.headerbackgroundcolorcustom|default(''), aSurveyInfo.options) %}
|
||||||
.navbar-light{
|
.navbar-light{
|
||||||
background-color: {{ aSurveyInfo.options.headerbackgroundcolor }};
|
background-color: {{ sHeaderBackgroundColor }};
|
||||||
}
|
}
|
||||||
|
|
||||||
{# THEME ADDITION: sticky header per screen size (options
|
{# THEME ADDITION: sticky header per screen size (options
|
||||||
|
|
@ -199,8 +215,14 @@
|
||||||
opacity: 0.75;
|
opacity: 0.75;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{# Row 135: the progress bar colors are MODE dropdowns now — resolve via the
|
||||||
|
shared partial. Defaults: background = Default background color, bar = Color 1,
|
||||||
|
font = Default font color; legacy stored hex passes through. #}
|
||||||
|
{% set sProgressBarBackgroundColor = cmm.cm(aSurveyInfo.options.progressbarbackgroundcolor|default('defaultbackgroundcolor'), aSurveyInfo.options.progressbarbackgroundcolorcustom|default(''), aSurveyInfo.options) %}
|
||||||
|
{% set sProgressBarColor = cmm.cm(aSurveyInfo.options.progressbarcolor|default('color1'), aSurveyInfo.options.progressbarcolorcustom|default(''), aSurveyInfo.options) %}
|
||||||
|
{% set sProgressBarFontColor = cmm.cm(aSurveyInfo.options.progressbarfontcolor|default('default'), aSurveyInfo.options.progressbarfontcolorcustom|default(''), aSurveyInfo.options) %}
|
||||||
.progress {
|
.progress {
|
||||||
background: {{ aSurveyInfo.options.progressbarbackgroundcolor }};
|
background: {{ sProgressBarBackgroundColor }};
|
||||||
}
|
}
|
||||||
|
|
||||||
label::after,
|
label::after,
|
||||||
|
|
@ -209,8 +231,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.progress-bar {
|
.progress-bar {
|
||||||
background: {{ aSurveyInfo.options.progressbarcolor }};
|
background: {{ sProgressBarColor }};
|
||||||
color: {{ aSurveyInfo.options.progressbarfontcolor }};
|
color: {{ sProgressBarFontColor }};
|
||||||
}
|
}
|
||||||
|
|
||||||
.question-container, #welcome-container {
|
.question-container, #welcome-container {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue