feat(options): 'Default background color' as 4th column of the colors row + 5th swatch preset
New colorpicker option defaultbackgroundcolor (category Fonts, default #ffffff), rendered as column 1 of the second row of the 'Default fonts and colors' tab — that colors row is now 4 columns (col-md-3 each; the top row stays 3 x col-md-4). The experimental color chooser (navbarfontcolor dropdown + swatch chips) gains this color as a 5th preset: dropdown option 'defaultbackgroundcolor', 5 swatch chips with live hex labels, presets map in options.js extended, and custom_header.twig maps the mode to the option value. OPTIONS_JS_TOKEN -> 20261126.6. Verified: render tc=558 (colors row = defaultbackgroundcolor|primarycolor|secondarycolor|tertiarycolor in 4 col-md-3, top row unchanged, divs balanced, dropdown has 6 options), jsdom suite 6/6 (5 chips pinned), live survey 282267 with mode defaultbackgroundcolor -> #aabbcc (DB row restored), export 0. Variants not rebuilt (deferred). Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
8a6cf1f919
commit
12ec2820da
4 changed files with 16 additions and 7 deletions
|
|
@ -216,12 +216,13 @@
|
||||||
navbarfontcolorcustom is rendered VISIBLE but grayed out (disabled)
|
navbarfontcolorcustom is rendered VISIBLE but grayed out (disabled)
|
||||||
unless mode "other" (data-show-if-mode="disable" in options.twig) and
|
unless mode "other" (data-show-if-mode="disable" in options.twig) and
|
||||||
keeps its value across saves (data-keep-value in options.js). -->
|
keeps its value across saves (data-keep-value in options.js). -->
|
||||||
<navbarfontcolor type="dropdown" category="Colors" width="12" title="Menu item text color in the top bar" options="default|color1|color2|color3|other" optionlabels="Same as default font color|Color 1|Color 2|Color 3|Other…">default
|
<navbarfontcolor type="dropdown" category="Colors" width="12" title="Menu item text color in the top bar" options="default|color1|color2|color3|defaultbackgroundcolor|other" optionlabels="Same as default font color|Color 1|Color 2|Color 3|Default background color|Other…">default
|
||||||
<dropdownoptions>
|
<dropdownoptions>
|
||||||
<option value="default">Same as default font color</option>
|
<option value="default">Same as default font color</option>
|
||||||
<option value="color1">Color 1</option>
|
<option value="color1">Color 1</option>
|
||||||
<option value="color2">Color 2</option>
|
<option value="color2">Color 2</option>
|
||||||
<option value="color3">Color 3</option>
|
<option value="color3">Color 3</option>
|
||||||
|
<option value="defaultbackgroundcolor">Default background color</option>
|
||||||
<option value="other">Other…</option>
|
<option value="other">Other…</option>
|
||||||
</dropdownoptions></navbarfontcolor>
|
</dropdownoptions></navbarfontcolor>
|
||||||
<navbarfontcolorcustom type="colorpicker" category="Colors" width="12" title="Custom menu item text color (used when 'Other…' is chosen)" parent="navbarfontcolor">#444444</navbarfontcolorcustom>
|
<navbarfontcolorcustom type="colorpicker" category="Colors" width="12" title="Custom menu item text color (used when 'Other…' is chosen)" parent="navbarfontcolor">#444444</navbarfontcolorcustom>
|
||||||
|
|
@ -308,6 +309,11 @@
|
||||||
secondarycolor are set per variant via variants/<client>.json. -->
|
secondarycolor are set per variant via variants/<client>.json. -->
|
||||||
<fontcolor type="colorpicker" category="Fonts" width="12" title="Default font color (body text)" options="on|off" optionlabels="Yes|No">#444444</fontcolor>
|
<fontcolor type="colorpicker" category="Fonts" width="12" title="Default font color (body text)" options="on|off" optionlabels="Yes|No">#444444</fontcolor>
|
||||||
<fontsize type="buttons" category="Fonts" width="12" title="Base font size (body text)" options="14px|16px|18px|20px" optionlabels="Small (14px)|Normal (16px)|Large (18px)|Extra large (20 px)">16px</fontsize>
|
<fontsize type="buttons" category="Fonts" width="12" title="Base font size (body text)" options="14px|16px|18px|20px" optionlabels="Small (14px)|Normal (16px)|Large (18px)|Extra large (20 px)">16px</fontsize>
|
||||||
|
<!-- Row 124: "Default background color" — column 1 of the colors row in the
|
||||||
|
"Default fonts and colors" tab (that row is now 4 columns). It is also the
|
||||||
|
5th preset of the experimental color-chooser (navbarfontcolor dropdown +
|
||||||
|
swatches), so users can pick it anywhere a named color is offered. -->
|
||||||
|
<defaultbackgroundcolor type="colorpicker" category="Fonts" width="12" title="Default background color" options="on|off" optionlabels="Yes|No">#ffffff</defaultbackgroundcolor>
|
||||||
<primarycolor type="colorpicker" category="Fonts" width="12" title="Color 1 (primary)" options="on|off" optionlabels="Yes|No">#5e1c64</primarycolor>
|
<primarycolor type="colorpicker" category="Fonts" width="12" title="Color 1 (primary)" options="on|off" optionlabels="Yes|No">#5e1c64</primarycolor>
|
||||||
<secondarycolor type="colorpicker" category="Fonts" width="12" title="Color 2" options="on|off" optionlabels="Yes|No">#888888</secondarycolor>
|
<secondarycolor type="colorpicker" category="Fonts" width="12" title="Color 2" options="on|off" optionlabels="Yes|No">#888888</secondarycolor>
|
||||||
<tertiarycolor type="colorpicker" category="Fonts" width="12" title="Color 3" options="on|off" optionlabels="Yes|No">#dddddd</tertiarycolor>
|
<tertiarycolor type="colorpicker" category="Fonts" width="12" title="Color 3" options="on|off" optionlabels="Yes|No">#dddddd</tertiarycolor>
|
||||||
|
|
|
||||||
|
|
@ -749,7 +749,8 @@ var ThemeOptions = function () {
|
||||||
var navbarColorModeUI = function () {
|
var navbarColorModeUI = function () {
|
||||||
var sel = globalForm.find('select[name="navbarfontcolor"]');
|
var sel = globalForm.find('select[name="navbarfontcolor"]');
|
||||||
if (!sel.length) { return; }
|
if (!sel.length) { return; }
|
||||||
var presets = { 'default': 'fontcolor', 'color1': 'primarycolor', 'color2': 'secondarycolor', 'color3': 'tertiarycolor' };
|
// 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' };
|
||||||
var customInput = globalForm.find('input[name="navbarfontcolorcustom"]');
|
var customInput = globalForm.find('input[name="navbarfontcolorcustom"]');
|
||||||
var currentColor = function (key) {
|
var currentColor = function (key) {
|
||||||
var f = globalForm.find('#simple_edit_options_' + key);
|
var f = globalForm.find('#simple_edit_options_' + key);
|
||||||
|
|
@ -849,7 +850,7 @@ var ThemeOptions = function () {
|
||||||
// so the active outline still moves on the chosen swatch (row 122).
|
// so the active outline still moves on the chosen swatch (row 122).
|
||||||
$(document).on('change', 'select[name="navbarfontcolor"]', refreshAll);
|
$(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'], function (i, key) {
|
$.each(['fontcolor', 'primarycolor', 'secondarycolor', 'tertiarycolor', 'defaultbackgroundcolor'], function (i, key) {
|
||||||
globalForm.find('#simple_edit_options_' + key).on('input change', refreshAll);
|
globalForm.find('#simple_edit_options_' + key).on('input change', refreshAll);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -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.5' %}
|
{% set OPTIONS_JS_TOKEN = '20261126.6' %}
|
||||||
{{ 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') }}
|
||||||
|
|
||||||
|
|
@ -336,6 +336,7 @@
|
||||||
{% if key == 'font' %}{% set fSlot = 'f1' %}
|
{% if key == 'font' %}{% set fSlot = 'f1' %}
|
||||||
{% elseif key == 'fontcolor' %}{% set fSlot = 'f2' %}
|
{% elseif key == 'fontcolor' %}{% set fSlot = 'f2' %}
|
||||||
{% elseif key == 'fontsize' %}{% set fSlot = 'f3' %}
|
{% elseif key == 'fontsize' %}{% set fSlot = 'f3' %}
|
||||||
|
{% elseif key == 'defaultbackgroundcolor' %}{% set fSlot = 'c0' %}
|
||||||
{% elseif key == 'primarycolor' %}{% set fSlot = 'c1' %}
|
{% elseif key == 'primarycolor' %}{% set fSlot = 'c1' %}
|
||||||
{% elseif key == 'secondarycolor' %}{% set fSlot = 'c2' %}
|
{% elseif key == 'secondarycolor' %}{% set fSlot = 'c2' %}
|
||||||
{% elseif key == 'tertiarycolor' %}{% set fSlot = 'c3' %}
|
{% elseif key == 'tertiarycolor' %}{% set fSlot = 'c3' %}
|
||||||
|
|
@ -356,8 +357,9 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if fSlot != fLastSlot and (bFontsPane or bTopPane) %}
|
{% if fSlot != fLastSlot and (bFontsPane or bTopPane) %}
|
||||||
{% if bFontsPane %}
|
{% 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-4">
|
{% 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' or fLastSlot == 'c1' or fLastSlot == 'c2' %}</div><div class="col-md-4">
|
{% elseif fLastSlot == 'f1' or fLastSlot == 'f2' %}</div><div class="col-md-4">
|
||||||
|
{% elseif fLastSlot == 'c0' or fLastSlot == 'c1' or fLastSlot == 'c2' %}</div><div class="col-md-3">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if fSlot == 'f1' %}<div class="row action_hide_on_inherit fonts-top-row"><div class="col-md-4">
|
{% if fSlot == 'f1' %}<div class="row action_hide_on_inherit fonts-top-row"><div class="col-md-4">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,7 @@
|
||||||
other -> navbarfontcolorcustom. A raw hex value (legacy stored value from
|
other -> navbarfontcolorcustom. A raw hex value (legacy stored value from
|
||||||
before the dropdown existed, or a hand-set one) is used directly. #}
|
before the dropdown existed, or a hand-set one) is used directly. #}
|
||||||
{% set sNavbarFontColorMode = aSurveyInfo.options.navbarfontcolor|default('default') %}
|
{% 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(''))))) %}
|
{% 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 == 'defaultbackgroundcolor' ? aSurveyInfo.options.defaultbackgroundcolor|default('') : (sNavbarFontColorMode == 'other' ? aSurveyInfo.options.navbarfontcolorcustom|default('') : aSurveyInfo.options.fontcolor|default('')))))) %}
|
||||||
#survey-nav .navbar-nav > li > a,
|
#survey-nav .navbar-nav > li > a,
|
||||||
#survey-nav .navbar-nav .nav-link {
|
#survey-nav .navbar-nav .nav-link {
|
||||||
color: {{ sNavbarFontColor }};
|
color: {{ sNavbarFontColor }};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue