get adding threads working

This commit is contained in:
Dominic Ferrando
2025-04-18 02:25:35 -04:00
parent a8e1443f03
commit ccc53447de
6 changed files with 106 additions and 172 deletions
+11 -9
View File
@@ -3,15 +3,17 @@ package views
import "github.com/dominicf2001/comfychan/internal/database"
type ThreadGridBoxViewModel struct {
Thread database.Thread
Posts []database.Post
Thread database.Thread
Posts []database.Post
}
templ PostsGrid(vms []ThreadGridBoxViewModel) {
for _, vm := range vms {
<div class="thread-catalog-post">
<h1>{ vm.Thread.Subject }</h1>
<p>{ vm.Posts[0].Body }</p>
</div>
}
templ PostsCatalog(vms []ThreadGridBoxViewModel) {
<div id="catalog">
for _, vm := range vms {
<div class="thread-catalog-post">
<h1>{ vm.Thread.Subject }</h1>
<p>{ vm.Posts[0].Body }</p>
</div>
}
</div>
}