This repository was archived by the owner on Jul 21, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
61 lines (54 loc) · 2.43 KB
/
Copy pathindex.html
File metadata and controls
61 lines (54 loc) · 2.43 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home - Book List</title>
<script src="https://unpkg.com/htmx.org@2.0.0"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
xintegrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
</head>
<body class="bg-light">
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<!-- This link is fixed: no hx-get to prevent double navbar -->
<a class="navbar-brand" href="/">Book Database</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<!-- hx-target now points to #content -->
<a class="nav-link" href="/add-book" hx-get="/add-book" hx-target="#content" hx-push-url="true">Add New Book</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- Page Content -->
<div id="content" class="container mt-4">
<h1 class="mb-4">Book List</h1>
<!-- This div will hold the book list -->
<div id="book-list">
{{range .Books}}
{{block "book-list-element" .}}
<!-- Re-styled as a Bootstrap Card -->
<div class="card mb-3">
<div class="card-body">
<h5 class="card-title">{{.Name}}</h5>
<h6 class="card-subtitle mb-2 text-muted">By: {{.Author}}</h6>
<p class="card-text mb-0"><strong>ID:</strong> {{.Id}}</p>
<p class="card-text"><strong>ISBN:</strong> {{.Isbn}}</p>
</div>
</div>
{{end}}
{{end}}
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
xintegrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
crossorigin="anonymous"></script>
</body>
</html>