feat(options): menu item color as preset dropdown with persistent custom color (working example)
navbarfontcolor (Top of the page tab, column 2) changes from a plain colorpicker to a dropdown: Same as default font color | Color 1 | Color 2 | Color 3 | Other. The new navbarfontcolorcustom colorpicker stays visible but grayed out (disabled + aria-disabled) unless 'Other' is chosen, and keeps its value across saves (data-keep-value) so switching back to 'Other' restores the last picked color. Dropdown option labels show the live hex of each preset and clickable swatch chips select a preset; an effective-color swatch next to the picker shows the color actually applied. A legacy stored hex is migrated to mode 'other' + custom field (options.js) and accepted directly in custom_header.twig, so nothing is lost before a theme reset. Views map default->fontcolor, color1/2/3->primary/secondary/tertiarycolor, other->navbarfontcolorcustom. headerbackgroundcolor/bodybackgroundcolor stay plain colorpickers, default #ffffff. build.php maps a legacy hex navbarfontcolor in variant jsons to other+custom for when variants are built. Verified: jsdom suite 6/6 (new options_navbar_color_mode test: migration, gray-out, keep-value on save, chips, swatches), live survey render for all 5 modes, export check exit 0. NOTE (owner 2026-11-26): variant builds are intentionally DEFERRED — no customer is waiting; the on-disk variant folders were left at their pre-feature state and no variant theme was reset. Run variants/build.php per variant only after the open prompts are done. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
7939f3de3f
commit
f2ebf24270
1 changed files with 263 additions and 16 deletions
|
|
@ -179,16 +179,23 @@
|
|||
padding-top: {{ aSurveyInfo.options.rightlogotopmargin|default('15')|replace({'px': ''}) }}px;
|
||||
}
|
||||
|
||||
{# Row 115 working example: navbarfontcolor is now a MODE dropdown
|
||||
(default|color1|color2|color3|other). Resolve the effective color:
|
||||
default -> fontcolor, color1/2/3 -> primarycolor/secondarycolor/tertiarycolor,
|
||||
other -> navbarfontcolorcustom. A raw hex value (legacy stored value from
|
||||
before the dropdown existed, or a hand-set one) is used directly. #}
|
||||
{% set sNavbarFontColorMode = aSurveyInfo.options.navbarfontcolor|default('default') %}
|
||||
{% set sNavbarFontColor = sNavbarFontColorMode matches '/^#[0-9a-fA-F]{3,8}$/' ? sNavbarFontColorMode : (sNavbarFontColorMode == 'color1' ? aSurveyInfo.options.primarycolor|default('') : (sNavbarFontColorMode == 'color2' ? aSurveyInfo.options.secondarycolor|default('') : (sNavbarFontColorMode == 'color3' ? aSurveyInfo.options.tertiarycolor|default('') : (sNavbarFontColorMode == 'other' ? aSurveyInfo.options.navbarfontcolorcustom|default('') : aSurveyInfo.options.fontcolor|default(''))))) %}
|
||||
#survey-nav .navbar-nav > li > a,
|
||||
#survey-nav .navbar-nav .nav-link {
|
||||
color: {{ aSurveyInfo.options.navbarfontcolor }};
|
||||
color: {{ sNavbarFontColor }};
|
||||
}
|
||||
|
||||
#survey-nav .navbar-nav > li > a:hover,
|
||||
#survey-nav .navbar-nav > li > a:focus,
|
||||
#survey-nav .navbar-nav .nav-link:hover,
|
||||
#survey-nav .navbar-nav .nav-link:focus {
|
||||
color: {{ aSurveyInfo.options.navbarfontcolor }};
|
||||
color: {{ sNavbarFontColor }};
|
||||
opacity: 0.75;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue