Initial MVP: Go + templ Tolino-optimized ebook library scaffold

This commit is contained in:
Arne
2026-08-06 06:52:41 +02:00
parent bf077c0cf6
commit 8d499c28a7
11 changed files with 440 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
package views
import "github.com/arnef/ebooks/internal/library"
templ Layout(title string) {
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>{ title }</title>
<link rel="stylesheet" href="/static/styles.css" />
</head>
<body>
<header class="header">
<h1><a href="/">eBook Library</a></h1>
</header>
<main class="container">
{ children... }
</main>
</body>
</html>
}
templ IndexPage(books []library.Book) {
@Layout("Bibliothek") {
<h2>Meine Bücher</h2>
if len(books) == 0 {
<p>Keine eBooks gefunden. Lege EPUB- oder PDF-Dateien im Ordner <code>books/</code> ab.</p>
} else {
<ul class="book-list">
for _, b := range books {
<li class="book-item">
<a class="book-link" href={ "/book/" + b.ID }>{ b.Title }</a>
<span class="format">{ b.Format }</span>
</li>
}
</ul>
}
}
}
templ BookPage(book library.Book) {
@Layout(book.Title) {
<article>
<h2>{ book.Title }</h2>
<p><strong>Datei:</strong> { book.Filename }</p>
<p><strong>Format:</strong> { book.Format }</p>
<p><a class="btn" href={ "/download/" + book.ID }>Auf Tolino herunterladen</a></p>
<p><a href="/"> Zurück zur Liste</a></p>
</article>
}
}