-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
97 lines (82 loc) · 2.85 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://unpkg.com/[email protected]"
integrity="sha384-0gxUXCCR8yv9FM2b+U3FDbsKthCI66oH5IA9fHppQq9DDMHuMauqq1ZHBpJxQ0J0"
crossorigin="anonymous"></script>
<title>Hola Toriyama</title>
</head>
<body>
<div>
<h1>Hola Toriyama</h1>
<div style="display: grid; grid-template-columns: 1fr 1fr; column-gap: 2rem; justify-items: center;">
<div>
<h2>Personajes</h2>
<form hx-get="/mix/" hx-target="#mix-response" hx-swap="beforeend show:top" hx-indicator="#spinner">
<ul role="list" id="character-list">
{{ range .Characters }}
{{ block "character" .}}
<li style="display: flex; align-items: center; gap: 1rem;" class="character" id="{{ .Id }}">
<input id="select-{{ .Id }}" name="selected_characters" value="{{ .Name }}" type="checkbox">
<img style="width: 4rem;" src={{ .Image }} alt="" />
<div>
<p>
{{ .Name}}
</p>
<p>
{{ .Race }}
</p>
<button hx-delete="/delete/{{ .Id }}" hx-target="closest .character" hx-swap="outerHTML" hx-confirm="Estás seguro?">Eliminar</button>
</div>
</li>
{{ end }}
{{ end }}
</ul>
<button type="submit">Mezclar</button>
</form>
</div>
<div>
<h2>Agregar Personaje</h2>
<form hx-post="/add/" hx-target="#character-list" hx-swap="beforeend" hx-indicator="#spinner">
<div>
<div>
<label for="name">Nombre</label>
<div>
<input type="text" name="name" id="name" />
</div>
</div>
<div>
<label for="race">Especie</label>
<div>
<input type="text" name="race" id="race"/>
</div>
</div>
<div>
<label for="image">Imagen</label>
<div>
<input type="text" name="image" id="image"/>
</div>
</div>
</div>
<div>
<button type="button">
Cancelar
</button>
<button type="submit">
Agregar
</button>
</div>
<div role="status" id="spinner" class="htmx-indicator">
<img src="/images/loader1.gif" alt="">
<p>loading...</p>
</div>
</form>
<div style="margin-top: 2rem; display: flex; flex-direction: column;" id="mix-response">
</div>
</div>
</div>
</div>
</body>
</html>