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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MGDKHiU5RJdo3dqQUDow3X
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user