Lisää kansion poisto -toiminto dokumenttien hallintaan
- Poisto-nappi (🗑) näkyy kansion päällä hover-tilassa - Vahvistusikkuna ennen poistoa - Kansion dokumentit ja alikansiot siirtyvät ylätasolle poistettaessa Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
10
script.js
10
script.js
@@ -4921,7 +4921,7 @@ function renderDocFolderBar() {
|
|||||||
const subfolders = allDocFolders.filter(f => (f.parent_id || null) === currentDocFolderId);
|
const subfolders = allDocFolders.filter(f => (f.parent_id || null) === currentDocFolderId);
|
||||||
const grid = document.getElementById('doc-folders-grid');
|
const grid = document.getElementById('doc-folders-grid');
|
||||||
grid.innerHTML = subfolders.map(f =>
|
grid.innerHTML = subfolders.map(f =>
|
||||||
`<div class="doc-folder-item" onclick="navigateDocFolder('${f.id}')">📁 ${esc(f.name)}</div>`
|
`<div class="doc-folder-item" onclick="navigateDocFolder('${f.id}')">📁 ${esc(f.name)}<button class="doc-folder-delete" onclick="event.stopPropagation();deleteDocFolder('${f.id}','${esc(f.name)}')" title="Poista kansio">🗑</button></div>`
|
||||||
).join('');
|
).join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4944,6 +4944,14 @@ function navigateDocFolder(folderId) {
|
|||||||
renderDocumentsList();
|
renderDocumentsList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function deleteDocFolder(folderId, folderName) {
|
||||||
|
if (!confirm(`Poistetaanko kansio "${folderName}"?\n\nKansion dokumentit ja alikansiot siirretään ylätasolle.`)) return;
|
||||||
|
try {
|
||||||
|
await apiCall('document_folder_delete', 'POST', { id: folderId });
|
||||||
|
await loadDocuments();
|
||||||
|
} catch (e) { alert('Kansion poisto epäonnistui: ' + e.message); }
|
||||||
|
}
|
||||||
|
|
||||||
// ---- Sub-tabit ----
|
// ---- Sub-tabit ----
|
||||||
|
|
||||||
function switchDocSubTab(target) {
|
function switchDocSubTab(target) {
|
||||||
|
|||||||
@@ -1621,6 +1621,9 @@ span.empty {
|
|||||||
transition: background 0.15s, border-color 0.15s;
|
transition: background 0.15s, border-color 0.15s;
|
||||||
}
|
}
|
||||||
.doc-folder-item:hover { background: #e5e7eb; }
|
.doc-folder-item:hover { background: #e5e7eb; }
|
||||||
|
.doc-folder-delete { background: none; border: none; cursor: pointer; font-size: 0.75rem; padding: 0 0.15rem; opacity: 0; transition: opacity 0.15s; margin-left: 0.25rem; }
|
||||||
|
.doc-folder-item:hover .doc-folder-delete { opacity: 0.6; }
|
||||||
|
.doc-folder-delete:hover { opacity: 1 !important; }
|
||||||
|
|
||||||
#doc-breadcrumbs a { color: var(--primary-color); text-decoration: none; font-weight: 500; }
|
#doc-breadcrumbs a { color: var(--primary-color); text-decoration: none; font-weight: 500; }
|
||||||
#doc-breadcrumbs a:hover { text-decoration: underline; }
|
#doc-breadcrumbs a:hover { text-decoration: underline; }
|
||||||
|
|||||||
Reference in New Issue
Block a user