This commit is contained in:
2025-09-27 13:37:40 +02:00
parent f06b9ce284
commit f49a2b31bb
4 changed files with 351 additions and 11 deletions

View File

@@ -1,10 +1,20 @@
<div class="row">
<div style="flex: 1 1 360px">
<form hx-post="/admin/items/create" hx-target="#items" hx-get="/admin/items" hx-swap="outerHTML">
<label>Neue Datei</label>
<label>Neue leere Datei (nur Metadaten)</label>
<div style="display:flex; gap:8px; margin-top:6px">
<input type="text" name="name" placeholder="z.B. notes.txt" required>
<button class="btn btn-primary" type="submit">Anlegen</button>
<button class="btn" type="submit">Anlegen</button>
</div>
</form>
</div>
<div style="flex: 1 1 360px">
<form action="/admin/files/upload" method="post" enctype="multipart/form-data">
<label>Datei hochladen</label>
<div style="display:flex; gap:8px; margin-top:6px">
<input type="file" name="file" required>
<input type="text" name="name" placeholder="Name (optional)">
<button class="btn btn-primary" type="submit">Upload</button>
</div>
</form>
</div>
@@ -14,7 +24,7 @@
<table>
<thead>
<tr>
<th>ID</th><th>Name</th><th>Updated</th><th style="width:200px">Aktionen</th>
<th>ID</th><th>Name</th><th>Updated</th><th>Blob</th><th style="width:260px">Aktionen</th>
</tr>
</thead>
<tbody>
@@ -23,25 +33,36 @@
<td>{{ .ID }}</td>
<td>{{ .Name }}</td>
<td><small class="muted">{{ printf "%.19s" (timeRFC3339 .UpdatedAt) }}</small></td>
<td>
{{ if .HasBlob }}
<span class="pill">vorhanden</span>
<small class="muted">{{ .Size }} B</small>
{{ else }}
<span class="pill" style="background:#3a0b0b;border-color:#5b1a1a;color:#fbb;">fehlt</span>
{{ end }}
</td>
<td>
<form style="display:inline-flex; gap:6px"
hx-post="/admin/items/rename"
hx-target="#items" hx-get="/admin/items" hx-swap="outerHTML">
<input type="hidden" name="id" value="{{ .ID }}">
<input type="text" name="name" placeholder="Neuer Name">
<button class="btn" type="submit" title="Umbenennen">Rename</button>
<button class="btn" type="submit">Rename</button>
</form>
<form style="display:inline"
hx-post="/admin/items/delete"
hx-target="#items" hx-get="/admin/items" hx-swap="outerHTML"
onsubmit="return confirm('Wirklich löschen?');">
onsubmit="return confirm('Wirklich löschen (inkl. Blob)?');">
<input type="hidden" name="id" value="{{ .ID }}">
<button class="btn" type="submit" title="Löschen">Delete</button>
<button class="btn" type="submit">Delete</button>
</form>
{{ if .HasBlob }}
<a class="btn" href="/admin/files/{{ .ID }}/download">Download</a>
{{ end }}
</td>
</tr>
{{ else }}
<tr><td colspan="4" class="muted">Keine Dateien vorhanden.</td></tr>
<tr><td colspan="5" class="muted">Keine Dateien vorhanden.</td></tr>
{{ end }}
</tbody>
</table>
@@ -54,4 +75,4 @@
<span class="pill">next={{ .Next }}</span>
</div>
{{ end }}
</div>
</div>