05/22 Enhance codes and fix bugs
This commit is contained in:
@@ -369,12 +369,10 @@ function loadExistingAtts() {
|
||||
}
|
||||
|
||||
function deleteAtt(attId, deleteUrl, filename) {
|
||||
if (!confirm('Delete "' + filename + '"?')) return;
|
||||
|
||||
const row = document.getElementById('att-row-' + attId);
|
||||
if (row) { row.style.opacity = '0.4'; row.style.pointerEvents = 'none'; }
|
||||
|
||||
fetch(deleteUrl, { method: 'POST', credentials: 'same-origin', headers: { 'X-CSRFToken': document.querySelector('meta[name="csrf-token"]').content } })
|
||||
confirmModal('Delete Attachment', 'Delete "' + filename + '"? This cannot be undone.', 'Delete', 'btn-danger', () => {
|
||||
const row = document.getElementById('att-row-' + attId);
|
||||
if (row) { row.style.opacity = '0.4'; row.style.pointerEvents = 'none'; }
|
||||
fetch(deleteUrl, { method: 'POST', credentials: 'same-origin', headers: { 'X-CSRFToken': document.querySelector('meta[name="csrf-token"]').content } })
|
||||
.then(r => r.json())
|
||||
.then(data => {
|
||||
if (data.ok) {
|
||||
@@ -395,6 +393,7 @@ function deleteAtt(attId, deleteUrl, filename) {
|
||||
if (row) { row.style.opacity = ''; row.style.pointerEvents = ''; }
|
||||
alert('Network error. Please try again.');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Load existing attachments on page load (only for edit mode)
|
||||
|
||||
Reference in New Issue
Block a user