/
index.html
50 lines (48 loc) · 1.67 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html>
<head>
<title>Todo List</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@1/css/pico.min.css">
<!-- Drop in the HTMX lib-->
<script src="https://unpkg.com/htmx.org@1.9.6"></script>
<style>
li {
list-style-type: none !important;
}
input:checked + label {
text-decoration: line-through;
}
</style>
</head>
<body>
<div class="container" >
<br>
<!-- Sprinkle hx-boost="true" on all the things we want to be dynamic -->
<h1>Todo <span>({{counts['done']}}/{{counts['total']}})</span></h1>
<form action="/add" method="post" hx-boost="true" >
<input type="text" name="title" placeholder="New task" value="" autocomplete="off" >
<button type="submit" value="Add" class="button-primary" role="button" >Add</button>
</form>
<form action="/set_task_status" method="post" hx-boost="true" >
<ul>
% for task in tasks:
<li >
<input type="checkbox" id="task{{task['id']}}"
name="task"
value="{{task['id']}}"
% if task['done']:
checked
% end
>
<label for="task{{task['id']}}">{{task['title']}}</label>
<a href="/delete/{{task['id']}}" hx-boost="true" >X</a>
</li>
% end
</ul>
% if tasks:
<button type="submit" class="button-primary">Update</button>
% end
</form>
</div>
</body>
</html>