fix: view.cfm empty elements_json check + modal instead of new tab (v1.0.72)

This commit is contained in:
2026-06-20 10:02:09 +04:00
parent 8cd40e3248
commit 2b01109a0c
2 changed files with 21 additions and 2 deletions
+17 -2
View File
@@ -61,7 +61,7 @@
<body>
<div class="topbar">
<img src="/nubes-logo.svg" alt="Nubes">
<span class="title">Сверка договоров — LLM <span style="font-weight:400;color:var(--muted);font-size:12px;">v1.0.71 — Lucee</span></span>
<span class="title">Сверка договоров — LLM <span style="font-weight:400;color:var(--muted);font-size:12px;">v1.0.72 — Lucee</span></span>
</div>
<div class="content">
@@ -178,7 +178,7 @@ function renderTable() {
'<td class="num-cell" style="font-size:12px;color:var(--muted);">' + formatSize(f.size) + '</td>' +
'<td class="status-cell">' + (f.status || '') + '</td>' +
'<td style="text-align:center;">' + radio + '</td>' +
'<td><button class="info-btn' + (f.doc_id ? ' visible' : '') + '" onclick="window.open(\'/view.cfm?doc_id=' + (f.doc_id||'') + '\', \'_blank\')" title="Просмотр"><i data-lucide="eye" style="width:16px;height:16px;"></i></button></td>' +
'<td><button class="info-btn' + (f.doc_id ? ' visible' : '') + '" onclick="showView(\'' + (f.doc_id||'') + '\')" title="Просмотр"><i data-lucide="eye" style="width:16px;height:16px;"></i></button></td>' +
'<td><button class="info-btn' + (f.doc_id ? ' visible' : '') + '" id="info_' + i + '" onclick="showInfo(' + i + ')" title="Инфо"><i data-lucide="info" style="width:16px;height:16px;"></i></button></td>' +
'<td><button class="remove-btn" onclick="removeFile(' + i + ')" title="Удалить"><i data-lucide="trash-2" style="width:16px;height:16px;"></i></button></td>' +
'</tr>';
@@ -522,8 +522,23 @@ function closeModal(e) {
if (e && e.target !== document.getElementById('modalOverlay')) return;
document.getElementById('modalOverlay').classList.remove('open');
}
async function showView(docId) {
document.getElementById('modalTitle').textContent = 'Просмотр документа';
document.getElementById('modalBody').innerHTML = '<span style="color:var(--muted);">Загрузка...</span>';
document.getElementById('modalOverlay').classList.add('open');
try {
var resp = await fetch('/view.cfm?doc_id=' + docId);
var text = await resp.text();
document.getElementById('modalBody').innerHTML = '<pre style="background:var(--brand-grey-light);padding:12px;border-radius:6px;font-size:12px;max-height:60vh;overflow-y:auto;white-space:pre-wrap;margin:0;">' + text.replace(/</g,'&lt;').replace(/>/g,'&gt;') + '</pre>';
} catch(e) {
document.getElementById('modalBody').innerHTML = '<span style="color:var(--destructive);">Ошибка загрузки</span>';
}
}
window.showInfo = showInfo;
window.closeModal = closeModal;
window.showView = showView;
// ── Промпт ───────────────────────────────────────────────────
var promptEditor = document.getElementById('promptEditor');
+4
View File
@@ -16,6 +16,10 @@
<cfoutput>not found</cfoutput><cfabort>
</cfif>
<cfif NOT len(doc.elements_json)>
<cfoutput>(ещё не распарсен — нажмите Парсинг)</cfoutput><cfabort>
</cfif>
<cfset elements = deserializeJSON(doc.elements_json)>
<cfset count = 0>
<cfset outLines = []>