mirror of
https://github.com/sigoden/dufs.git
synced 2026-04-09 17:13:02 +03:00
feat: distinct upload and delete operation
This commit is contained in:
@@ -97,7 +97,7 @@ function addPath(file, index) {
|
||||
</a>
|
||||
</div>`;
|
||||
}
|
||||
if (!DATA.readonly) {
|
||||
if (DATA.allow_delete) {
|
||||
actionDelete = `
|
||||
<div onclick="deletePath(${index})" class="action-btn" id="deleteBtn${index}" title="Delete ${file.name}">
|
||||
<svg width="16" height="16" fill="currentColor"viewBox="0 0 16 16"><path d="M6.854 7.146a.5.5 0 1 0-.708.708L7.293 9l-1.147 1.146a.5.5 0 0 0 .708.708L8 9.707l1.146 1.147a.5.5 0 0 0 .708-.708L8.707 9l1.147-1.146a.5.5 0 0 0-.708-.708L8 8.293 6.854 7.146z"/><path d="M14 14V4.5L9.5 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2zM9.5 3A1.5 1.5 0 0 0 11 4.5h2V14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h5.5v2z"/></svg>
|
||||
@@ -137,7 +137,7 @@ async function deletePath(index) {
|
||||
throw new Error(await res.text())
|
||||
}
|
||||
} catch (err) {
|
||||
alert(`Fail to delete ${file.name}, ${err.message}`);
|
||||
alert(`Cannot delete \`${file.name}\`, ${err.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ function ready() {
|
||||
|
||||
addBreadcrumb(DATA.breadcrumb);
|
||||
DATA.paths.forEach((file, index) => addPath(file, index));
|
||||
if (!DATA.readonly) {
|
||||
if (DATA.allow_upload) {
|
||||
document.querySelector(".upload-control").classList.remove(["hidden"]);
|
||||
document.getElementById("file").addEventListener("change", e => {
|
||||
const files = e.target.files;
|
||||
|
||||
Reference in New Issue
Block a user