Commit graph vanilla_respondage/options/options.js
Author SHA1 Message Date
920f0347c7 fix(options): default choice in the color dropdown bold via a real <b> element
Row 126 marked the default choice with data-default="1" and bolded it via
CSS (select option[data-default="1"]), but not every browser applies
font-weight to <option> elements, so the entry could still render non-bold.
refreshLabels in options.js now wraps the default option's label (including
its live hex) in a real <b> element, on top of the CSS rule — bold in every
browser. Non-default options stay plain. OPTIONS_JS_TOKEN -> 20261126.9.
Verified: render tc=588 (served as options.js?v=20261126.9), jsdom 6/6 incl.
new pins (default option contains <b> with its label, color1 has no <b>),
export exit 0. Variants not rebuilt (deferred).

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-26 15:59:46 +01:00
6300beaa88 feat(options): show the default choice of a color-chooser in bold (data-default marker)
The 5 named color choices were already in the requested order (row 125):
Default font color | Default background color | Color 1 | Color 2 | Color 3
('Other…' stays as the 6th dropdown entry that opens the custom picker).

New: the option's default choice is now visually marked. config.xml marks
the default <option data-default="1"> of every color-chooser dropdown
(navbarfontcolor + the five <el>textcolor dropdowns); options.twig's inline
<style> renders those options bold (select option[data-default="1"]) and
options.js adds .is-default (bold) to the matching swatch label, reading the
default from the DOM so any future chooser gets it automatically. For
navbarfontcolor the default is 'default' = 'Same as default font color'.
OPTIONS_JS_TOKEN -> 20261126.8. Verified: render tc=588 (dropdown order
default,defaultbackgroundcolor,color1,color2,color3,other with
data-default on 'default'; served as options.js?v=20261126.8), jsdom 6/6
incl. 4 new row-126 pins, export_public.sh exit 0. No view changes, live
survey unaffected. Variants not rebuilt (deferred).

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-26 15:50:28 +01:00
2f08e86335 feat(options): Default background color as 2nd choice; label 'Menu item color in header'; per-option default
- navbarfontcolor dropdown reordered to default|defaultbackgroundcolor|
  color1|color2|color3|other (options attr, optionlabels, dropdownoptions),
  and the swatch chips follow the same order (presets map key order in
  options.js) — 'Default background color' is now the second choice.
- Label of navbarfontcolor changed to 'Menu item color in header' (child
  navbarfontcolorcustom -> 'Custom menu item color ...').
- Per-option default mechanism made explicit: the config.xml <default> of a
  color-chooser dropdown is that option's default choice (stored on theme
  reset); navbarfontcolor keeps default 'default' = 'Same as default font
  color'. The JS no-value fallback no longer hardcodes 'default' but falls
  back to data-inheritvalue / the first non-inherit dropdown entry, so a
  future chooser (e.g. questiontitlebackgroundcolor defaulting to color1)
  can set its own default. custom_header.twig mapping unchanged.
- OPTIONS_JS_TOKEN -> 20261126.7. Verified: render tc=573 (dropdown order
  default,defaultbackgroundcolor,color1,color2,color3,other; label; divs
  balanced; served as options.js?v=20261126.7), jsdom 6/6 incl. new pins
  (dropdown order + chip order, Default background color 2nd), live survey
  282267 with stored mode 'default' renders navbar menu color = fontcolor
  #444444, export_public.sh exit 0. Variants not rebuilt (deferred).

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-26 15:13:45 +01:00
12ec2820da 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>
2026-11-26 14:57:25 +01:00
8a6cf1f919 fix(options): swatch-click outline moves even if a change handler throws
Row 122 follow-up: the outline followed dropdown changes (delegated document
handler, native events bubble) but not swatch clicks — the click handler did
sel.val(mode).trigger('change'); refreshAll();, and when the synthetic change
chain throws on the real page, jQuery aborts the rest of the click handler, so
refreshAll() never ran. Now the click handler sets the value and refreshes
FIRST, then fires trigger('change') inside try/catch. OPTIONS_JS_TOKEN ->
20261126.5. jsdom regression test: a throwing change handler on the select + chip
click still moves the outline (plus the existing dropdown/other assertions).
Suite 6/6, export 0. Variants not rebuilt (deferred).

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-26 14:46:19 +01:00
1c89032339 fix(options): active-swatch outline follows the choice immediately
The outline around the chosen swatch (.color-chip.active) only updated on page
load/save, not when the dropdown choice changed: the refresh was bound as a
direct change handler on the select, and on the real page an earlier direct
handler in the chain can throw, which aborts jQuery's dispatch so the refresh
never ran (native user events still bubble, synthetic triggers do not). Fixes:
the chip click handler now calls refreshAll() directly after triggering change,
and a delegated document-level change handler on select[name=navbarfontcolor]
acts as a backup that still fires for real user changes. OPTIONS_JS_TOKEN ->
20261126.4. jsdom test pins: outline moves on chip click and on dropdown
change, and no preset is outlined in mode 'other'. Suite 6/6, export 0.
Variants not rebuilt (deferred).

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-26 14:29:50 +01:00
f2316d1a5d fix(options): readable swatch chips + re-enable color swatch on 'Other'
Two fixes for the navbarfontcolor working example: (1) the hex value inside the
swatch chips was unreadable and obscured the color — chips are now plain color
swatches with the hex in a small label BELOW each swatch (.color-chip-label),
and the chips row uses gap: 10px so the swatches stand out. (2) The visible
color swatch input (navbarfontcolorcustom_picker) never re-enabled when
choosing 'Other…' from the dropdown: it lacked data-parent/selector_radio_childfield,
so updateChild/updateAllChildren never touched it and it stayed disabled
(server-side rendered disabled) — the text field was enabled but the swatch
the user actually clicks stayed grayed out. The swatch now gets the child
classes when parented, so it follows the mode like the text field (also fixes
the same latent bug for the per-element <el>textcolorcustom pickers).
OPTIONS_JS_TOKEN -> 20261126.3. jsdom test extended: swatch enabled in mode
'other'/disabled otherwise, hex below swatch, chip gap 10px asserted against
css/plain.css; suite 6/6, export 0. Variants intentionally not rebuilt.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-26 14:15:09 +01:00
dc27d63de5 fix(options): keep navbarfontcolorcustom in column 2, full-width swatch chips
The new navbarfontcolorcustom picker fell into the generic 'rest' slot of the
Top-of-the-page layout, which opened a NEW col-md-4 — so the picker landed in
column 3 next to the sticky checkboxes and left the divs unbalanced. Map the
key to slot h2 so it stays in column 2 under the navbarfontcolor dropdown,
rendered col-12 (full column width); column 3 is the sticky block again and
the pane markup is balanced (89/89 divs). The swatch chips under the dropdown
were tiny inline squares — make the chips row full column width with taller
flex chips showing the hex value (options.js chip.text). OPTIONS_JS_TOKEN
bumped to 20261126.2 (options.js changed). Layout pinned by jsdom assertions
(picker in the same col-md-4 as the dropdown, wrapper col-12); suite 6/6,
export 0. Variants intentionally not rebuilt (owner: deferred).

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-26 14:05:18 +01:00
f2ebf24270 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:55:30 +01:00
7939f3de3f fix(options): isolate startup steps so a throwing step can never kill saving again
Hardening against the 2026-11-25 regression (unguarded JSON.parse of
#optionCssFiles="inherit" at global level killed the whole options.js:
no handlers bound, Save silently posted stale JSON). run() now executes
each startup step through safeStep() (try/catch + console.ls.error) and
ALWAYS calls bind(), so the save/change handlers exist even if a prepare
step fails. OPTIONS_JS_TOKEN bumped to 20261125.5.

Regression guard added in variants/tests/options_save_global.test.js
(local-only, gitignored): loads the page with optionCssFiles="inherit"
(the global-page condition) and asserts the save button has a click
handler, pickers have input+change handlers, a swatch color change
reaches the saved options JSON on Save, and the label layout (checkbox
box before label; d-block label above btn-groups). Verified the test
FAILS on the pre-fix options.js and PASSES on the fixed one; full suite
5/5.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-25 21:28:43 +01:00
44e0e871d4 fix(options): guard JSON.parse of optionCssFiles so the options page works at global level
On the GLOBAL theme options page the hidden #optionCssFiles holds the
literal string "inherit" (not JSON). options.js did an unguarded
JSON.parse($('#optionCssFiles').val()) in the ThemeOptions constructor,
which threw and meant run() never executed: no change handlers and no
save handler were bound, so Save posted the stale options JSON and
nothing changed in the UI (e.g. colors on the Default fonts and colors
tab) was saved. Fall back to an empty file list on parse failure.
OPTIONS_JS_TOKEN bumped to 20261125.4.

Verified against the live page (themeOptions/update&id=497, where
optionCssFiles="inherit"): constructor no longer throws, picker
input/change handlers bind, and the save click writes the new color
into TemplateConfiguration[options]; real HTTP POST confirmed the
value lands in lime_template_configuration.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-25 21:25:25 +01:00
588199086a 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_<key> 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 <vibe@mistral.ai>
2026-11-25 21:05:01 +01:00
9716aac4ee 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>
2026-11-25 11:51:57 +01:00
671fba4aff feat(options): Questions tab as 3 columns with conditional border options + new questionhelpfontcolor (Prompt R)
config.xml: Questions options reordered into the three pane columns
(col1 colors+help, col2 border + children, col3 checkbox color), all
width=12; new colorpicker questionhelpfontcolor (default #444444);
questionbordercolor/style/dropdown + 4 radii get parent="questionborder".
options.twig: Questions pane renders three col-md-4 columns (border-start
between), options stacked as col-12; aShowIfValues map carries the
multi-value show list (box|top) as data-show-if-value since core passes
only parent through; server-side initial d-none is multi-value aware
(Prompt Q logic extended); buttons/colorpicker children now also get
data-parent/selector_radio_childfield. options.js: updateVisibilityByParent
and updateChild are multi-value + checked-radio aware (single-value
behaviour unchanged); OPTIONS_JS_TOKEN bumped.
custom_header.twig: .question-help-container gets color from
questionhelpfontcolor.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-25 11:35:18 +01:00
daf3d93bb3 fix(options): no loading-spinner flash on options-page load (Prompt I)
Remove the show/hide around the init prepare() call in options.js; the
spinner keeps its display:none default and is only shown during a real
upload (onBeforeSend/onSuccess in BindUpload). Bump OPTIONS_JS_TOKEN to
20261124.4 so browsers fetch the changed options.js once.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-24 22:33:11 +01:00
cffd3cefa6 feat!: rename theme respondage_vanilla -> vanilla_respondage, variants -> respondage_<client>
Prompt V (prompts.md rows 51-54). Mother theme folder + <name> renamed to
vanilla_respondage (version 3.3.0); client variants renamed to
respondage_defensie / respondage_erasmus (<extends>vanilla_respondage</extends>,
auto-derived by build.php). export_public.sh now derives the release name from
the theme dir and the leak-check glob matches ../respondage_* siblings, so the
public-release leak check keeps working after the rename (sabotage-tested).
All doc/tooling references updated; local-only files stay gitignored.

Also includes the pending uncommitted theme work from this testing week
(custom options page, header logos, sticky-header options, bundled OFL fonts,
per-element font overrides, font-dropdown reordering, jsdom tests) that was
verified locally but not yet pushed.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-24 22:04:11 +01:00
fd7ecba1a3 chore: normalize all line endings to LF and enforce via .gitattributes
All text files in the theme (config.xml, sass, css, js, twig, md) used mixed
CRLF/LF. Normalize everything to LF (Unix), matching the LimeSurvey core
themes. .gitattributes (* text=auto eol=lf, binary images/fonts) keeps it
that way; config.xml documents the convention in its header comment.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-16 19:36:04 +01:00
a023555acf First commit after long time, too much to describe (sorry) 2026-07-07 16:05:43 +02:00
e3be1bcde7 First commit 2026-06-17 10:06:07 +02:00