feature: move folders

This commit is contained in:
2026-07-27 12:37:27 -04:00
parent 03c06c0dd9
commit af7940a6d5
10 changed files with 839 additions and 38 deletions

View File

@@ -115,6 +115,7 @@
<script src="/static/keyboard-nav.js" defer></script>
<script src="/static/mobile.js" defer></script>
<script src="/static/archive.js" defer></script>
<script src="/static/folder-actions.js" defer></script>
<script src="/static/move.js" defer></script>
<script src="/static/permissions.js" defer></script>
<script src="/static/tags.js" defer></script>

View File

@@ -174,14 +174,35 @@
</h2>
<ul>
{{ range .Items }}
<li>
<li class="browser-item">
<a class="{{ if .Active }}is-active{{ end }} {{ if .IsFolder }}is-folder{{ end }}" href="{{ .URL }}" title="{{ .Name }}">
<span class="browser-item-label">
{{ if .IsFolder }}{{ template "icon-folder" }}{{ else }}{{ template "icon-file-text" }}{{ end }}
<span class="browser-item-name">{{ .Name }}</span>
</span>
{{ if .IsFolder }}{{ template "icon-chevron-right" }}{{ end }}
</a>
{{ if and $.CanWrite .IsFolder }}
<details class="browser-item-actions document-actions-dropdown">
<summary aria-haspopup="true" aria-label="Actions for folder {{ .Name }}" title="Folder actions">
{{ template "icon-kebab" }}
</summary>
<div class="document-actions-dropdown__menu">
<button class="document-actions-dropdown__item" type="button" data-folder-rename-path="{{ .Path }}">
{{ template "icon-rename" }}
<span>Rename</span>
</button>
<button class="document-actions-dropdown__item" type="button" data-folder-move-path="{{ .Path }}">
{{ template "icon-folder-move" }}
<span>Move</span>
</button>
<button class="document-actions-dropdown__item document-actions-dropdown__item--danger" type="button" data-folder-archive-path="{{ .Path }}">
{{ template "icon-archive" }}
<span>Archive</span>
</button>
</div>
</details>
{{ end }}
{{ if .IsFolder }}{{ template "icon-chevron-right" }}{{ end }}
</li>
{{ end }}
</ul>
@@ -237,3 +258,35 @@
<path d="m9 18 6-6-6-6"></path>
</svg>
{{ end }}
{{ define "icon-kebab" }}
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="5" r="1"></circle>
<circle cx="12" cy="12" r="1"></circle>
<circle cx="12" cy="19" r="1"></circle>
</svg>
{{ end }}
{{ define "icon-rename" }}
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 20h9"></path>
<path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path>
</svg>
{{ end }}
{{ define "icon-folder-move" }}
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M5 9V5h4"></path>
<path d="m5 5 6 6"></path>
<path d="M19 15v4h-4"></path>
<path d="m19 19-6-6"></path>
</svg>
{{ end }}
{{ define "icon-archive" }}
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="21 8 21 21 3 21 3 8"></polyline>
<rect x="1" y="3" width="22" height="5"></rect>
<line x1="10" y1="12" x2="14" y2="12"></line>
</svg>
{{ end }}