feat: create per song page
feat: add edit id
This commit is contained in:
1 parent
cb050dbc44
commit
6595eed927
4 files changed
+53
-2
No files matched your search
@@ -0,0 +1,44 @@
|
||||
{% extends "admin.html" %}
|
||||
|
||||
{% block admin_title %}Kopie erstellen{% endblock %}
|
||||
|
||||
{% block admin_content %}
|
||||
<form class="form" id="form">
|
||||
<label for="titel">Titel</label>
|
||||
<input id="title" name="title" type="text" autocomplete="off" required autofocus>
|
||||
|
||||
<label for="artist">Artist</label>
|
||||
<input id="artist" name="artist" type="text" autocomplete="off">
|
||||
|
||||
<label for="file">Datei</label>
|
||||
<div class="file-upload">
|
||||
<input id="file" name="file" type="file" accept="audio/*,.mp3,.wav,.flac,.ogg,.m4a" required>
|
||||
<label for="file" class="file-button">Audiodatei wählen</label>
|
||||
<span class="file-name" id="file-name">Keine Datei ausgewählt</span>
|
||||
</div>
|
||||
|
||||
<button type="submit">Erstellen</button>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
const form = document.getElementById("form");
|
||||
form.addEventListener("submit", async (event) => {
|
||||
event.preventDefault();
|
||||
const res = await fetch("/api/admin/add", {
|
||||
method: "POST",
|
||||
body: new FormData(form),
|
||||
});
|
||||
const result = await res.json();
|
||||
console.log(result);
|
||||
});
|
||||
|
||||
const fileInput = document.getElementById("file");
|
||||
const fileName = document.getElementById("file-name");
|
||||
fileInput.addEventListener("change", () => {
|
||||
fileName.textContent = fileInput.files.length
|
||||
? fileInput.files[0].name
|
||||
: "Keine Datei ausgewählt";
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
Reference in new issue
Block a user