commit 7f2a72a746aa1cfcc73cee2c86b49a795ad26dd2
parent a7814a27cc86f532336ff679ab5f4dbde5842ef7
Author: breadcat <breadcat@users.noreply.github.com>
Date: Fri, 19 Sep 2025 18:07:14 +0100
Initial Templates and CSS
Diffstat:
5 files changed, 117 insertions(+), 0 deletions(-)
diff --git a/static/style.css b/static/style.css
@@ -0,0 +1,3 @@
+body {background: #1a1a1a; color: #cfcfcf; font-family: sans-serif}
+a {color: lightblue; text-decoration: none}
+a:hover {text-decoration: underline}
+\ No newline at end of file
diff --git a/templates/file.html b/templates/file.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>File {{.File.Filename}}</title>
+ <link rel="stylesheet" type="text/css" href="/static/style.css">
+</head>
+<body>
+<h2>File: {{.File.Filename}}</h2>
+
+{{if hasAnySuffix .File.Filename ".jpg" ".jpeg" ".png" ".gif"}}
+ <img src="/uploads/{{.File.Filename}}" style="max-width:400px"><br>
+{{else if hasAnySuffix .File.Filename ".mp4" ".webm" ".mov"}}
+ <video controls width="400">
+ <source src="/uploads/{{.File.Filename}}">
+ </video><br>
+{{else}}
+ <a href="/uploads/{{.File.Filename}}">Download file</a><br>
+{{end}}
+
+<h3>Tags</h3>
+<ul>
+{{range $k, $v := .File.Tags}}
+ <li>{{$k}}: {{$v}}
+ <form style="display:inline" method="post" action="/file/{{$.File.ID}}/tag/{{$k}}/{{$v}}/delete">
+ <button type="submit">Remove</button>
+ </form>
+ </li>
+{{else}}
+ <li>No tags yet</li>
+{{end}}
+</ul>
+
+<h3>Assign New Tag</h3>
+<form method="post">
+ Category: <input type="text" name="category" list="categories"><br>
+ <datalist id="categories">
+ {{range .Categories}}
+ <option value="{{.}}">
+ {{end}}
+ </datalist>
+ Value: <input type="text" name="value"><br>
+ <button type="submit">Add Tag</button>
+</form>
+
+<p><a href="/">← Back to list</a></p>
+</body>
+</html>
diff --git a/templates/list.html b/templates/list.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Files</title>
+ <link rel="stylesheet" type="text/css" href="/static/style.css">
+</head>
+<body>
+<h1>Files</h1>
+<p><a href="/upload">Upload new file</a> | <a href="/tags">Browse tags</a></p>
+
+<ul>
+{{range .}}
+ <li>
+ <a href="/file/{{.ID}}">{{.Filename}}</a><br>
+ {{if hasAnySuffix .Filename ".jpg" ".jpeg" ".png" ".gif"}}
+ <img src="/uploads/{{.Filename}}" style="max-width:150px">
+ {{else if hasAnySuffix .Filename ".mp4" ".webm" ".mov"}}
+ <video width="150" controls>
+ <source src="/uploads/{{.Filename}}">
+ </video>
+ {{end}}
+ </li>
+{{else}}
+ <li>No files uploaded yet.</li>
+{{end}}
+</ul>
+</body>
+</html>
diff --git a/templates/tags.html b/templates/tags.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Tags</title>
+ <link rel="stylesheet" type="text/css" href="/static/style.css">
+</head>
+<body>
+<h1>All Tags</h1>
+<p><a href="/">Back to files</a></p>
+
+{{range $cat, $tags := .}}
+ <h3>{{$cat}}</h3>
+ <ul>
+ {{range $tags}}
+ <li><a href="/tag/{{$cat}}/{{.Value}}">{{.Value}} ({{.Count}})</a></li>
+ {{end}}
+ </ul>
+{{end}}
+</body>
+</html>
diff --git a/templates/upload.html b/templates/upload.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <link rel="stylesheet" type="text/css" href="/static/style.css">
+</head>
+<body>
+<h2>Upload File</h2>
+<form method="post" enctype="multipart/form-data">
+ <input type="file" name="file">
+ <button type="submit">Upload</button>
+</form>
+<a href="/">Back to files</a>
+</body>
+</html>
+\ No newline at end of file