package views import "fmt" import "git.32bit.cafe/32bitcafe/guestbook/internal/models" templ gbCreateForm(csrf_token string) { } templ gbList(guestbooks []models.Guestbook) { if len(guestbooks) == 0 {

No Guestbooks yet

} else { } } templ GuestbookList(title string, data CommonData, guestbooks []models.Guestbook) { if data.IsHtmx { @gbList(guestbooks) } else { @base(title, data) {

My Guestbooks

@gbList(guestbooks) } } } templ GuestbookCreate(title string, data CommonData) { if data.IsHtmx {
@gbCreateForm(data.CSRFToken)
} else { @base(title, data) {
@gbCreateForm(data.CSRFToken)
} } } templ sidebar(guestbook models.Guestbook) { {{ gbUrl := fmt.Sprintf("/guestbooks/%s", guestbook.Slug()) }} } templ GuestbookView(title string, data CommonData, guestbook models.Guestbook, comments []models.GuestbookComment) { @base(title, data) {
@sidebar(guestbook)

Guestbook for { guestbook.SiteUrl }

{{ commentCreateUrl := fmt.Sprintf("/guestbooks/%s/comments/create", guestbook.Slug()) }}

New Comment

if len(comments) == 0 {

No comments yet!

} for _, c := range comments {
{ c.AuthorName } { c.Created.Format("01-02-2006 03:04PM") }

{ c.CommentText }

}
} }