refactor(ui): move detail drawer chrome to a server-rendered partial

The drawer chrome used to be built in JS via a 50-line innerHTML string
and needed every caller to plumb through a labels object sourced from
per-page PHP config. That diverged from the codebase convention — the
confirm dialog, search dialog and session warning are all PHP partials
mounted once in templates/default.phtml. The drawer now follows the
same pattern: templates/partials/app-detail-drawer.phtml renders the
markup with t() labels, default.phtml mounts it inside the logged-in
shell, and the JS only attaches behavior via the [data-detail-drawer]
selector.

Knock-on cleanup: ensureDrawerElement and resolveLabels disappear from
the JS, all three initDetailDrawer callers (admin/users, address book,
helpdesk debitor) drop their labels parameter, and the matching dead
'drawerClose'/'drawerPrev'/… entries leave the per-page PHP grid configs.
The drawer also gains a clean fallback when the partial is missing
(console warn + null return), so logged-out edges can't crash.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-25 19:06:06 +02:00
parent b205ba1312
commit 4d1bd13a3b
9 changed files with 69 additions and 107 deletions

View File

@@ -351,12 +351,6 @@ $searchConfig = is_array($searchConfig ?? null) ? $searchConfig : null;
'support' => t('Support'),
'created' => t('Created'),
'lastActivity' => t('Last activity'),
'drawerClose' => t('Close'),
'drawerPrev' => t('Previous'),
'drawerNext' => t('Next'),
'drawerOpenFull' => t('Open full page'),
'drawerLoading' => t('Loading'),
'drawerError' => t('Failed to load'),
],
'gridSearch' => $searchConfig,
'filterSchema' => $clientFilterSchema,

View File

@@ -848,14 +848,6 @@ function init(container) {
onContentLoaded: (contentEl) => {
try { initHelpdeskTicket(contentEl); } catch (err) { console.warn('[helpdesk-detail] initHelpdeskTicket failed', err); }
},
labels: {
close: labels.drawerClose || 'Close',
previous: labels.drawerPrev || 'Previous',
next: labels.drawerNext || 'Next',
openFull: labels.drawerOpenFull || 'Open full page',
loading: labels.drawerLoading || 'Loading',
error: labels.drawerError || 'Failed to load',
},
});
} finally {
ticketsGridInitializing = false;