package views
import "fmt"
import "git.32bit.cafe/32bitcafe/guestbook/internal/models"
import "git.32bit.cafe/32bitcafe/guestbook/internal/forms"
func wUrl (w models.Website) string {
return fmt.Sprintf("/websites/%s", shortIdToSlug(w.ShortId))
}
templ wSidebar(website models.Website) {
{{ dashUrl := wUrl(website) + "/dashboard" }}
{{ gbUrl := wUrl(website) + "/guestbook" }}
}
templ displayWebsites (websites []models.Website) {
if len(websites) == 0 {
No Websites yet. Register a website.
} else {
}
}
templ websiteCreateForm(csrfToken string, form forms.WebsiteCreateForm) {
{{ err, exists := form.FieldErrors["sitename"]}}
if exists {
}
{{ err, exists = form.FieldErrors["siteurl"] }}
if exists {
}
{{ err, exists = form.FieldErrors["authorname"] }}
if exists {
}
}
templ WebsiteCreateButton() {
}
templ WebsiteList(title string, data CommonData, websites []models.Website) {
if data.IsHtmx {
@displayWebsites(websites)
} else {
@base(title, data) {
My Websites
@WebsiteCreateButton()
@displayWebsites(websites)
}
}
}
templ WebsiteDashboard(title string, data CommonData, website models.Website) {
@base(title, data) {
@wSidebar(website)
{ website.Name }
Stats and stuff will go here.
}
}
templ WebsiteDashboardComingSoon(title string, data CommonData, website models.Website) {
@base(title, data) {
@wSidebar(website)
{ website.Name }
Coming Soon
}
}
templ WebsiteCreate(title string, data CommonData, form forms.WebsiteCreateForm) {
if data.IsHtmx {
} else {
}
}