Collector/templates/admin.html

61 lines
2.0 KiB
HTML

<!-- admin.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Admin</title>
</head>
<body>
<h1>Albums</h1>
<table border="1">
<tr>
<th>ID</th>
<th>Title</th>
<th>Artist</th>
<th>Year</th>
<th>Actions</th>
</tr>
{% for album in albums %}
<tr>
<td>{{ album.id }}</td>
<td>{{ album.title }}</td>
<td>{{ album.artist }}</td>
<td>{{ album.year }}</td>
<td>
<form action="/admin" method="post">
<input type="hidden" name="action" value="edit">
<input type="hidden" name="album_id" value="{{ album.id }}">
<input type="text" name="title" placeholder="New Title">
<input type="text" name="artist" placeholder="New Artist">
<input type="number" name="year" placeholder="New Year">
<button type="submit">Edit</button>
</form>
<form action="/admin" method="post">
<input type="hidden" name="action" value="delete">
<input type="hidden" name="album_id" value="{{ album.id }}">
<button type="submit">Delete</button>
</form>
</td>
</tr>
{% endfor %}
</table>
<!-- Form for adding a new album -->
<h2>Add New Album</h2>
<form action="/admin" method="post">
<input type="hidden" name="action" value="add_album">
<label for="title">Title:</label>
<input type="text" id="title" name="title" required>
<br>
<label for="artist">Artist:</label>
<input type="text" id="artist" name="artist" required>
<br>
<label for="year">Year:</label>
<input type="number" id="year" name="year" required>
<br>
<button type="submit">Add Album</button>
</form>
</body>
</html>