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
1 changed files with 184 additions and 63 deletions
|
|
@ -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.13' %}
|
||||
{% set OPTIONS_JS_TOKEN = '20261126.14' %}
|
||||
{{ unregisterScriptFile(optionsPath ~ '/options.js') }}
|
||||
{{ 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
|
||||
value. The order of this list is the order shown in the tab. #}
|
||||
{% set aTopOfPageKeys = [
|
||||
'headerbackgroundcolor', 'headerfont', 'navbarfontcolor', 'navbarfontcolorcustom',
|
||||
'headerbackgroundcolor', 'headerbackgroundcolorcustom', 'headerfont', 'navbarfontcolor', 'navbarfontcolorcustom',
|
||||
'headersticky', 'headerstickycomputer', 'headerstickytablet', 'headerstickymobile',
|
||||
'brandlogofile', 'brandlogotopmargin', 'brandshowoncomputer', 'brandshowontablet', 'brandshowonmobile',
|
||||
'centerlogofile', 'centerlogotopmargin', 'centershowoncomputer', 'centershowontablet', 'centershowonmobile',
|
||||
'rightlogofile', 'rightlogotopmargin', 'rightshowoncomputer', 'rightshowontablet', 'rightshowonmobile',
|
||||
'progressbarposition', 'progressbarfont', 'progressbarbackgroundcolor', 'progressbarcolor', 'progressbarfontcolor'
|
||||
'progressbarposition', 'progressbarfont', 'progressbarcolor', 'progressbarcolorcustom',
|
||||
'progressbarbackgroundcolor', 'progressbarbackgroundcolorcustom', 'progressbarfontcolor', 'progressbarfontcolorcustom'
|
||||
] %}
|
||||
{% set aLogoKeys = [
|
||||
'brandlogofile', 'brandlogotopmargin', 'brandshowoncomputer', 'brandshowontablet', 'brandshowonmobile',
|
||||
|
|
@ -244,8 +245,11 @@
|
|||
|
||||
{% set aFontElements = ['questiontitle', 'answers', 'grouptitle', 'groupdescription', 'buttons'] %}
|
||||
|
||||
{% set aColorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor'] %}
|
||||
|
||||
{% set aShowIfValues = { 'questionborder': 'box|top', 'navbarfontcolor': 'other' } %}
|
||||
{% 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:
|
||||
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
|
||||
(row 115) — the custom color picker stays visible next to the mode dropdown. #}
|
||||
{% set aShowIfMode = { 'navbarfontcolor': 'disable' } %}
|
||||
{% for ck in aColorChooserKeys %}{% set aShowIfMode = aShowIfMode|merge({ (ck): 'disable' }) %}{% endfor %}
|
||||
|
||||
{% set aFontsRow1 = ['font', 'fontcolor', 'fontsize'] %}
|
||||
{% set aFontsRow2 = ['primarycolor', 'secondarycolor', 'tertiarycolor'] %}
|
||||
|
|
@ -366,15 +371,22 @@
|
|||
{% elseif bTopPane %}
|
||||
{% if key in aLogoKeys %}{% set fSlot = 'logo' %}
|
||||
{% elseif key == 'headerbackgroundcolor' %}{% set fSlot = 'h1' %}
|
||||
{% elseif key == 'headerbackgroundcolorcustom' %}{% set fSlot = 'h1' %}
|
||||
{% elseif key == 'headerfont' %}{% set fSlot = 'hf' %}
|
||||
{% elseif key == 'navbarfontcolor' %}{% set fSlot = 'h2' %}
|
||||
{% elseif key == 'navbarfontcolorcustom' %}{% set fSlot = 'h2' %}
|
||||
{% elseif key in aTopStickyKeys %}{% set fSlot = 'h3' %}
|
||||
{% elseif key == 'progressbarposition' %}{% set fSlot = 'ppos' %}
|
||||
{% elseif key == 'progressbarfont' %}{% set fSlot = 'pfont' %}
|
||||
{% elseif key == 'progressbarbackgroundcolor' %}{% set fSlot = 'pcol1' %}
|
||||
{% elseif key == 'progressbarcolor' %}{% set fSlot = 'pcol2' %}
|
||||
{# row 135: progress bar colors row — col 1 = progress bar color,
|
||||
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 == 'progressbarfontcolorcustom' %}{% set fSlot = 'pcol3' %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if fSlot != fLastSlot and (bFontsPane or bTopPane) %}
|
||||
|
|
@ -559,6 +571,7 @@
|
|||
{% if attr.parent != '' %}{% set ddClasses = ddClasses ~ ' selector_radio_childfield' %}{% endif %}
|
||||
{% if tab.category == 'Images' %}{% set ddClasses = ddClasses ~ ' selector_image_selector' %}{% endif %}
|
||||
{% if key == 'font' %}{% set ddClasses = ddClasses ~ ' selector_fontselect' %}{% endif %}
|
||||
{% if key in aColorChooserKeys %}{% set ddClasses = ddClasses ~ ' selector_color_mode' %}{% endif %}
|
||||
<select class="{{ ddClasses }}"
|
||||
{% if attr.parent != '' %}data-parent="{{ attr.parent }}"{% endif %}
|
||||
data-inheritvalue="{{ oParentOptions[key] }}"
|
||||
|
|
@ -642,6 +655,12 @@
|
|||
id="simple_edit_options_{{ key }}" name="{{ key }}"
|
||||
title="{{ gT("Inherited value:") }} {{ oParentOptions[key] }}"/>
|
||||
{% 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>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue