From 941ad6ae885030e48e6756fd547a72f629d2d81d Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Thu, 9 Apr 2026 20:31:38 -0400 Subject: [PATCH] Badges: template controls cfg, collapsible form sections, navigation polish - badge_template_form: fix default field visibility (location off render, pronouns/leads excluded from controls); fix duplicate QR checkboxes by removing orphan show_qr_front/back state vars; reorganize Advanced cfg_json into labeled sub-groups; make all 5 non-Advanced sections collapsible (general starts open, rest collapsed) - print_controls: add DEFAULT_SHOWN constant so field_shown() uses explicit whitelist fallback instead of showing all fields when no controls_cfg is set - badges config +page: add Templates navigation button in header (FileText icon) - templates +page: add back-nav header with ArrowLeft to badges/config, Settings icon, page title Co-Authored-By: Claude Sonnet 4.6 --- .../ae_comp__badge_print_controls.svelte | 7 +- .../(badges)/badges/config/+page.svelte | 6 + .../(badges)/templates/+page.svelte | 17 +- .../ae_comp__badge_template_form.svelte | 381 ++++++++++-------- 4 files changed, 234 insertions(+), 177 deletions(-) diff --git a/src/routes/events/[event_id]/(badges)/badges/[badge_id]/ae_comp__badge_print_controls.svelte b/src/routes/events/[event_id]/(badges)/badges/[badge_id]/ae_comp__badge_print_controls.svelte index 7bb57251..b4aad3ea 100644 --- a/src/routes/events/[event_id]/(badges)/badges/[badge_id]/ae_comp__badge_print_controls.svelte +++ b/src/routes/events/[event_id]/(badges)/badges/[badge_id]/ae_comp__badge_print_controls.svelte @@ -153,11 +153,16 @@ const DEFAULT_AUTH_EDITABLE = [ 'pronouns' ]; +// Default shown fields in the controls panel when the template has no explicit controls_cfg. +// Pronouns and lead scanning are off by default — most events don't expose them. +// WHY: prevents clutter for attendees at the badge table; events that need them must opt in via template config. +const DEFAULT_SHOWN = ['name', 'title', 'affiliations', 'location']; + /** Is this field card shown in the panel at all? trusted+edit always sees all fields. */ function field_shown(field: string): boolean { if (is_trusted && is_global_edit_mode) return true; const cfg = template_controls_cfg; - if (!cfg?.shown) return true; + if (!cfg?.shown) return DEFAULT_SHOWN.includes(field); return cfg.shown.includes(field); } diff --git a/src/routes/events/[event_id]/(badges)/badges/config/+page.svelte b/src/routes/events/[event_id]/(badges)/badges/config/+page.svelte index 8db1b1f9..04c9fbd4 100644 --- a/src/routes/events/[event_id]/(badges)/badges/config/+page.svelte +++ b/src/routes/events/[event_id]/(badges)/badges/config/+page.svelte @@ -26,6 +26,7 @@ import { Check, ChevronDown, ChevronUp, + FileText, Lock, Save, Settings @@ -270,6 +271,11 @@ function toggle(key: string) {

Badges Config

+ + Templates +
{#if save_status === 'success'} diff --git a/src/routes/events/[event_id]/(badges)/templates/+page.svelte b/src/routes/events/[event_id]/(badges)/templates/+page.svelte index 85ee3e9e..c3c25a5d 100644 --- a/src/routes/events/[event_id]/(badges)/templates/+page.svelte +++ b/src/routes/events/[event_id]/(badges)/templates/+page.svelte @@ -1,6 +1,6 @@