meeat/templates/vote.html

73 lines
1.9 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="/static/htmx.min.js"></script>
<script src="/static/Sortable.min.js"></script>
<link rel="stylesheet" href="/static/style.css">
</head>
<body>
<p id="hello">Hallo, {{ session.user.email }}!</p>
<h1>
{{ meet.title }}
</h1>
<h2 id="h-day">
An welchem Tag?
</h2>
<form id="v-day" class="sortable" hx-post="/vote/date" hx-trigger="end">
{% for d in dates %}
<div class="sort-item">
{{ d.display or d.date }}
<input type="hidden" name="date" value="{{d.id}}">
</div>
{% endfor %}
</form>
<div id="r-day">
</div>
<h2 id="h-time">
Zu welcher Zeit?
</h2>
<form id="v-time" class="sortable" hx-post="/vote/time" hx-trigger="end">
{% for d in times %}
<div class="sort-item">
{{ d.display or d.time }}
<input type="hidden" name="time" value="{{d.id}}">
</div>
{% endfor %}
</form>
<div id="r-time">
</div>
<h2 id="h-place">
An welchem Ort?
</h2>
<form id="v-place" class="sortable" hx-post="/vote/place" hx-trigger="end">
{% for d in places %}
<div class="sort-item">
{{ d.name }}
<input type="hidden" name="place" value="{{d.id}}">
</div>
{% endfor %}
</form>
<div id="r-place">
</div>
</body>
<script>
function activateSortables(element) {
var sortables = document.querySelectorAll(".sortable");
for (const sortable of sortables) {
console.debug("making", sortable, "sortable")
new Sortable(sortable, {
animation: 150,
ghostClass: 'blue-background-class'
});
}
}
activateSortables(document)
//htmx.onLoad(function(content) { activateSortables(content) }
</script>
</html>