From f7872b09806a8e425abc1dd3ab194abba71a7e12 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Tue, 8 Sep 2026 10:44:15 -0400 Subject: [PATCH] Use showConfirmModal() instead of browser confirm() for template overwrite (#53) CreateTicketView.php was the one remaining spot using the native confirm() dialog, violating README Dev Note #21. Split loadTemplate() into a confirm check + applyTemplate(), routed through the project's styled showConfirmModal(), matching every other destructive-action confirmation in the app. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01MGDKHiU5RJdo3dqQUDow3X --- views/CreateTicketView.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/views/CreateTicketView.php b/views/CreateTicketView.php index c668cce..7714d4c 100644 --- a/views/CreateTicketView.php +++ b/views/CreateTicketView.php @@ -344,12 +344,23 @@ include __DIR__ . '/layout_header.php'; var existingTitle = (document.getElementById('title').value || '').trim(); var existingDesc = (document.getElementById('description').value || '').trim(); if (existingTitle || existingDesc) { - if (!confirm('Applying this template will overwrite your current title and description. Continue?')) { - document.getElementById('templateSelect').value = ''; - return; - } + showConfirmModal( + 'Overwrite content?', + 'Applying this template will overwrite your current title and description. Continue?', + 'warning', + applyTemplate, + function () { document.getElementById('templateSelect').value = ''; } + ); + return; } + applyTemplate(); + } + + function applyTemplate() { + var tplId = document.getElementById('templateSelect').value; + if (!tplId) return; + lt.api.get('/api/get_template.php?template_id=' + encodeURIComponent(tplId)) .then(function (data) { if (!data.success || !data.template) {