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:
@@ -255,12 +255,6 @@ $pageConfig = [
|
||||
'sendEmail' => t('Send email'),
|
||||
'call' => t('Call'),
|
||||
'extraAssignments' => t('further assignments'),
|
||||
'drawerClose' => t('Close'),
|
||||
'drawerPrev' => t('Previous'),
|
||||
'drawerNext' => t('Next'),
|
||||
'drawerOpenFull' => t('Open full page'),
|
||||
'drawerLoading' => t('Loading'),
|
||||
'drawerError' => t('Failed to load'),
|
||||
],
|
||||
];
|
||||
?>
|
||||
|
||||
@@ -205,14 +205,6 @@ createListPageModule({
|
||||
fetchUrl: (uuid) => new URL(`address-book/view-fragment/${uuid}`, appBase).toString(),
|
||||
fullUrl: (uuid) => withCurrentListReturn(new URL(`address-book/view/${uuid}`, appBase).toString()),
|
||||
hashPrefix: 'user',
|
||||
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',
|
||||
},
|
||||
});
|
||||
|
||||
return gridConfig;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user