feat(options): Default background color as 2nd choice; label 'Menu item color in header'; per-option default
- navbarfontcolor dropdown reordered to default|defaultbackgroundcolor| color1|color2|color3|other (options attr, optionlabels, dropdownoptions), and the swatch chips follow the same order (presets map key order in options.js) — 'Default background color' is now the second choice. - Label of navbarfontcolor changed to 'Menu item color in header' (child navbarfontcolorcustom -> 'Custom menu item color ...'). - Per-option default mechanism made explicit: the config.xml <default> of a color-chooser dropdown is that option's default choice (stored on theme reset); navbarfontcolor keeps default 'default' = 'Same as default font color'. The JS no-value fallback no longer hardcodes 'default' but falls back to data-inheritvalue / the first non-inherit dropdown entry, so a future chooser (e.g. questiontitlebackgroundcolor defaulting to color1) can set its own default. custom_header.twig mapping unchanged. - OPTIONS_JS_TOKEN -> 20261126.7. Verified: render tc=573 (dropdown order default,defaultbackgroundcolor,color1,color2,color3,other; label; divs balanced; served as options.js?v=20261126.7), jsdom 6/6 incl. new pins (dropdown order + chip order, Default background color 2nd), live survey 282267 with stored mode 'default' renders navbar menu color = fontcolor #444444, export_public.sh exit 0. Variants not rebuilt (deferred). Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
12ec2820da
commit
2f08e86335
2 changed files with 31 additions and 16 deletions
|
|
@ -736,7 +736,7 @@ var ThemeOptions = function () {
|
|||
};
|
||||
|
||||
// THEME ADDITION (row 115, working example on navbarfontcolor only): preset-dropdown
|
||||
// UI for the "Menu item text color" option.
|
||||
// UI for the "Menu item color in header" option.
|
||||
// - option labels of the navbarfontcolor dropdown get the LIVE hex of the preset
|
||||
// they point at ("Color 1 [#5e1c64]" — values read from the stored options JSON /
|
||||
// the fields' data-inheritvalue, so they also work at survey level with inherit)
|
||||
|
|
@ -749,8 +749,11 @@ var ThemeOptions = function () {
|
|||
var navbarColorModeUI = function () {
|
||||
var sel = globalForm.find('select[name="navbarfontcolor"]');
|
||||
if (!sel.length) { return; }
|
||||
// row 124: 5 presets — the 4th named color is now the "Default background color"
|
||||
var presets = { 'default': 'fontcolor', 'color1': 'primarycolor', 'color2': 'secondarycolor', 'color3': 'tertiarycolor', 'defaultbackgroundcolor': 'defaultbackgroundcolor' };
|
||||
// row 124/125: 5 presets, in the SAME order as the dropdown options in
|
||||
// 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' };
|
||||
var customInput = globalForm.find('input[name="navbarfontcolorcustom"]');
|
||||
var currentColor = function (key) {
|
||||
var f = globalForm.find('#simple_edit_options_' + key);
|
||||
|
|
@ -838,8 +841,13 @@ var ThemeOptions = function () {
|
|||
updateAllChildren();
|
||||
updateVisibilityByParent();
|
||||
} else if (!sel.val()) {
|
||||
// no (matching) stored value: fall back to the first option
|
||||
sel.val('default');
|
||||
// no (matching) stored value: fall back to the option's configured
|
||||
// default (row 125: every color-chooser option can pick its own default
|
||||
// via the config.xml <default>, stored on theme reset; in the DOM the
|
||||
// inherited value is data-inheritvalue, else the first non-"inherit"
|
||||
// dropdown entry is the default choice of the pattern)
|
||||
var fallback = sel.data('inheritvalue') || sel.find('option').not('[value="inherit"]').first().attr('value');
|
||||
if (fallback) { sel.val(fallback); }
|
||||
updateAllChildren();
|
||||
updateVisibilityByParent();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,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.6' %}
|
||||
{% set OPTIONS_JS_TOKEN = '20261126.7' %}
|
||||
{{ unregisterScriptFile(optionsPath ~ '/options.js') }}
|
||||
{{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue