vanilla_respondage/options/options.twig

738 lines
55 KiB
Twig
Raw Normal View History

2026-06-17 10:06:07 +02:00
{#
Custom options page of this theme. Activated by <optionspage>custom</optionspage>
in config.xml: LimeSurvey then renders THIS file inside the "Simple options" tab
of themeOptions/update (instead of the core options_core.php partial) and
auto-registers options/options.js next to it.
2026-06-17 10:06:07 +02:00
All options are rendered GENERICALLY from config.xml via aOptionAttributes (the
same structure the core renderer uses, see TemplateManifest::getOptionAttributes()),
grouped by category. Adding an <option> to config.xml is therefore enough - it
shows up here automatically. Supported types: buttons, dropdown, fontselect,
checkbox, imagefile, colorpicker, duration, text.
(fontselect = per-element font override: same choices as the base "font"
dropdown plus "Same as base font"; see the branch below.)
2026-06-17 10:06:07 +02:00
Tab order: the "Fonts" category tab is FIRST (default font + per-element font
overrides), then the "Top of the page" tab, then the other categories.
2026-06-17 10:06:07 +02:00
Exception: the options that make up the TOP OF THE PAGE (header menu, logos,
header colors, progress bar) are pulled out of their config.xml categories
into a dedicated tab, "Top of the page" (see aTopOfPageKeys below).
Values are stored per option key, so this regrouping does not touch stored
values and needs no theme reset to take effect.
options/options.js is a copy of the core assets/packages/themeoptions-core/
themeoptions-core.js (patched to also hide .action_hide_on_inherit rows when
"Inherit everything" is on, because the custom page has no category tabs).
2026-06-17 10:06:07 +02:00
#}
{# PRIVACY: during survey-taking this theme must NEVER make external requests
(no calls to Google or any other font host). Therefore only the LOCAL
"font-websafe" package is registered here (its css is served from the
LimeSurvey server's own assets and only defines system-font stacks), so the
browser-font choices in the font dropdowns can be previewed. The Google-hosted
core packages (font-roboto, font-noto, ...) are deliberately NOT registered,
and the bundled fonts (files/fonts/*.woff2) are self-hosted via css/fonts.css.
options/options.js enforces the same rule for packages_to_load: only
"websafe" may be added there. variants/export_public.sh aborts the public
release if any other external host is referenced anywhere in the theme. #}
2026-06-17 10:06:07 +02:00
{{ registerPackage('font-websafe') }}
{# CACHE-BUST options.js: core registers it as optionsPath ~ '/options.js' WITHOUT a
version query (LSETwigViewRenderer::renderOptionPage), so browsers may serve a
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.8' %}
{{ unregisterScriptFile(optionsPath ~ '/options.js') }}
{{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }}
2026-06-17 10:06:07 +02:00
{# FONT DROPDOWNS, fixed inline (rendered into the page HTML, so it always runs on
a fresh page load — even if the browser serves a heuristically cached
options.js; options/options.js has the same logic as a fallback, running twice
is idempotent). Core prepends the "Local server" optgroups server-side
(TemplateManifest::getOptionAttributes), so the order can only be fixed
client-side. Three things are done for every font select (.selector_fontselect):
1. EMPTY optgroups are removed (e.g. "Custom (this theme)" when the theme
ships no own font) — an empty category is not shown.
2. Optgroups are ordered Custom (this theme) > Bundled open source fonts >
User browser > Local server - Core/User LAST. Server packages are detected
structurally: their first option has data-font-package === value.
3. The base font select (#simple_edit_options_font) gets its selected value from
the stored options (#TemplateConfiguration_options JSON, fallback
data-inheritvalue), and on form submit the chosen value is patched into that
JSON — so the base font displays and saves correctly even if options.js did
not run. NOTE: registerScript needs an explicit position ('POS_END') — the
default position resolves to '' which CClientScript never renders. #}
{{ registerScript('respondage-font-dropdown-order', "(function(){var rank=function(label){var l=String(label||'').toLowerCase();if(l.indexOf('custom')!==-1){return 0;}if(l.indexOf('bundled')!==-1){return 1;}if(l.indexOf('user')!==-1){return 2;}return 3;};var isSrv=function(og){var o=og.querySelector('option');return !!(o&&o.getAttribute('data-font-package')===o.getAttribute('value'));};var fix=function(){var selects=document.querySelectorAll('.selector_fontselect');Array.prototype.forEach.call(selects,function(sel){Array.prototype.slice.call(sel.children).forEach(function(el){if(el.tagName==='OPTGROUP'&&!el.querySelector('option')){el.parentNode.removeChild(el);}});var groups=Array.prototype.slice.call(sel.children).filter(function(el){return el.tagName==='OPTGROUP';});groups.sort(function(a,b){var as=isSrv(a),bs=isSrv(b);if(as!==bs){return as?1:-1;}if(as&&bs){return 0;}return rank(a.getAttribute('label'))-rank(b.getAttribute('label'));});groups.forEach(function(g){sel.appendChild(g);});});var base=document.getElementById('simple_edit_options_font');if(base){var stored=null;var f=document.getElementById('TemplateConfiguration_options');if(f){try{var o=JSON.parse(f.value);if(o&&o.font){stored=o.font;}}catch(e){}}if(!stored&&base.getAttribute('data-inheritvalue')){stored=base.getAttribute('data-inheritvalue');}if(stored&&base.querySelector('option[value=\"'+stored+'\"]')){base.value=stored;}}var form=document.querySelector('.action_update_options_string_form');if(form&&base){form.addEventListener('submit',function(){var f2=document.getElementById('TemplateConfiguration_options');if(!f2||!base.value){return;}try{var o2=JSON.parse(f2.value);if(o2&&typeof o2==='object'){o2.font=base.value;f2.value=JSON.stringify(o2);}}catch(e){}},true);}};if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',fix);}else{fix();}})();", 'POS_END') }}
2026-06-17 10:06:07 +02:00
{# CURRENT VALUES FOR SELECTS, inline (rendered into the page HTML, so it always runs
on a fresh page load — even if the browser serves a heuristically cached
options.js; options.js prepareSelectField() does the same and is idempotent).
The <option> HTML of dropdown/fontselect/imagefile comes prebuilt from core
(dropdownoptions|raw / imageOptions), so the selected option cannot be marked
server-side there — set sel.value from the stored options JSON instead. Buttons,
checkboxes, text/color inputs and the inherit options ARE marked server-side in
the markup below (checked/selected/value). When the row is "inherit", JSON.parse
fails and the server-side selected inherit options stay in charge. #}
{{ registerScript('respondage-current-values', "(function(){var f=document.getElementById('TemplateConfiguration_options');if(!f){return;}var stored=null;try{var o=JSON.parse(f.value);if(o&&typeof o==='object'){stored=o;}}catch(e){}if(!stored){return;}var sels=document.querySelectorAll('select.selector_option_value_field');Array.prototype.forEach.call(sels,function(sel){var key=sel.getAttribute('name');if(!key||!Object.prototype.hasOwnProperty.call(stored,key)){return;}var v=stored[key];if(v==null||v==='inherit'){return;}v=String(v);var ok=Array.prototype.some.call(sel.options,function(op){return op.value===v;});if(ok){sel.value=v;}});})();", 'POS_END') }}
2026-06-17 10:06:07 +02:00
{% set bInherit = templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %}
2026-06-17 10:06:07 +02:00
{# CURRENT OPTION VALUES, rendered server-side (so the selected state never depends
on options.js being fresh): parse the stored options JSON once. When the whole row
is "inherit" (survey/group level with "Inherit everything"), every option value is
"inherit" → the Inherit controls get checked/selected. Per key the fallback is the
parent (inherited) value from oParentOptions. NOTE: use "is defined" checks, NOT
|default — "0" is a legitimate value (e.g. showpopups) and |default would drop it. #}
{% set aCurrentOptions = json_decode(templateConfiguration.options) %}
{% set bGeneralInherit = templateConfiguration.options == 'inherit' %}
2026-06-17 10:06:07 +02:00
{# Options list for imagefile selects, with an <optgroup> per image group #}
{% set imageOptions = '' %}
{% set imgGroup = '' %}
{% for image in templateConfiguration.imageFileList %}
{% if image.group != imgGroup %}
{% if imgGroup != '' %}{% set imageOptions = imageOptions ~ '</optgroup>' %}{% endif %}
{% set imageOptions = imageOptions ~ '<optgroup label="' ~ image.group ~ '">' %}
{% set imgGroup = image.group %}
{% endif %}
{% set imageOptions = imageOptions ~ '<option data-lightbox-src="' ~ image.preview ~ '" value="' ~ image.filepath ~ '">' ~ image.filename ~ '</option>' %}
{% endfor %}
{% if imgGroup != '' %}{% set imageOptions = imageOptions ~ '</optgroup>' %}{% endif %}
2026-06-17 10:06:07 +02:00
<div class="simple-template-edit-loading text-center" style="display:none">
<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>
</div>
{# Options-page-only styles, INLINE on purpose: this admin page does NOT load the
theme's css/plain.css (that is registered for survey pages only), so anything
styled from plain.css would be unstyled here. These rules cover the
navbarfontcolor working example (row 115-118): the preset swatch chips under
the dropdown (full column width, 10px gap, hex label BELOW each swatch) and
the grayed-out look of "disable"-mode children (visible but dimmed). #}
<style>
.option-visibility-disable .mb-3 {
opacity: 0.55;
}
.color-mode-chips {
display: flex;
width: 100%;
gap: 10px;
margin-top: 0.4rem;
}
.color-chip-item {
flex: 1 1 0;
min-width: 0;
display: flex;
flex-direction: column;
gap: 2px;
}
.color-chip {
width: 100%;
height: 3.2rem;
padding: 0;
border: 1px solid rgba(0, 0, 0, 0.35);
border-radius: 0.25rem;
cursor: pointer;
background: transparent;
}
.color-chip.active {
outline: 2px solid currentColor;
outline-offset: 1px;
}
.color-chip:focus-visible {
outline: 2px solid #0d6efd;
outline-offset: 1px;
}
.color-chip-label {
width: 100%;
font-size: 1rem;
color: #6c757d;
text-align: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* row 126: the DEFAULT choice of a color-chooser option (the config.xml
<option data-default="1">) is shown in bold — in the dropdown (CSS below)
and on its swatch label (is-default class set by options.js) */
select option[data-default="1"] {
font-weight: 700;
}
.color-chip-label.is-default {
font-weight: 700;
color: #212529;
}
/* row 127: labels ABOVE the option fields at 16px (they were the same size
as the option texts at 14px). Only .form-label — the labels NEXT TO the
checkboxes (.form-check-label) are deliberately NOT touched. */
.action_update_options_string_form .form-label {
font-size: 16px;
}
/* row 128: the section headers this page inserts (h2 inside the tab panes,
e.g. "Header", "Logos", "Default colors") are just as big as the h1 page
header — the exact same rule Bootstrap applies to h1 (the modal title
h2.modal-title is outside .tab-content and stays small). */
.tab-content h2:not(.modal-title) {
font-size: calc(1.375rem + 1.5vw);
}
@media (min-width: 1200px) {
.tab-content h2:not(.modal-title) {
font-size: 2.5rem;
}
}
.color-mode-effective {
display: inline-block;
width: 1.1rem;
height: 1.1rem;
border: 1px solid rgba(0, 0, 0, 0.35);
border-radius: 0.25rem;
vertical-align: middle;
background: transparent;
}
</style>
{# If this is a survey-specific (or survey-group) settings page, offer full inheritance of the parent template #}
{% if bInherit %}
<div class="row" id="general_inherit_active">
<label id="inherit_label_announcement" class="form-label">{{ gT("Inherit everything") }}</label>
<div class="col-12" role="radiogroup" aria-labelledby="inherit_label_announcement">
<div class="btn-group" data-bs-toggle="buttons">
<input id="general_inherit_on" name="general_inherit" type="radio" value="on"
{% if bGeneralInherit %}checked{% endif %}
class="btn-check selector_option_general_inherit" data-id="simple_edit_options_general_inherit"/>
<label for="general_inherit_on" class="btn btn-outline-secondary{% if bGeneralInherit %} active{% endif %}">{{ gT("Inherited") }}</label>
<input id="general_inherit_off" name="general_inherit" type="radio" value="off"
{% if not bGeneralInherit %}checked{% endif %}
class="btn-check selector_option_general_inherit" data-id="simple_edit_options_general_inherit"/>
<label for="general_inherit_off" class="btn btn-outline-secondary{% if not bGeneralInherit %} active{% endif %}">{{ gT("Customize theme") }}</label>
</div>
2026-06-17 10:06:07 +02:00
</div>
</div>
<div class="row action_hide_on_inherit">
<hr/>
</div>
{% endif %}
2026-06-17 10:06:07 +02:00
{# Every tab pane ends with the Respondage footer. The logo uses a dedicated file
name (not logo.png) on purpose: variants may ship their own files/logo.png as
client logo, and imageSrc() resolves './files/...' in the variant first — with
this name it falls through to the mother theme, so the footer always shows the
Respondage logo. #}
{% set respondageLogo = imageSrc('./files/respondage-logo.png') %}
{# Options that make up the TOP OF THE PAGE (everything in the header, plus the
progress bar which sits in/just under the header): the menu (navbar text color),
the left/center/right logos, the header background color, and the progress bar
position + colors. These keys are pulled out of their original config.xml
categories (Colors / Images / Progress) into a dedicated FIRST tab below.
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 = [
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>
2026-11-26 13:51:55 +01:00
'headerbackgroundcolor', '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'
] %}
{% set aLogoKeys = [
'brandlogofile', 'brandlogotopmargin', 'brandshowoncomputer', 'brandshowontablet', 'brandshowonmobile',
'centerlogofile', 'centerlogotopmargin', 'centershowoncomputer', 'centershowontablet', 'centershowonmobile',
'rightlogofile', 'rightlogotopmargin', 'rightshowoncomputer', 'rightshowontablet', 'rightshowonmobile'
] %}
{% set aLogoPositions = ['brand', 'center', 'right'] %}
{% set aProgressKeys = ['progressbarposition', 'progressbarbackgroundcolor', 'progressbarcolor', 'progressbarfontcolor'] %}
{% set aTopStickyKeys = ['headersticky', 'headerstickycomputer', 'headerstickytablet', 'headerstickymobile'] %}
{% set aFontElements = ['questiontitle', 'answers', 'grouptitle', 'groupdescription', 'buttons'] %}
2026-11-25 11:51:57 +01:00
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>
2026-11-26 13:51:55 +01:00
{% set aShowIfValues = { 'questionborder': 'box|top', 'navbarfontcolor': 'other' } %}
2026-11-25 11:51:57 +01:00
{% for el in aFontElements %}{% set aShowIfValues = aShowIfValues|merge({ (el ~ 'textcolor'): 'other' }) %}{% endfor %}
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>
2026-11-26 13:51:55 +01:00
{# 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
child control is rendered disabled (grayed out) and carries data-keep-value so
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' } %}
{% set aFontsRow1 = ['font', 'fontcolor', 'fontsize'] %}
{% set aFontsRow2 = ['primarycolor', 'secondarycolor', 'tertiarycolor'] %}
{% set aQuestionsCol1 = ['questiontitlebackgroundcolor', 'questiontitlefontcolor', 'questionbackgroundcolor', 'questionhelpbackgroundcolor', 'questionhelpfontcolor', 'questionhelptextposition'] %}
{% set aQuestionsCol2 = ['questionborder', 'questionbordercolor', 'questionborderstyle', 'questiondropdown', 'questionborderradiusTL', 'questionborderradiusTR', 'questionborderradiusBL', 'questionborderradiusBR'] %}
{% set aQuestionsCol3 = ['checkboxcolor'] %}
{# Tab list: FIRST the "Fonts" tab (where the default/base font is chosen and the
per-element font overrides live), then the "Top of the page" tab (keys =
aTopOfPageKeys), then one tab per remaining category from config.xml like the
core options page (keys = null: all options of that category, except the
top-of-page keys). Category tab ids are slugs of the category name, so they
stay stable regardless of the tab order. #}
{% set aTabs = [] %}
{% if 'Fonts' in aOptionAttributes.categories %}
{% set aTabs = [{ 'id': 'category-fonts', 'label': 'Default fonts and colors', 'category': 'Fonts', 'keys': null }] %}
{% endif %}
{% set aTabs = aTabs|merge([{ 'id': 'top-of-page', 'label': 'Top of the page', 'category': 'Top of the page', 'keys': aTopOfPageKeys }]) %}
{% for category in aOptionAttributes.categories %}
{% if category != 'Fonts' and category != 'Top of the page' and category != 'Colors' %}
{# The "Colors" tab is removed on purpose. Its only remaining options are
sliderhandlecolor and privacybackgroundcolor (the other Colors keys are
pulled into "Top of the page" via aTopOfPageKeys) — TODO: place these two
options on another tab. #}
{# Resolve this category's keys once and skip the tab entirely when none
remain: e.g. "Progress" — its only option (progressbarposition)
moved to the Top-of-page tab, so an empty tab must not be rendered. #}
{% set catKeys = [] %}
{% for key, attr in aOptionAttributes.optionAttributes %}
{% if key != 'ajaxmode' and attr.category == category and key not in aTopOfPageKeys %}
{% set catKeys = catKeys|merge([key]) %}
{% endif %}
{% endfor %}
{% if catKeys is not empty %}
{% set aTabs = aTabs|merge([{ 'id': 'category-' ~ category|lower|replace({' ': '-'}), 'label': category, 'category': category, 'keys': null }]) %}
{% endif %}
{% endif %}
{% endfor %}
<ul class="nav nav-tabs mt-3" role="tablist">
{% for tab in aTabs %}
<li class="nav-item" role="presentation">
<button class="nav-link tab_action_hide_on_inherit {% if loop.first %}active{% endif %}"
id="tab-{{ tab.id }}" data-bs-toggle="tab" data-bs-target="#{{ tab.id }}"
type="button" role="tab" aria-controls="{{ tab.id }}"
aria-selected="{{ loop.first ? 'true' : 'false' }}">{{ gT(tab.label) }}</button>
</li>
{% endfor %}
</ul>
<div class="tab-content border border-top-0 p-3 mb-3">
{% for tab in aTabs %}
{# Resolve which option keys this tab shows: the top-of-page tab uses the fixed
order of aTopOfPageKeys; a category tab shows its config.xml options (in
config.xml order) minus the top-of-page keys. #}
{% set aTabKeys = tab.keys %}
{% if aTabKeys is null %}
{% set aTabKeys = [] %}
{% for key, attr in aOptionAttributes.optionAttributes %}
{% if key != 'ajaxmode' and attr.category == tab.category and key not in aTopOfPageKeys %}
{% set aTabKeys = aTabKeys|merge([key]) %}
2026-06-17 10:06:07 +02:00
{% endif %}
{% endfor %}
{% else %}
{# the top-of-page tab also picks up options that literally carry the
category "Top of the page" (so config.xml may use it after a reset) #}
{% for key, attr in aOptionAttributes.optionAttributes %}
{% if key != 'ajaxmode' and attr.category == 'Top of the page' and key not in aTabKeys %}
{% set aTabKeys = aTabKeys|merge([key]) %}
{% endif %}
{% endfor %}
{% endif %}
<div role="tabpanel" class="CoreThemeOptions--settingsTab tab-pane {% if loop.first %}active{% endif %}"
id="{{ tab.id }}" aria-labelledby="tab-{{ tab.id }}">
{% if tab.id == 'top-of-page' %}
<div class="row action_hide_on_inherit top-of-page-intro"><div class="col-12">
<h2>{{ gT("Header") }}</h2>
<p>{{ gT("The header is the top part of the page, possibly containing the name of the survey, logo's and a menu. In this part of the options you can make this header more or less distinguishable from the rest of the page and you can choose if the logo should stay on top of the page after scrolling (sticky) or not.") }}</p>
</div></div>
{% endif %}
{% if tab.id == 'category-fonts' %}
<div class="row action_hide_on_inherit fonts-intro"><div class="col-12">
<h2>{{ gT("Default font") }}</h2>
<p>{{ gT("Here you choose the default font, the font that is used on most places in your version of the theme.") }}</p>
</div></div>
{% endif %}
<div class="row action_hide_on_inherit">
{% if tab.category == 'Images' %}<div class="col-md-4 images-options-column">{% endif %}
{% set qLastCol = 0 %}
2026-11-25 11:51:57 +01:00
{% set fLastSlot = 0 %}
{% for key in aTabKeys %}
{% set attr = aOptionAttributes.optionAttributes[key] ?? null %}
{% if attr is not null %}
{# Slot-based pane layouts: on a
slot change the previous container is closed and the new one opened.
Every slot is row+col (two divs), except 'logo' (self-contained block)
and 'rest' (normal grid). Computed BEFORE the logo-block branch so
the transition into the logo slot also fires. #}
{% set bFontsPane = tab.category == 'Fonts' %}
{% set bTopPane = tab.id == 'top-of-page' %}
{% set fSlot = 'rest' %}
{% if bFontsPane %}
{% if key == 'font' %}{% set fSlot = 'f1' %}
{% elseif key == 'fontcolor' %}{% set fSlot = 'f2' %}
{% elseif key == 'fontsize' %}{% set fSlot = 'f3' %}
{% elseif key == 'defaultbackgroundcolor' %}{% set fSlot = 'c0' %}
{% elseif key == 'primarycolor' %}{% set fSlot = 'c1' %}
{% elseif key == 'secondarycolor' %}{% set fSlot = 'c2' %}
{% elseif key == 'tertiarycolor' %}{% set fSlot = 'c3' %}
{% endif %}
{% elseif bTopPane %}
{% if key in aLogoKeys %}{% set fSlot = 'logo' %}
{% elseif key == 'headerbackgroundcolor' %}{% 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' %}
{% elseif key == 'progressbarfontcolor' %}{% set fSlot = 'pcol3' %}
{% endif %}
{% endif %}
{% if fSlot != fLastSlot and (bFontsPane or bTopPane) %}
{% 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-3">
{% 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 %}
{% if fSlot == 'f1' %}<div class="row action_hide_on_inherit fonts-top-row"><div class="col-md-4">
{% endif %}
{% else %}
{# top-of-page transitions: close previous slot, open new slot.
Header: col 1 = h1, col 2 = hf stacked above h2, col 3 = h3.
Progress bar: first row = ppos in col 1, empty col 2, pfont in
col 3; then the colors row (pcol1/pcol2/pcol3). #}
{% if fLastSlot == 'h1' or fLastSlot == 'h2' %}</div><div class="col-md-4">
{% elseif fLastSlot == 'h3' %}</div></div><div class="row action_hide_on_inherit"><div class="col-12"><hr class="top-section-hr"></div></div><div class="row action_hide_on_inherit top-section-intro"><div class="col-12"><h2>{{ gT("Logos") }}</h2><p>{{ gT("In this theme there are three positions for separate logos, but it is up to you which positions you want to fill.") }}</p></div></div>
{% elseif fLastSlot == 'logo' %}<div class="row action_hide_on_inherit top-section-intro"><div class="col-12"><h2>{{ gT("Progress bar") }}</h2><p>{{ gT("The progress bar can be switched on/off per survey in the survey settings. Here in this section you can choose how the progress bar looks when displayed.") }}</p></div></div>
{% elseif fLastSlot == 'ppos' %}</div><div class="col-md-4"></div><div class="col-md-4">
{% elseif fLastSlot == 'pfont' %}</div></div><div class="row action_hide_on_inherit progress-colors-row"><div class="col-md-4">
{% elseif fLastSlot == 'pcol1' or fLastSlot == 'pcol2' %}</div><div class="col-md-4">
{% endif %}
{% if fSlot == 'h1' %}<div class="row action_hide_on_inherit top-section-header"><div class="col-md-4">
{% elseif fSlot == 'ppos' %}<div class="row action_hide_on_inherit progress-block"><div class="col-md-4">
{% endif %}
{% endif %}
{% set fLastSlot = fSlot %}
{% endif %}
{% if tab.id == 'top-of-page' and key == 'brandlogofile' %}
<div class="col-12">
<div class="row logo-columns">
{% for pos in aLogoPositions %}
{% set fkey = pos ~ 'logofile' %}
{% set mkey = pos ~ 'logotopmargin' %}
{% set fattr = aOptionAttributes.optionAttributes[fkey] %}
{% set mattr = aOptionAttributes.optionAttributes[mkey] %}
{% set fcv = bGeneralInherit ? 'inherit' : (aCurrentOptions[fkey] is defined ? aCurrentOptions[fkey] : (oParentOptions[fkey] is defined ? oParentOptions[fkey] : '')) %}
{% set mcv = bGeneralInherit ? 'inherit' : (aCurrentOptions[mkey] is defined ? aCurrentOptions[mkey] : (oParentOptions[mkey] is defined ? oParentOptions[mkey] : '')) %}
<div class="col-md-4 logo-col-{{ pos }}{% if not loop.first %} border-start{% endif %}">
{# 1. logo file dropdown, "No logo" (value off) first #}
<div class="mb-3">
<label for="simple_edit_options_{{ fkey }}" id="lbl_simple_edit_options_{{ fkey }}" class="form-label">{{ gT(fattr.title) }}</label>
<select class="form-select selector_option_value_field selector_image_selector"
data-inheritvalue="{{ oParentOptions[fkey] }}"
id="simple_edit_options_{{ fkey }}" name="{{ fkey }}">
{% if bInherit %}
<option value="inherit" {% if fcv == 'inherit' %}selected{% endif %}>{{ gT("Inherit") }} [{{ gT("Inherited value:") }} {{ oParentOptions[fkey] }}]</option>
{% endif %}
<option value="off" {% if fcv == 'off' %}selected{% endif %}>{{ gT("No logo") }}</option>
{{ imageOptions|raw }}
</select>
<button class="btn btn-outline-secondary btn-sm mt-1 selector__open_lightbox" data-bs-target="#simple_edit_options_{{ fkey }}">
{{ gT("Preview image") }}
</button>
</div>
{# 2. margin between logo and top of screen, 0-100 px #}
<div class="mb-3">
<label for="simple_edit_options_{{ mkey }}" id="lbl_simple_edit_options_{{ mkey }}" class="form-label">{{ gT(mattr.title) }}</label>
<input type="number" min="0" max="100" step="1"
class="form-control selector-numerical-input selector_text_option_value_field"
{% if mcv != '' and mcv != 'inherit' %}value="{{ mcv }}"{% endif %}
data-inheritvalue="{{ oParentOptions[mkey] }}"
id="simple_edit_options_{{ mkey }}" name="{{ mkey }}"
title="{{ gT("Inherited value:") }} {{ oParentOptions[mkey] }}"/>
</div>
{# 3. "Show logo on" per device #}
<div class="mb-3">
<span class="form-label d-block">{{ gT("Show logo on") }}</span>
{% for dev in ['computer', 'tablet', 'mobile'] %}
{% set ckey = pos ~ 'showon' ~ dev %}
{% set cattr = aOptionAttributes.optionAttributes[ckey] %}
{% set ccv = bGeneralInherit ? 'inherit' : (aCurrentOptions[ckey] is defined ? aCurrentOptions[ckey] : (oParentOptions[ckey] is defined ? oParentOptions[ckey] : '')) %}
<div class="form-check mb-1">
<input type="checkbox" value="on"
{% if ccv == 'on' %}checked{% endif %}
class="form-check-input selector_option_checkbox_field"
data-inheritvalue="{{ oParentOptions[ckey] }}"
id="simple_edit_options_{{ ckey }}" name="{{ ckey }}">
<label for="simple_edit_options_{{ ckey }}" id="lbl_simple_edit_options_{{ ckey }}" class="form-check-label">{{ gT(cattr.title) }}</label>
</div>
{% endfor %}
</div>
</div>
{% endfor %}
</div>
<div class="row action_hide_on_inherit"><div class="col-12"><hr class="logo-columns-hr"></div></div>
</div>
{% elseif key not in aLogoKeys %}
{% set bQuestionsPane = tab.category == 'Questions' %}
{% if bQuestionsPane %}
{% set qCol = key in aQuestionsCol1 ? 1 : (key in aQuestionsCol2 ? 2 : (key in aQuestionsCol3 ? 3 : 0)) %}
{% if qCol != qLastCol %}
{% if qLastCol > 0 %}</div>{% endif %}
{% if qCol > 0 %}
<div class="col-md-4{% if qLastCol > 0 %} border-start{% endif %} questions-col-{{ qCol }}">
{% endif %}
{% set qLastCol = qCol %}
{% endif %}
{% endif %}
{% if bQuestionsPane or bTopPane or (bFontsPane and fSlot != 'rest') %}{% set wrapClass = 'col-12' %}{% else %}{% set wrapClass = 'col-12 col-md-' ~ attr.width|default(2) %}{% endif %}
{# server-side current value for this option (checked/selected/value) #}
{% set currentValue = bGeneralInherit ? 'inherit' : (aCurrentOptions[key] is defined ? aCurrentOptions[key] : (oParentOptions[key] is defined ? oParentOptions[key] : '')) %}
{# parent != '': this field is only visible when the parent option's value
is one of the show-values (default "on"; see aShowIfValues). options.js toggles
.option-visibility via data-show-if-parent/data-show-if-value;
the field itself is additionally disabled via data-parent/selector_radio_childfield #}
{# server-side INITIAL visibility — when the parent is a buttons group
2026-11-25 11:51:57 +01:00
or a dropdown (e.g. <el>textcolorcustom with parent <el>textcolor,
show-value "other"), add d-none at render time unless the parent's
current value is IN the show-value list. Same source of truth as
currentValue (stored options JSON, fallback oParentOptions). options.js
updateVisibilityByParent() toggles the same class on change (idempotent
2026-11-25 11:51:57 +01:00
with this initial state). #}
{% set bParentHidden = false %}
{% set showIfValues = 'on' %}
2026-11-25 11:51:57 +01:00
{% if attr.parent != '' and attr.parent != key %}
{% set parentAttr = aOptionAttributes.optionAttributes[attr.parent] ?? null %}
{% set showIfValues = aShowIfValues[attr.parent] ?? 'on' %}
2026-11-25 11:51:57 +01:00
{% if parentAttr is not null and (parentAttr.type == 'buttons' or parentAttr.type == 'dropdown') %}
{% set parentValue = bGeneralInherit ? 'inherit' : (aCurrentOptions[attr.parent] is defined ? aCurrentOptions[attr.parent] : (oParentOptions[attr.parent] is defined ? oParentOptions[attr.parent] : '')) %}
{% if parentValue not in showIfValues|split('|') %}{% set bParentHidden = true %}{% endif %}
{% endif %}
{% endif %}
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>
2026-11-26 13:51:55 +01:00
{# 'disable' mode (aShowIfMode): the child stays visible but is rendered
disabled server-side; options.js keeps toggling only disabled (never
d-none) for these wrappers, and data-keep-value makes the serializer
keep the stored child value instead of resetting it to inherit/false #}
{% set bDisableMode = attr.parent != '' and (aShowIfMode[attr.parent] ?? 'hide') == 'disable' %}
{% set bChildDisabled = bParentHidden and bDisableMode %}
<div class="{{ wrapClass }} {% if attr.parent != '' %}option-visibility{% if bParentHidden and not bDisableMode %} d-none{% endif %}{% endif %}"
{% if attr.parent != '' %}data-show-if-parent="{{ attr.parent }}" data-show-if-value="{{ showIfValues }}"{% if bDisableMode %} data-show-if-mode="disable"{% endif %}{% endif %}>
<div class="mb-3">
{# label ALWAYS above the control, for every option type EXCEPT checkbox
(checkboxes carry their label to the RIGHT of the box, rendered in
the checkbox branch below). d-block so the label gets its own line
even next to an inline-flex control (btn-group buttons). #}
{% if attr.type != 'checkbox' %}
<label for="simple_edit_options_{{ key }}" id="lbl_simple_edit_options_{{ key }}" class="form-label d-block">{{ gT(attr.title) }}</label>
{% endif %}
2026-06-17 10:06:07 +02:00
{% if key == 'headersticky' %}
{% elseif attr.type == 'buttons' %}
{# buttons type: one radio per value of options="a|b", labels from optionlabels="A|B" #}
{% set optValues = attr.options|split('|') %}
{% set optLabels = attr.optionlabels|split('|') %}
<div class="btn-group" role="group" data-bs-toggle="buttons">
{% for optValue in optValues %}
<input id="{{ key }}_{{ optValue }}" type="radio" name="{{ key }}" value="{{ optValue }}"
{% if currentValue == optValue %}checked{% endif %}
class="btn-check selector_option_radio_field simple_edit_options_{{ key }}{% if attr.parent != '' %} selector_radio_childfield{% endif %}"
{% if attr.parent != '' %}data-parent="{{ attr.parent }}"{% endif %}/>
<label for="{{ key }}_{{ optValue }}" class="btn btn-outline-secondary{% if currentValue == optValue %} active{% endif %}">{{ gT(optLabels[loop.index0]|default(optValue)) }}</label>
{% endfor %}
{% if bInherit %}
<input id="{{ key }}_inherit" type="radio" name="{{ key }}" value="inherit"
{% if currentValue == 'inherit' %}checked{% endif %}
class="btn-check selector_option_radio_field simple_edit_options_{{ key }}{% if attr.parent != '' %} selector_radio_childfield{% endif %}"
{% if attr.parent != '' %}data-parent="{{ attr.parent }}"{% endif %}/>
<label for="{{ key }}_inherit" class="btn btn-outline-secondary{% if currentValue == 'inherit' %} active{% endif %}">{{ gT("Inherit") }} [{{ oParentOptions[key] }}]</label>
2026-06-17 10:06:07 +02:00
{% endif %}
</div>
2026-06-17 10:06:07 +02:00
{% elseif attr.type == 'checkbox' %}
{# checkbox: checked = "on", unchecked = "off". The box comes BEFORE
its label (classic .form-check, label to the right of the box); the
label keeps the same id (lbl_simple_edit_options_<key>) so tests/JS
anchors keep working. With survey-level inherit, an untouched box
keeps the value "inherit" (options.js: data was-inherit). Children
of a parent switch get selector_radio_childfield + data-parent. #}
<div class="form-check">
<input type="checkbox" value="on"
{% if currentValue == 'on' %}checked{% endif %}
class="form-check-input selector_option_checkbox_field {% if attr.parent != '' %}selector_radio_childfield{% endif %}"
{% if attr.parent != '' %}data-parent="{{ attr.parent }}"{% endif %}
data-inheritvalue="{{ oParentOptions[key] }}"
id="simple_edit_options_{{ key }}" name="{{ key }}">
<label for="simple_edit_options_{{ key }}" id="lbl_simple_edit_options_{{ key }}" class="form-check-label">{{ gT(attr.title) }}</label>
</div>
2026-06-17 10:06:07 +02:00
{% elseif attr.type == 'dropdown' %}
{% set ddClasses = 'form-select selector_option_value_field' %}
{% 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 %}
<select class="{{ ddClasses }}"
{% if attr.parent != '' %}data-parent="{{ attr.parent }}"{% endif %}
data-inheritvalue="{{ oParentOptions[key] }}"
id="simple_edit_options_{{ key }}" name="{{ key }}">
{% if bInherit %}
<option value="inherit" {% if currentValue == 'inherit' %}selected{% endif %}>{{ gT("Inherit") }} [{{ gT("Inherited value:") }} {{ oParentOptions[key] }}]</option>
2026-06-17 10:06:07 +02:00
{% endif %}
{{ attr.dropdownoptions|raw }}
</select>
{% elseif attr.type == 'fontselect' %}
{# fontselect (per-element font override): the SAME font choices as the
base "font" dropdown — the optgroups are shared, so bundled and
variant-custom fonts appear here automatically — plus a first option
"Same as base font" (value "base": the views then put no extra class
on the element, it inherits the body font). options.js collects the
packages of ALL .selector_fontselect selects into packages_to_load. #}
{% set fontAttr = aOptionAttributes.optionAttributes['font'] ?? null %}
<select class="form-select selector_option_value_field selector_fontselect {% if attr.parent != '' %}selector_radio_childfield{% endif %}"
{% if attr.parent != '' %}data-parent="{{ attr.parent }}"{% endif %}
data-inheritvalue="{{ oParentOptions[key] }}"
id="simple_edit_options_{{ key }}" name="{{ key }}">
{% if bInherit %}
<option value="inherit" {% if currentValue == 'inherit' %}selected{% endif %}>{{ gT("Inherit") }} [{{ gT("Inherited value:") }} {{ oParentOptions[key] }}]</option>
2026-06-17 10:06:07 +02:00
{% endif %}
<option value="base" {% if currentValue == 'base' %}selected{% endif %}>{{ gT("Same as base font") }} [{{ oParentOptions['font']|default('') }}]</option>
{{ fontAttr ? fontAttr.dropdownoptions|raw : '' }}
</select>
{% elseif attr.type == 'imagefile' %}
<select class="form-select selector_option_value_field selector_image_selector {% if attr.parent != '' %}selector_radio_childfield{% endif %}"
{% if attr.parent != '' %}data-parent="{{ attr.parent }}"{% endif %}
data-inheritvalue="{{ oParentOptions[key] }}"
id="simple_edit_options_{{ key }}" name="{{ key }}">
{% if bInherit %}
<option value="inherit" {% if currentValue == 'inherit' %}selected{% endif %}>{{ gT("Inherit") }} [{{ gT("Inherited value:") }} {{ oParentOptions[key] }}]</option>
{% endif %}
{{ imageOptions|raw }}
</select>
<button class="btn btn-outline-secondary btn-sm mt-1 selector__open_lightbox" data-bs-target="#simple_edit_options_{{ key }}">
{{ gT("Preview image") }}
</button>
{% elseif attr.type == 'colorpicker' %}
<div class="input-group">
<div class="input-group-text style__colorpicker">
<input type="color" name="{{ key }}_picker" data-value="{{ oParentOptions[key] }}"
{% if currentValue matches '/^#[0-9a-fA-F]{3,8}$/' %}value="{{ currentValue }}"{% endif %}
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>
2026-11-26 13:51:55 +01:00
{% if bChildDisabled %}disabled aria-disabled="true"{% endif %}
{% if attr.parent != '' %}data-parent="{{ attr.parent }}"{% endif %}
class="selector__colorpicker-inherit-value{% if attr.parent != '' %} selector_radio_childfield{% endif %}"/>
</div>
<input type="text" name="{{ key }}" data-inheritvalue="{{ oParentOptions[key] }}"
value="{% if currentValue != '' and currentValue != 'inherit' %}{{ currentValue }}{% endif %}"
{% if bInherit %}placeholder="{{ gT("Inherit") }} [{{ gT("Inherited value:") }} {{ oParentOptions[key] }}]"{% endif %}
{% if attr.parent != '' %}data-parent="{{ attr.parent }}"{% endif %}
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>
2026-11-26 13:51:55 +01:00
{% if bChildDisabled %}disabled aria-disabled="true"{% endif %}
{% if bDisableMode %}data-keep-value="1"{% endif %}
id="simple_edit_options_{{ key }}"
class="selector_option_value_field selector__color-picker form-control simple_edit_options_{{ key }}{% if attr.parent != '' %} selector_radio_childfield{% endif %}"/>
{% if bInherit %}
<div class="input-group-text">
<button class="btn btn-outline-secondary btn-xs selector__reset-colorfield-to-inherit"><i class="ri-refresh-line"></i></button>
</div>
{% endif %}
</div>
{% elseif attr.type == 'duration' %}
<input type="text"
class="form-control selector-numerical-input selector_text_option_value_field {% if attr.parent != '' %}selector_radio_childfield{% endif %}"
{% if attr.parent != '' %}data-parent="{{ attr.parent }}"{% endif %}
{% if currentValue != '' and currentValue != 'inherit' %}value="{{ currentValue }}"{% endif %}
id="simple_edit_options_{{ key }}" name="{{ key }}"
title="{{ gT("Inherited value:") }} {{ oParentOptions[key] }}"/>
{% elseif attr.type == 'text' %}
<input type="text"
class="form-control selector-text-input selector_text_option_value_field {% if attr.parent != '' %}selector_radio_childfield{% endif %}"
{% if attr.parent != '' %}data-parent="{{ attr.parent }}"{% endif %}
{% if currentValue != '' and currentValue != 'inherit' %}value="{{ currentValue }}"{% endif %}
id="simple_edit_options_{{ key }}" name="{{ key }}"
title="{{ gT("Inherited value:") }} {{ oParentOptions[key] }}"/>
{% endif %}
2026-06-17 10:06:07 +02:00
</div>
</div>
{% endif %}
{% endif %}
{% endfor %}
{% if tab.category == 'Images' %}</div>{% endif %}
{% if tab.category == 'Questions' and qLastCol > 0 %}</div>{% endif %}
{# close an open slot container at the end of a Fonts/Top-of-page pane
(every non-logo, non-rest slot has exactly two open divs: row + col) #}
{% if (tab.category == 'Fonts' or tab.id == 'top-of-page') and fLastSlot != 0 and fLastSlot != 'rest' and fLastSlot != 'logo' %}</div></div>{% endif %}
</div>
2026-06-17 10:06:07 +02:00
{% if tab.category == 'Images' %}
{# Upload an image; the actual upload form (#upload_frontend) is rendered by themeOptions/update.php #}
<div class="row action_hide_on_inherit">
<div class="ls-space margin bottom-15 top-15">
<div class="row ls-space margin bottom-15">
<div class="col-12 mb-1">
<label class="form-label" for="upload_image_frontend">{{ sprintf(gT("Upload an image (maximum size: %d MB):"), templateConfiguration.maxFileSize / 1024 / 1024) }}</label>
</div>
<div class="col-12">
<span id="fileselector_frontend">
<label class="btn btn-outline-secondary" for="upload_image_frontend" role="button" tabindex="0">
<input class="d-none" id="upload_image_frontend" name="upload_image_frontend" type="file">
<i class="ri-upload-fill ls-space margin right-10"></i>
{{ gT("Upload") }}
</label>
</span>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="progress">
<div id="upload_progress_frontend" class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;">
<span class="visually-hidden">0%</span>
2026-06-17 10:06:07 +02:00
</div>
</div>
</div>
</div>
</div>
</div>
{% endif %}
2026-06-17 10:06:07 +02:00
{# Footer at the bottom of every tab: "Proudly developed by [Respondage logo]",
linking to https://www.respondage.nl #}
{% if respondageLogo %}
<div class="row action_hide_on_inherit respondage-footer">
<div class="col-12 text-center mt-4 pt-3 border-top">
<a href="https://www.respondage.nl" target="_blank" rel="noopener noreferrer">
{{ gT("Proudly developed by") }}
<img src="{{ respondageLogo }}" alt="Respondage" style="max-height: 24px; width: auto; vertical-align: middle;">
</a>
2026-06-17 10:06:07 +02:00
</div>
</div>
{% endif %}
2026-06-17 10:06:07 +02:00
</div>
{% endfor %}
2026-06-17 10:06:07 +02:00
</div>
{# HOIST TABS: with optionspage=custom, core renders this whole page inside
one outer "Simple options" tab (ul#theme-options-tabs > li > #simple). Move our tab
buttons into the outer tab bar, our panes into the outer .tab-content and everything
else (spinner, inherit row, hr) above the outer tab bar, then drop the #simple
wrapper — so our category tabs sit at the SAME level as the outer bar.
Inline (rendered into the page HTML, so it runs on every fresh page load even with a
heuristically cached options.js; idempotent). Bootstrap 5 tabs use delegated click
handlers on document, so the moved buttons keep working without re-init. #}
{{ registerScript('respondage-hoist-tabs', "(function(){function hoist(){var outer=document.getElementById('theme-options-tabs');var simple=document.getElementById('simple');if(!outer||!simple){return;}var innerNav=null,innerContent=null,i;var kids=Array.prototype.slice.call(simple.children);for(i=0;i<kids.length;i++){if(kids[i].classList.contains('nav-tabs')){innerNav=kids[i];}else if(kids[i].classList.contains('tab-content')){innerContent=kids[i];}}if(!innerNav||!innerContent){return;}var outerContent=simple.parentNode;var refLi=null;var btns=outer.querySelectorAll('button[data-bs-toggle=\"tab\"]');for(i=0;i<btns.length;i++){if(btns[i].getAttribute('data-bs-target')==='#advanced'){refLi=btns[i].closest('li');}}var lis=innerNav.querySelectorAll('li');for(i=0;i<lis.length;i++){if(refLi){outer.insertBefore(lis[i],refLi);}else{outer.appendChild(lis[i]);}}btns=outer.querySelectorAll('button[data-bs-toggle=\"tab\"]');for(i=0;i<btns.length;i++){if(btns[i].getAttribute('data-bs-target')==='#simple'){var li=btns[i].closest('li');if(li&&li.parentNode){li.parentNode.removeChild(li);}}}var panes=Array.prototype.slice.call(innerContent.children);for(i=0;i<panes.length;i++){outerContent.appendChild(panes[i]);}var rest=Array.prototype.slice.call(simple.children);for(i=0;i<rest.length;i++){if(rest[i]!==innerNav&&rest[i]!==innerContent){outer.parentNode.insertBefore(rest[i],outer);}}if(simple.parentNode){simple.parentNode.removeChild(simple);}btns=outer.querySelectorAll('button[data-bs-toggle=\"tab\"]');for(i=0;i<btns.length;i++){btns[i].classList.remove('active');btns[i].setAttribute('aria-selected','false');}if(btns.length){btns[0].classList.add('active');btns[0].setAttribute('aria-selected','true');}}if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',hoist);}else{hoist();}})();", 'POS_END') }}
{# Lightbox modal for the image preview buttons #}
2026-06-17 10:06:07 +02:00
<div class="modal fade" tabindex="-1" role="dialog" id="lightbox-modal">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title selector__title h5"></h2>
2026-06-17 10:06:07 +02:00
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-12">
<img class="selector__image img-fluid" src="" alt="title"/>
2026-06-17 10:06:07 +02:00
</div>
</div>
</div>
</div>
</div>
</div>