Files
weight_tracker/templates/index.html
Lukas Wölfer 559f36224e
Some checks failed
Rust / build_and_test (push) Failing after 1m38s
feat: improve dependencies
2026-04-10 23:09:43 +02:00

27 lines
1.0 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>Weight Tracker</title>
<script src="https://unpkg.com/htmx.org@1.9.10"></script>
<link rel="stylesheet" href="/static/css/style.css">
</head>
<body>
<h1>Weight Tracker</h1>
<div id="weights">
{% for weight in weights %}
<p>{{ weight.date }}: {{ weight.weight }} kg by {{ weight.user_id }}</p>
{% endfor %}
</div>
<button onclick="document.getElementById('inputDialog').showModal()">Add Weight</button>
<dialog id="inputDialog">
<h1>Add Weight</h1>
<form hx-post="/input" hx-target="#weights" hx-swap="innerHTML" hx-on:htmx:after-request="document.getElementById('inputDialog').close()">
<label for="date">Date:</label>
<input type="date" id="date" name="date" required><br>
<label for="weight">Weight (kg):</label>
<input type="number" step="0.1" id="weight" name="weight" required><br>
<button type="submit">Submit</button>
</form>
</dialog>
</body>
</html>