From 588199086a0dcdadb808b7ddcc28c155c31cec07 Mon Sep 17 00:00:00 2001 From: Tammo ter Hark Date: Wed, 25 Nov 2026 21:05:01 +0100 Subject: [PATCH] fix(options): checkbox box before label, labels above controls, live color-swatch sync - checkboxes (incl. the 9 logo show-on boxes): back to classic .form-check with the input BEFORE the label (label right of the box); label keeps id lbl_simple_edit_options_ so JS/test anchors are unchanged - all other option types: label gets d-block so it sits above the control even next to an inline-flex btn-group (Simple options / Questions tabs) - options.js: color swatch syncs on 'input' as well as 'change', so a color picked in the native popup is already in the saved JSON when Save is clicked (browsers fire 'change' only when the popup closes); OPTIONS_JS_TOKEN bumped to 20261125.3 Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe --- options/options.js | 7 ++++++- options/options.twig | 42 +++++++++++++++++++++++++----------------- 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/options/options.js b/options/options.js index b4e3f62..ace04fe 100644 --- a/options/options.js +++ b/options/options.js @@ -511,8 +511,13 @@ var ThemeOptions = function () { //hotswapping the colorpickers and adding the reset functionality var hotswapColorPicker = function () { + // THEME ADDITION: bind 'input' as well as 'change' — browsers fire 'input' + // live while the native color popup is dragged and 'change' only when it + // closes, so without 'input' a color picked but not yet "closed" would be + // lost when Save is clicked; syncing live makes the text field (and thus + // the saved options JSON) always carry the latest picked color. globalForm.find('.selector__colorpicker-inherit-value') - .on('change', function (e) { + .on('change input', function (e) { $(this).closest('.input-group').find('.selector_option_value_field').val($(this).val()).trigger('change'); }); diff --git a/options/options.twig b/options/options.twig index c803e53..41f4901 100644 --- a/options/options.twig +++ b/options/options.twig @@ -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 = '20261125.2' %} +{% set OPTIONS_JS_TOKEN = '20261125.3' %} {{ unregisterScriptFile(optionsPath ~ '/options.js') }} {{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }} @@ -355,13 +355,13 @@ {% 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] : '')) %} -
- +
+
{% endfor %}
@@ -409,8 +409,13 @@
- {# label ALWAYS above the control, for every option type #} - + {# 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' %} + + {% endif %} {% if key == 'headersticky' %} {% elseif attr.type == 'buttons' %} @@ -435,18 +440,21 @@
{% elseif attr.type == 'checkbox' %} - {# checkbox: checked = "on", unchecked = "off". The label sits above - the box via the generic form-label at the top of this block (same - id lbl_simple_edit_options_, 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. #} - + {# 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_) 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. #} +
+ + +
{% elseif attr.type == 'dropdown' %} {% set ddClasses = 'form-select selector_option_value_field' %}