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 <noreply@anthropic.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import {
|
||||
Check,
|
||||
ChevronDown,
|
||||
ChevronUp,
|
||||
FileText,
|
||||
Lock,
|
||||
Save,
|
||||
Settings
|
||||
@@ -270,6 +271,11 @@ function toggle(key: string) {
|
||||
<Settings size="1.2em" class="text-primary-500" />
|
||||
<h1 class="text-xl font-bold">Badges Config</h1>
|
||||
</div>
|
||||
<a href="/events/{event_id}/templates"
|
||||
class="btn btn-sm preset-tonal-surface"
|
||||
title="Manage Badge Templates">
|
||||
<FileText size="1em" class="mr-1" /> Templates
|
||||
</a>
|
||||
<div class="flex items-center gap-2">
|
||||
{#if save_status === 'success'}
|
||||
<span class="badge preset-tonal-success flex items-center gap-1">
|
||||
|
||||
Reference in New Issue
Block a user