portfolio/templates/index.html
2024-03-13 15:54:09 +01:00

49 lines
1.8 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTMX & Go - Demo</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
<script src="https://unpkg.com/htmx.org@1.9.2" integrity="sha384-L6OqL9pRWyyFU3+/bjdSri+iIphTN/bvYyM37tICVyOJkWZLpP2vGn6VUEXgzg6h" crossorigin="anonymous"></script>
</head>
<body class="container">
<div class="row mt-4 g-4">
<div class="col-8">
<h1 class="mb-4">User List</h1>
<ul class="list-group fs-5 me-5" id="user-list">
{{ range .Names }}
{{ block "user-list" .}}
<li class="list-group-item bg-primary text-white">{{ .Name }}</li>
{{ end }}
{{ end }}
</ul>
</div>
<div class="col-4">
<h1 class="mb-4">Add User</h1>
<form hx-post="/api/user" hx-target="#user-form" hx-swap="beforeend" hx-indicator="#spinner" id="user-form">
<div class="mb-2">
<label for="user-name">Title</label>
<input type="text" name="name" id="user-name" class="form-control" />
</div>
<div class="mb-2">
<label for="user-name">Title</label>
<input type="text" name="role" id="user-role" class="form-control" />
</div>
<button type="submit" class="btn btn-primary">
<span class="spinner-border spinner-border-sm htmx-indicator" id="spinner" role="status" aria-hidden="true"></span>
Submit
</button>
</form>
</div>
</div>
</body>
</html>