From 0a2214bfaf67cd0a0bf051ed6904610519bee129 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Fri, 20 Mar 2026 22:07:49 -0400 Subject: [PATCH] Improve web_template compliance: lt.bytes.format, lt.tableNav, lt.statsFilter - ticket.js: replace custom formatFileSize() with lt.bytes.format() from web_template base.js; remove the now-redundant local function - DashboardView.php: add id="tickets-table" and wire lt.tableNav.init() for j/k/Enter keyboard row navigation - DashboardView.php: add lt-stat-card class + data-filter-key/data-filter-val to open/critical/closed stat cards; wire lt.statsFilter.init() + window.lt_onStatFilter so clicking a stat card filters the ticket list Co-Authored-By: Claude Sonnet 4.6 --- assets/js/ticket.js | 13 +------------ views/DashboardView.php | 31 +++++++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/assets/js/ticket.js b/assets/js/ticket.js index 2124b5a..0b25941 100644 --- a/assets/js/ticket.js +++ b/assets/js/ticket.js @@ -827,7 +827,7 @@ function renderAttachments(attachments) {
- ${lt.escHtml(att.file_size_formatted || formatFileSize(att.file_size))} • ${lt.escHtml(uploaderName)} • ${uploadDate} + ${lt.escHtml(att.file_size_formatted || lt.bytes.format(att.file_size))} • ${lt.escHtml(uploaderName)} • ${uploadDate}
@@ -841,17 +841,6 @@ function renderAttachments(attachments) { container.innerHTML = html; } -function formatFileSize(bytes) { - if (bytes >= 1073741824) { - return (bytes / 1073741824).toFixed(2) + ' GB'; - } else if (bytes >= 1048576) { - return (bytes / 1048576).toFixed(2) + ' MB'; - } else if (bytes >= 1024) { - return (bytes / 1024).toFixed(2) + ' KB'; - } else { - return bytes + ' bytes'; - } -} function deleteAttachment(attachmentId) { showConfirmModal( diff --git a/views/DashboardView.php b/views/DashboardView.php index fd42bbe..f504fb1 100644 --- a/views/DashboardView.php +++ b/views/DashboardView.php @@ -183,14 +183,14 @@ $nonce = SecurityHeadersMiddleware::getNonce();
-
+
[ # ]
Open Tickets
-
+
[ ! ]
@@ -211,7 +211,7 @@ $nonce = SecurityHeadersMiddleware::getNonce();
Created Today
-
+
[ OK ]
@@ -385,7 +385,7 @@ $nonce = SecurityHeadersMiddleware::getNonce();
- +
@@ -838,6 +838,29 @@ $nonce = SecurityHeadersMiddleware::getNonce();