Data view

This commit is contained in:
2024-11-10 07:04:24 +01:00
parent 5d267af600
commit 99dddb9a0e
14 changed files with 201 additions and 10 deletions

File diff suppressed because one or more lines are too long

View File

@@ -32,7 +32,9 @@
Made with 💗 in Poland
</p>
<span class="flex-1"></span>
<a href="/projects"> Projects </a>
<a href="https://blog.gabrielkaszewski.dev/" target="_blank"> Blog </a>
<a href="/projects">Projects</a>
<a href="https://blog.gabrielkaszewski.dev/" target="_blank">Blog</a>
<a href="/data">Files</a>
<a href="/login">Login</a>
</div>
</footer>

View File

@@ -1,12 +1,13 @@
{% extends "website/base.html" %} {% block content %}
<script src="/static/js/data-upload.js" defer></script>
<div class="w-full mt-16"></div>
<form id="data-upload" class="text-black">
<form id="data-upload" class="flex flex-col gap-2 text-black">
<label class="text-white" for="file">Upload a file:</label>
<input id="file-input" type="file" id="file" name="file" required />
<label class="text-white" for="protected">Protected:</label>
<input id="protected-input" type="checkbox" id="protected" name="protected" />
<button class="text-white" type="submit">Upload</button>
<div>
<label class="text-white" for="protected">Protected:</label>
<input id="protected-input" type="checkbox" id="protected" name="protected" />
</div>
<button class="p-2 text-gray-900 bg-yellow-500 rounded-sm shadow hover:bg-yellow-600" type="submit">Upload</button>
</form>
{% endblock content%}

View File

@@ -0,0 +1,25 @@
{% extends "website/base.html" %} {% block content %}
<span class="mt-8"></span>
<a class="p-2 text-gray-900 bg-yellow-500 rounded-sm shadow hover:bg-yellow-600" href="/upload">Add new file</a>
<table class="table-fixed">
<thead class="flex items-center gap-2 mb-4">
<tr>
<th>File name</th>
<th>Created at</th>
<th>Protected</th>
<th>Download</th>
</tr>
</thead>
<tbody class="flex flex-col gap-2">
{% for file in data %}
<tr class="flex items-center gap-2">
<td>{{ file.file_name }}</td>
<td>{{ file.created_at | date(format="%Y-%m-%d %H:%M") }}</td>
<td>{{ file.protected }}</td>
<td><a class="p-2 text-gray-900 bg-yellow-500 rounded-sm shadow hover:bg-yellow-600"
href="/api/data/{{ file.file_name }}">Download</a></td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock content%}