-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
54 lines (52 loc) · 1.63 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
51
52
53
54
<!DOCTYPE html>
<html>
<head>
<title>Todo List</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@1/css/pico.min.css">
<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>
<h1>Todo <span>({{counts['done']}}/{{counts['total']}})</span></h1>
<form action="/tasks/" 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
hx-trigger="change"
hx-put="/tasks/"
hx-swap="outerHTML"
hx-target="body"
>
<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
hx-delete="/tasks/{{task['id']}}"
hx-swap="outerHTML"
hx-target="body"
>X</a>
</li>
% end
</ul>
</form>
</div>
</body>
</html>