feat(options): Fonts tab becomes 'Fonts and colors' with per-element font+color combos (Prompt U)
Tab 'Fonts' is renamed to 'Fonts and colors' and gets a dedicated layout: top row (col 1: font, fontcolor, fontsize; col 2: primarycolor + new secondarycolor; col 3 empty), an hr, then one combo row per element (header, progressbar, questiontitle, answers, grouptitle, groupdescription, buttons) with col 1 = existing <el>font fontselect, col 2 = new <el>textcolor dropdown (default|primary|secondary|other), col 3 = new <el>textcolorcustom colorpicker, visible only when mode is 'other' (parent show-value via aShowIfValues, server-side initial d-none, options.js updateVisibilityByParent/updateChild now handle select parents, multi-value aware; font's self-parent removed from config.xml). config.xml: fontcolor/primarycolor moved from Colors to Fonts (retitled 'Default font color (body text)' / 'Primary color'), secondarycolor added (default #888888), 14 per-element color keys added with dropdownoptions. Views emit the per-element color as inline style (default->fontcolor, primary->primarycolor, secondary->secondarycolor, other->custom picker). Colors tab now only holds sliderhandlecolor + privacybackgroundcolor (final Colors layout = Prompt T, still open). Variants rebuilt (defensie, erasmus, example respondage_respondage) — no unknown-key failures; theme reset in LS-admin still owner action. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
671fba4aff
commit
9716aac4ee
1 changed files with 386 additions and 110 deletions
|
|
@ -311,14 +311,22 @@ var ThemeOptions = function () {
|
|||
let enabled = true;
|
||||
|
||||
if(parentEl.length) {
|
||||
// THEME ADDITION (Prompt R): parentEl is a SET of radios — read the
|
||||
// CHECKED one (not the first element) and accept any of the wrapper's
|
||||
// show-values (data-show-if-value, pipe-separated). Single-value
|
||||
// parents ('on') behave exactly as before.
|
||||
const checked = parentEl.filter(':checked');
|
||||
const wrapper = $(childEl).closest('.option-visibility');
|
||||
const showValues = String(wrapper.data('show-if-value') || 'on').split('|');
|
||||
enabled = checked.length > 0 && showValues.indexOf(String(checked.val())) !== -1;
|
||||
// THEME ADDITION (Prompt U): the parent may also be a <select> (e.g.
|
||||
// <el>textcolorcustom has parent <el>textcolor, a dropdown) — read the
|
||||
// select's current value instead of a checked radio.
|
||||
const parentSelect = parentEl.filter('select');
|
||||
if (parentSelect.length) {
|
||||
enabled = showValues.indexOf(String(parentSelect.val())) !== -1;
|
||||
} else {
|
||||
// THEME ADDITION (Prompt R): parentEl is a SET of radios — read the
|
||||
// CHECKED one (not the first element) and accept any of the wrapper's
|
||||
// show-values (data-show-if-value, pipe-separated). Single-value
|
||||
// parents ('on') behave exactly as before.
|
||||
const checked = parentEl.filter(':checked');
|
||||
enabled = checked.length > 0 && showValues.indexOf(String(checked.val())) !== -1;
|
||||
}
|
||||
}
|
||||
|
||||
$(childEl).prop('disabled', !enabled);
|
||||
|
|
@ -327,7 +335,8 @@ var ThemeOptions = function () {
|
|||
// grab the parent for a given child field
|
||||
const getParent = function(childEl) {
|
||||
const parentName = $(childEl).data('parent');
|
||||
const parentEl = $(`input[name=${parentName}]`);
|
||||
// THEME ADDITION (Prompt U): match selects too, not only radio inputs
|
||||
const parentEl = $(`input[name=${parentName}], select[name=${parentName}]`);
|
||||
return parentEl;
|
||||
};
|
||||
|
||||
|
|
@ -353,12 +362,20 @@ var ThemeOptions = function () {
|
|||
// value keeps working unchanged.
|
||||
const showValues = String($(wrapperEl).data('show-if-value') || 'on').split('|');
|
||||
const parentInputs = $('input[name="' + parentName + '"]');
|
||||
// no parent input in the markup (e.g. font's self-parent): always visible,
|
||||
const parentSelects = $('select[name="' + parentName + '"]');
|
||||
// no parent input in the markup: always visible,
|
||||
// same fallback as updateChild() above
|
||||
if (parentInputs.length === 0) {
|
||||
if (parentInputs.length === 0 && parentSelects.length === 0) {
|
||||
$(wrapperEl).removeClass('d-none');
|
||||
return;
|
||||
}
|
||||
// THEME ADDITION (Prompt U): select parent (e.g. <el>textcolor dropdown) —
|
||||
// visibility follows the select's current value, multi-value aware
|
||||
if (parentInputs.length === 0 && parentSelects.length > 0) {
|
||||
const visible = showValues.indexOf(String(parentSelects.val())) !== -1;
|
||||
$(wrapperEl).toggleClass('d-none', !visible);
|
||||
return;
|
||||
}
|
||||
const checked = parentInputs.filter(':checked');
|
||||
const visible = checked.length > 0 && showValues.indexOf(String(checked.val())) !== -1;
|
||||
$(wrapperEl).toggleClass('d-none', !visible);
|
||||
|
|
@ -621,6 +638,15 @@ var ThemeOptions = function () {
|
|||
|
||||
// THEME ADDITION: re-evaluate conditional visibility whenever a radio changes
|
||||
globalForm.find('.selector_option_radio_field').on('change', updateVisibilityByParent);
|
||||
|
||||
// THEME ADDITION (Prompt U): a changed SELECT may also be a parent of
|
||||
// conditional fields (e.g. <el>textcolor driving <el>textcolorcustom) —
|
||||
// bound separately so visibility updates even if updateFieldSettings()
|
||||
// above throws on the same event
|
||||
globalForm.find('select').on('change', function () {
|
||||
updateVisibilityByParent();
|
||||
updateAllChildren();
|
||||
});
|
||||
};
|
||||
|
||||
// THEME ADDITION: order the font dropdowns' optgroups as:
|
||||
|
|
|
|||
Loading…
Reference in a new issue