From 2942467cfda344778e2e3a519f1fdee6b7f55acf Mon Sep 17 00:00:00 2001 From: mwiegand Date: Sun, 17 May 2026 10:40:54 +0200 Subject: [PATCH] feat(files-overlay): filename click opens editor, actions align next to row MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces the dedicated edit button with a click target on the filename itself (download stays as a separate ⬇ action). Drops margin-left:auto on .files-row-actions so action buttons sit immediately after the row's name instead of at the far right. Co-Authored-By: Claude Opus 4.7 (1M context) --- l4d2web/l4d2web/static/css/components.css | 20 +++++++++++++++++-- l4d2web/l4d2web/static/js/files-overlay.js | 7 +++++-- .../l4d2web/templates/_overlay_file_node.html | 5 +++-- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/l4d2web/l4d2web/static/css/components.css b/l4d2web/l4d2web/static/css/components.css index dbac026..32cdcbf 100644 --- a/l4d2web/l4d2web/static/css/components.css +++ b/l4d2web/l4d2web/static/css/components.css @@ -254,6 +254,23 @@ dialog.modal::backdrop { padding-left: calc(1ch + var(--space-xs)); } +.file-tree-name-button { + background: none; + border: 0; + padding: 0; + font: inherit; + color: var(--color-link); + cursor: pointer; + text-align: left; + text-decoration: underline; + text-underline-offset: 2px; +} + +.file-tree-name-button:hover, +.file-tree-name-button:focus-visible { + text-decoration-thickness: 2px; +} + .file-tree-toggle[aria-expanded="true"] .chevron { transform: rotate(90deg); } @@ -583,8 +600,7 @@ button.danger-outline:hover { display: inline-flex; align-items: center; gap: var(--space-xs); - margin-left: auto; - padding-left: var(--space-m); + padding-left: var(--space-s); opacity: 0; pointer-events: none; transition: opacity 80ms ease; diff --git a/l4d2web/l4d2web/static/js/files-overlay.js b/l4d2web/l4d2web/static/js/files-overlay.js index 27ccb88..27f4eca 100644 --- a/l4d2web/l4d2web/static/js/files-overlay.js +++ b/l4d2web/l4d2web/static/js/files-overlay.js @@ -3,7 +3,8 @@ // overlay is type='files' and the user can edit). The script binds: // // * Per-row hover actions: + new file, + new folder, ⬇ zip, ✕ on -// folders; edit, ✕ on files (download is a regular ). +// folders; ⬇ (download), ✕ on files. Clicking the filename opens +// the editor (binary fallback for non-editable files). // * Drag-and-drop: dragging from the OS uploads (one POST per file, // queue with concurrency 3); dragging a row inside the tree moves // (rename/move via /files/move). @@ -977,7 +978,9 @@ // ---------- click delegation: action buttons ---------------------------- document.addEventListener("click", (event) => { - const action = event.target?.closest?.(".files-row-action[data-action]"); + const action = event.target?.closest?.( + ".files-row-action[data-action], .file-tree-name-button[data-action]" + ); if (!action) return; if (!manager.contains(action)) return; const op = action.dataset.action; diff --git a/l4d2web/l4d2web/templates/_overlay_file_node.html b/l4d2web/l4d2web/templates/_overlay_file_node.html index e8e980a..a03d1bd 100644 --- a/l4d2web/l4d2web/templates/_overlay_file_node.html +++ b/l4d2web/l4d2web/templates/_overlay_file_node.html @@ -24,7 +24,9 @@ {{ entry.name }} broken link {% else %} - {% if download_supported %} + {% if files_overlay %} + + {% elif download_supported %} {{ entry.name }} {% else %} {{ entry.name }} @@ -34,7 +36,6 @@ {% endif %} {% if files_overlay and not entry.broken %} -