diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..3a1daf7 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "ui/static/fontawesome"] + path = ui/static/fontawesome + url = https://github.com/FortAwesome/Font-Awesome.git + branch = fa-release-7.0.0 diff --git a/cmd/web/handlers.go b/cmd/web/handlers.go index a72a3b4..f5d5246 100644 --- a/cmd/web/handlers.go +++ b/cmd/web/handlers.go @@ -14,6 +14,10 @@ func (app *application) home(w http.ResponseWriter, r *http.Request) { views.Home("Home", app.newCommonData(r)).Render(r.Context(), w) } +func (app *application) about(w http.ResponseWriter, r *http.Request) { + views.AboutPage("About Webweav.ing", app.newCommonData(r)).Render(r.Context(), w) +} + func (app *application) notImplemented(w http.ResponseWriter, r *http.Request) { views.ComingSoon("Coming Soon", app.newCommonData(r)).Render(r.Context(), w) } diff --git a/cmd/web/handlers_guestbook.go b/cmd/web/handlers_guestbook.go index 4d90132..4128e08 100644 --- a/cmd/web/handlers_guestbook.go +++ b/cmd/web/handlers_guestbook.go @@ -36,7 +36,7 @@ func (app *application) getGuestbook(w http.ResponseWriter, r *http.Request) { return } } - comments, err := app.guestbookComments.GetAll(website.Guestbook.ID) + comments, err := app.guestbookComments.GetVisible(website.Guestbook.ID) if err != nil { app.serverError(w, r, err) return @@ -79,7 +79,7 @@ func (app *application) getGuestbookCommentsSerialized(w http.ResponseWriter, r if !website.Guestbook.Settings.IsVisible || !website.Guestbook.Settings.AllowRemoteHostAccess { app.clientError(w, http.StatusForbidden) } - comments, err := app.guestbookComments.GetAllSerialized(website.Guestbook.ID) + comments, err := app.guestbookComments.GetVisibleSerialized(website.Guestbook.ID) if err != nil { app.serverError(w, r, err) return @@ -151,7 +151,7 @@ func (app *application) postGuestbookCommentCreate(w http.ResponseWriter, r *htt views.EmbeddableGuestbookCommentForm(data, website, form).Render(r.Context(), w) } // TODO: use htmx to avoid getting comments again - comments, err := app.guestbookComments.GetAll(website.Guestbook.ID) + comments, err := app.guestbookComments.GetVisible(website.Guestbook.ID) if err != nil { app.serverError(w, r, err) return @@ -243,7 +243,7 @@ func (app *application) getCommentQueue(w http.ResponseWriter, r *http.Request) return } - comments, err := app.guestbookComments.GetUnpublished(website.Guestbook.ID) + comments, err := app.guestbookComments.GetAll(website.Guestbook.ID) if err != nil { if errors.Is(err, models.ErrNoRecord) { http.NotFound(w, r) @@ -315,6 +315,8 @@ func (app *application) putHideGuestbookComment(w http.ResponseWriter, r *http.R if err != nil { app.serverError(w, r, err) } + data := app.newCommonData(r) + views.GuestbookDashboardUpdateButtonPart(data, website, comment).Render(r.Context(), w) } func (app *application) deleteGuestbookComment(w http.ResponseWriter, r *http.Request) { @@ -349,6 +351,7 @@ func (app *application) deleteGuestbookComment(w http.ResponseWriter, r *http.Re if err != nil { app.serverError(w, r, err) } + views.GuestbookDashboardCommentDeletePart("Comment was successfully deleted").Render(r.Context(), w) } func (app *application) getAllGuestbooks(w http.ResponseWriter, r *http.Request) { diff --git a/cmd/web/middleware.go b/cmd/web/middleware.go index c9d83ec..a2d916e 100644 --- a/cmd/web/middleware.go +++ b/cmd/web/middleware.go @@ -23,7 +23,7 @@ func (app *application) logRequest(next http.Handler) http.Handler { func commonHeaders(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Security-Policy", "default-src 'self'; style-src 'self' fonts.googleapis.com; font-src fonts.gstatic.com") + w.Header().Set("Content-Security-Policy", "default-src 'self'; style-src 'self' fonts.googleapis.com; font-src fonts.gstatic.com 'self'; style-src-elem 'self';") w.Header().Set("Referrer-Policy", "origin-when-cross-origin") w.Header().Set("X-Content-Type-Options", "nosniff") // w.Header().Set("X-Frame-Options", "deny") diff --git a/cmd/web/routes.go b/cmd/web/routes.go index c168a11..e2f6509 100644 --- a/cmd/web/routes.go +++ b/cmd/web/routes.go @@ -35,6 +35,7 @@ func (app *application) routes() http.Handler { mux.Handle("/users/login/oidc", dynamic.ThenFunc(app.userLoginOIDC)) mux.Handle("/users/login/oidc/callback", dynamic.ThenFunc(app.userLoginOIDCCallback)) mux.Handle("GET /help", dynamic.ThenFunc(app.notImplemented)) + mux.Handle("GET /about", dynamic.ThenFunc(app.about)) protected := dynamic.Append(app.requireAuthentication) @@ -43,7 +44,6 @@ func (app *application) routes() http.Handler { mux.Handle("POST /users/logout", protected.ThenFunc(app.postUserLogout)) mux.Handle("GET /users/settings", protected.ThenFunc(app.getUserSettings)) mux.Handle("PUT /users/settings", protected.ThenFunc(app.putUserSettings)) - mux.Handle("GET /users/privacy", protected.ThenFunc(app.notImplemented)) mux.Handle("GET /guestbooks", protected.ThenFunc(app.getAllGuestbooks)) mux.Handle("GET /websites", protected.ThenFunc(app.getWebsiteList)) @@ -51,13 +51,12 @@ func (app *application) routes() http.Handler { mux.Handle("POST /websites/create", protected.ThenFunc(app.postWebsiteCreate)) mux.Handle("GET /websites/{id}/dashboard", protected.ThenFunc(app.getWebsiteDashboard)) mux.Handle("GET /websites/{id}/dashboard/guestbook/comments", protected.ThenFunc(app.getGuestbookComments)) - mux.Handle("GET /websites/{id}/dashboard/guestbook/comments/queue", protected.ThenFunc(app.getCommentQueue)) + mux.Handle("GET /websites/{id}/dashboard/guestbook/comments/hidden", protected.ThenFunc(app.getCommentQueue)) mux.Handle("DELETE /websites/{id}/dashboard/guestbook/comments/{commentId}", protected.ThenFunc(app.deleteGuestbookComment)) mux.Handle("PUT /websites/{id}/dashboard/guestbook/comments/{commentId}", protected.ThenFunc(app.putHideGuestbookComment)) mux.Handle("GET /websites/{id}/dashboard/settings", protected.ThenFunc(app.getWebsiteSettings)) mux.Handle("PUT /websites/{id}/settings", protected.ThenFunc(app.putWebsiteSettings)) mux.Handle("PUT /websites/{id}", protected.ThenFunc(app.deleteWebsite)) - mux.Handle("GET /websites/{id}/dashboard/guestbook/comments/trash", protected.ThenFunc(app.getCommentTrash)) mux.Handle("GET /websites/{id}/dashboard/guestbook/themes", protected.ThenFunc(app.getComingSoon)) mux.Handle("GET /websites/{id}/dashboard/guestbook/customize", protected.ThenFunc(app.getComingSoon)) diff --git a/go.mod b/go.mod index dd2b0fc..c257d14 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/alexedwards/scs/sqlite3store v0.0.0-20250212122300-421ef1d8611c github.com/alexedwards/scs/v2 v2.8.0 github.com/coreos/go-oidc/v3 v3.14.1 + github.com/golang-migrate/migrate/v4 v4.18.3 github.com/gorilla/schema v1.4.1 github.com/joho/godotenv v1.5.1 github.com/justinas/alice v1.2.0 @@ -16,4 +17,9 @@ require ( golang.org/x/oauth2 v0.30.0 ) -require github.com/go-jose/go-jose/v4 v4.0.5 // indirect +require ( + github.com/go-jose/go-jose/v4 v4.0.5 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + go.uber.org/atomic v1.7.0 // indirect +) diff --git a/go.sum b/go.sum index f2165b3..ab10a2a 100644 --- a/go.sum +++ b/go.sum @@ -6,27 +6,41 @@ github.com/alexedwards/scs/v2 v2.8.0 h1:h31yUYoycPuL0zt14c0gd+oqxfRwIj6SOjHdKRZx github.com/alexedwards/scs/v2 v2.8.0/go.mod h1:ToaROZxyKukJKT/xLcVQAChi5k6+Pn1Gvmdl7h3RRj8= github.com/coreos/go-oidc/v3 v3.14.1 h1:9ePWwfdwC4QKRlCXsJGou56adA/owXczOzwKdOumLqk= github.com/coreos/go-oidc/v3 v3.14.1/go.mod h1:HaZ3szPaZ0e4r6ebqvsLWlk2Tn+aejfmrfah6hnSYEU= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-jose/go-jose/v4 v4.0.5 h1:M6T8+mKZl/+fNNuFHvGIzDz7BTLQPIounk/b9dw3AaE= github.com/go-jose/go-jose/v4 v4.0.5/go.mod h1:s3P1lRrkT8igV8D9OjyL4WRyHvjB6a4JSllnOrmmBOA= +github.com/golang-migrate/migrate/v4 v4.18.3 h1:EYGkoOsvgHHfm5U/naS1RP/6PL/Xv3S4B/swMiAmDLs= +github.com/golang-migrate/migrate/v4 v4.18.3/go.mod h1:99BKpIi6ruaaXRM1A77eqZ+FWPQ3cfRa+ZVy5bmWMaY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/gorilla/schema v1.4.1 h1:jUg5hUjCSDZpNGLuXQOgIWGdlgrIdYvgQ0wZtdK1M3E= github.com/gorilla/schema v1.4.1/go.mod h1:Dg5SSm5PV60mhF2NFaTV1xuYYj8tV8NOPRo4FggUMnM= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/justinas/alice v1.2.0 h1:+MHSA/vccVCF4Uq37S42jwlkvI2Xzl7zTPCN5BnZNVo= github.com/justinas/alice v1.2.0/go.mod h1:fN5HRH/reO/zrUflLfTN43t3vXvKzvZIENsNEe7i7qA= github.com/justinas/nosurf v1.1.1 h1:92Aw44hjSK4MxJeMSyDa7jwuI9GR2J/JCQiaKvXXSlk= github.com/justinas/nosurf v1.1.1/go.mod h1:ALpWdSbuNGy2lZWtyXdjkYv4edL23oSEgfBT1gPJ5BQ= +github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= +github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-sqlite3 v1.14.24 h1:tpSp2G2KyMnnQu99ngJ47EIkWVmliIizyZBfPrBWDRM= github.com/mattn/go-sqlite3 v1.14.24/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= diff --git a/internal/models/guestbookcomment.go b/internal/models/guestbookcomment.go index d44de26..eb94614 100644 --- a/internal/models/guestbookcomment.go +++ b/internal/models/guestbookcomment.go @@ -33,10 +33,10 @@ type GuestbookCommentModel struct { type GuestbookCommentModelInterface interface { Insert(shortId uint64, guestbookId, parentId int64, authorName, authorEmail, authorSite, commentText, pageUrl string, isPublished bool) (int64, error) Get(shortId uint64) (GuestbookComment, error) - GetAll(guestbookId int64) ([]GuestbookComment, error) - GetAllSerialized(guestbookId int64) ([]GuestbookCommentSerialized, error) + GetVisible(guestbookId int64) ([]GuestbookComment, error) + GetVisibleSerialized(guestbookId int64) ([]GuestbookCommentSerialized, error) GetDeleted(guestbookId int64) ([]GuestbookComment, error) - GetUnpublished(guestbookId int64) ([]GuestbookComment, error) + GetAll(guestbookId int64) ([]GuestbookComment, error) UpdateComment(comment *GuestbookComment) error } @@ -74,7 +74,7 @@ func (m *GuestbookCommentModel) Get(shortId uint64) (GuestbookComment, error) { return c, nil } -func (m *GuestbookCommentModel) GetAll(guestbookId int64) ([]GuestbookComment, error) { +func (m *GuestbookCommentModel) GetVisible(guestbookId int64) ([]GuestbookComment, error) { stmt := `SELECT Id, ShortId, GuestbookId, ParentId, AuthorName, AuthorEmail, AuthorSite, CommentText, PageUrl, Created, IsPublished FROM guestbook_comments @@ -100,7 +100,7 @@ func (m *GuestbookCommentModel) GetAll(guestbookId int64) ([]GuestbookComment, e return comments, nil } -func (m *GuestbookCommentModel) GetAllSerialized(guestbookId int64) ([]GuestbookCommentSerialized, error) { +func (m *GuestbookCommentModel) GetVisibleSerialized(guestbookId int64) ([]GuestbookCommentSerialized, error) { stmt := `SELECT AuthorName, CommentText, Created FROM guestbook_comments WHERE GuestbookId = ? AND IsPublished = TRUE AND DELETED IS NULL @@ -154,11 +154,11 @@ func (m *GuestbookCommentModel) GetDeleted(guestbookId int64) ([]GuestbookCommen return comments, nil } -func (m *GuestbookCommentModel) GetUnpublished(guestbookId int64) ([]GuestbookComment, error) { +func (m *GuestbookCommentModel) GetAll(guestbookId int64) ([]GuestbookComment, error) { stmt := `SELECT Id, ShortId, GuestbookId, ParentId, AuthorName, AuthorEmail, AuthorSite, CommentText, PageUrl, Created, IsPublished FROM guestbook_comments - WHERE GuestbookId = ? AND Deleted IS NULL AND IsPublished = FALSE + WHERE GuestbookId = ? AND Deleted IS NULL ORDER BY Created DESC` rows, err := m.DB.Query(stmt, guestbookId) if err != nil { diff --git a/internal/models/mocks/guestbookcomment.go b/internal/models/mocks/guestbookcomment.go index f8520de..21e755f 100644 --- a/internal/models/mocks/guestbookcomment.go +++ b/internal/models/mocks/guestbookcomment.go @@ -40,7 +40,7 @@ func (m *GuestbookCommentModel) Get(shortId uint64) (models.GuestbookComment, er } } -func (m *GuestbookCommentModel) GetAll(guestbookId int64) ([]models.GuestbookComment, error) { +func (m *GuestbookCommentModel) GetVisible(guestbookId int64) ([]models.GuestbookComment, error) { switch guestbookId { case 1: return []models.GuestbookComment{mockGuestbookComment}, nil @@ -51,7 +51,7 @@ func (m *GuestbookCommentModel) GetAll(guestbookId int64) ([]models.GuestbookCom } } -func (m *GuestbookCommentModel) GetAllSerialized(guestbookId int64) ([]models.GuestbookCommentSerialized, error) { +func (m *GuestbookCommentModel) GetVisibleSerialized(guestbookId int64) ([]models.GuestbookCommentSerialized, error) { switch guestbookId { case 1: return []models.GuestbookCommentSerialized{mockSerializedGuestbookComment}, nil @@ -69,7 +69,7 @@ func (m *GuestbookCommentModel) GetDeleted(guestbookId int64) ([]models.Guestboo } } -func (m *GuestbookCommentModel) GetUnpublished(guestbookId int64) ([]models.GuestbookComment, error) { +func (m *GuestbookCommentModel) GetAll(guestbookId int64) ([]models.GuestbookComment, error) { switch guestbookId { default: return []models.GuestbookComment{}, models.ErrNoRecord diff --git a/internal/models/website.go b/internal/models/website.go index 6385530..9d29399 100644 --- a/internal/models/website.go +++ b/internal/models/website.go @@ -9,10 +9,9 @@ import ( ) type Website struct { - ID int64 - ShortId uint64 - Name string - // SiteUrl string + ID int64 + ShortId uint64 + Name string Url *url.URL AuthorName string UserId int64 @@ -317,15 +316,29 @@ func (m *WebsiteModel) Update(w Website) error { func (m *WebsiteModel) Delete(websiteId int64) error { stmt := `UPDATE websites SET Deleted = ? WHERE ID = ?` - r, err := m.DB.Exec(stmt, time.Now().UTC(), websiteId) + tx, err := m.DB.Begin() if err != nil { + return nil + } + t := time.Now().UTC() + _, err = tx.Exec(stmt, t, websiteId) + if err != nil { + if rbErr := tx.Rollback(); rbErr != nil { + return rbErr + } return err } - if rows, err := r.RowsAffected(); rows != 1 { - if err != nil { - return err + stmt = `UPDATE guestbooks SET Deleted = ? WHERE WebsiteId = ?` + _, err = tx.Exec(stmt, t, websiteId) + if err != nil { + if rbErr := tx.Rollback(); rbErr != nil { + return rbErr } - return errors.New("Failed to update website") + return err + } + err = tx.Commit() + if err != nil { + return err } return nil } diff --git a/ui/static/css/style.css b/ui/static/css/style.css index ceeac55..5b11350 100644 --- a/ui/static/css/style.css +++ b/ui/static/css/style.css @@ -1,86 +1,886 @@ -/* html { - background: lightgray; -} */ +/* CSS Reset and Base Styles */ +*, +*::before, +*::after { + box-sizing: border-box; +} +* { + margin: 0; + padding: 0; +} + +html { + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; + line-height: 1.6; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +/* CSS Custom Properties for Theming */ +:root { + /* Light mode colors */ + --color-primary: #2563eb; + --color-primary-hover: #1d4ed8; + --color-danger: #dc2626; + --color-danger-hover: #b91c1c; + --color-warning: #d97706; + + --color-text: #1f2937; + --color-text-muted: #6b7280; + --color-background: #ffffff; + --color-surface: #f9fafb; + --color-border: #e5e7eb; + --color-border-light: #f3f4f6; + + --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); + + /* Spacing scale */ + --space-xs: 0.25rem; + --space-sm: 0.5rem; + --space-md: 1rem; + --space-lg: 1.5rem; + --space-xl: 2rem; + --space-2xl: 3rem; + --space-3xl: 4rem; + + /* Typography scale */ + --text-xs: 0.75rem; + --text-sm: 0.875rem; + --text-base: 1rem; + --text-lg: 1.125rem; + --text-xl: 1.25rem; + --text-2xl: 1.5rem; + --text-3xl: 1.875rem; + --text-4xl: 2.25rem; + + /* Border radius */ + --radius-sm: 0.125rem; + --radius-md: 0.375rem; + --radius-lg: 0.5rem; + + /* Layout */ + --max-width: 1200px; + --header-height: 60px; +} + +/* Dark mode colors */ +@media (prefers-color-scheme: dark) { + :root { + --color-text: #f9fafb; + --color-text-muted: #9ca3af; + --color-background: #111827; + --color-surface: #1f2937; + --color-border: #374151; + --color-border-light: #4b5563; + } +} + +/* Base Typography */ body { - max-width: 1024px; - margin: 1rem auto; - padding: 1rem; - /* background: white; */ - font-size: 1.2rem; - line-height: 1.5; - font-family: Arial, Helvetica, sans-serif; -} - -header { - text-align: center; -} - -body > nav { + font-size: var(--text-base); + color: var(--color-text); + background-color: var(--color-background); + min-height: 100vh; display: flex; - justify-content: space-between; + flex-direction: column; } -body > nav ul { - list-style: none; - margin: 0 1rem; - padding: 0; +h1, h2, h3, h4, h5, h6 { + font-weight: 600; + line-height: 1.25; + margin-bottom: var(--space-md); } -body > nav li { - display: inline-block; - padding: 0 0.5rem; -} +h1 { font-size: var(--text-3xl); } +h2 { font-size: var(--text-2xl); } +h3 { font-size: var(--text-xl); } +h4 { font-size: var(--text-lg); } -nav form { - display: inline-block; -} - -nav button { - border: none; - background: none; - font-family: unset; - font-size: unset; - /* color: blue; */ - /* text-decoration: underline; */ - cursor: pointer; -} - -main { - padding: 1rem; -} - -div#dashboard { - display: flex; - flex-flow: row wrap; -} - -div#dashboard nav { - flex: 1 1 25%; - /* margin-top: 2rem; */ - min-width: 0; -} - -div#dashboard > div { - flex: 10 1 40%; - min-width: 0; -} - -div > pre { - max-width: 100%; - overflow: auto; -} - -main nav ul { - list-style: none; - margin: 1rem; - padding: 0; -} - -footer { - text-align: center; +p { + margin-bottom: var(--space-md); } a { - /* color: blue; */ + color: var(--color-primary); + text-decoration: none; } + +a:hover { + color: var(--color-primary-hover); + text-decoration: underline; +} + +/* Layout Components */ +body > header { + background-color: var(--color-surface); + border-bottom: 1px solid var(--color-border); + height: var(--header-height); + display: flex; + align-items: center; + padding: 0 var(--space-lg); + position: sticky; + top: 0; + z-index: 100; +} + +body > header h1 { + margin: 0; + font-size: var(--text-2xl); +} + +body > header h1 a { + color: var(--color-text); + font-weight: 700; +} + +body > header h1 a:hover { + text-decoration: none; + color: var(--color-primary); +} + +nav { + background-color: var(--color-surface); + border-bottom: 1px solid var(--color-border); + padding: var(--space-md) var(--space-lg); + display: flex; + justify-content: space-between; + align-items: center; + flex-wrap: wrap; + gap: var(--space-md); +} + +.nav-welcome { + font-weight: 500; +} + +.nav-links { + display: flex; + flex-wrap: wrap; + gap: var(--space-md); + list-style: none; + margin: 0; + padding: 0; + align-items: center; +} + +.nav-links li { + margin: 0; +} + +.nav-links a { + padding: var(--space-sm) var(--space-md); + border-radius: var(--radius-md); + transition: background-color 0.2s ease; + white-space: nowrap; +} + +.nav-links a:hover { + background-color: var(--color-border-light); + text-decoration: none; +} + +main { + flex: 1; + max-width: var(--max-width); + margin: 0 auto; + padding: var(--space-2xl) var(--space-lg); + width: 100%; +} + +footer { + background-color: var(--color-surface); + border-top: 1px solid var(--color-border); + padding: var(--space-lg); + text-align: center; + margin-top: auto; +} + +.footer-links { + padding: 0; + list-style: none; +} + +.footer-links li { + display: inline-block; + padding: 0 1rem; +} + +/* Dashboard Layout */ +#dashboard { + display: grid; + grid-template-columns: 280px 1fr; + gap: var(--space-2xl); + margin-top: var(--space-xl); +} + +#dashboard nav { + background: none; + border: none; + padding: 0; + display: block; +} + +#dashboard nav > div { + margin-bottom: var(--space-xl); + padding: var(--space-lg); + background-color: var(--color-surface); + border: 1px solid var(--color-border); + border-radius: var(--radius-lg); +} + +#dashboard nav h3 { + font-size: var(--text-lg); + margin-bottom: var(--space-md); + padding-bottom: var(--space-sm); + border-bottom: 1px solid var(--color-border); +} + +#dashboard nav ul { + list-style: none; + margin-bottom: var(--space-md); +} + +#dashboard nav ul:last-child { + margin-bottom: 0; +} + +#dashboard nav li { + margin-bottom: var(--space-xs); +} + +#dashboard nav a { + display: block; + padding: var(--space-sm) var(--space-md); + border-radius: var(--radius-md); + transition: background-color 0.2s ease; +} + +#dashboard nav a:hover { + background-color: var(--color-border-light); + text-decoration: none; +} + +/* Forms */ +form { + background-color: var(--color-surface); + padding: var(--space-xl); + border-radius: var(--radius-lg); + border: 1px solid var(--color-border); + margin-bottom: var(--space-xl); +} + +.form-group { + margin-bottom: var(--space-lg); +} + +.form-group small { + display: block; + margin-top: var(--space-xs); + font-size: var(--text-sm); + color: var(--color-text-muted); +} + +fieldset { + border: 1px solid var(--color-border); + border-radius: var(--radius-md); + padding: var(--space-lg); + margin-bottom: var(--space-lg); +} + +fieldset.radio-group { + border: none; + padding: 0; + margin: 0; +} + +fieldset.danger-zone { + border-color: var(--color-danger); + background-color: rgba(220, 38, 38, 0.05); +} + +legend { + padding: 0 var(--space-sm); + font-weight: 600; + color: var(--color-text); +} + +label { + display: block; + font-weight: 500; + margin-bottom: var(--space-sm); + color: var(--color-text); +} + +input[type="text"], +input[type="email"], +input[type="url"], +textarea, +select { + width: 100%; + padding: var(--space-md); + border: 1px solid var(--color-border); + border-radius: var(--radius-md); + background-color: var(--color-background); + color: var(--color-text); + font-size: var(--text-base); + transition: border-color 0.2s ease, box-shadow 0.2s ease; +} + +input[type="text"]:focus, +input[type="email"]:focus, +input[type="url"]:focus, +textarea:focus, +select:focus { + outline: none; + border-color: var(--color-primary); + box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1); +} + +textarea { + min-height: 120px; + resize: vertical; +} + +/* Radio buttons */ +input[type="radio"] { + margin-right: var(--space-sm); +} + +label:has(input[type="radio"]) { + display: inline-flex; + align-items: center; + margin-right: var(--space-lg); + margin-bottom: var(--space-sm); + font-weight: normal; +} + +/* Buttons */ +button, +input[type="submit"] { + display: inline-flex; + align-items: center; + justify-content: center; + padding: var(--space-md) var(--space-lg); + border: none; + border-radius: var(--radius-md); + background-color: var(--color-primary); + color: white; + font-size: var(--text-base); + font-weight: 500; + cursor: pointer; + transition: background-color 0.2s ease, transform 0.1s ease; + min-height: 44px; +} + +button:hover, +input[type="submit"]:hover { + background-color: var(--color-primary-hover); + transform: translateY(-1px); +} + +button:active, +input[type="submit"]:active { + transform: translateY(0); +} + +button.danger { + background-color: var(--color-danger); +} + +button.danger:hover { + background-color: var(--color-danger-hover); +} + +button.outline { + background-color: transparent; + color: var(--color-text); + border: 1px solid var(--color-border); +} + +button.outline:hover { + background-color: var(--color-surface); + border-color: var(--color-text-muted); +} + +/* Button variants */ +.btn { + display: inline-flex; + align-items: center; + justify-content: center; + padding: var(--space-md) var(--space-lg); + border: none; + border-radius: var(--radius-md); + font-size: var(--text-base); + font-weight: 500; + cursor: pointer; + text-decoration: none; + transition: all 0.2s ease; + min-height: 44px; +} + +.btn-primary { + background-color: var(--color-primary); + color: white; +} + +.btn-primary:hover { + background-color: var(--color-primary-hover); + color: white; + text-decoration: none; +} + +.btn-outline { + background-color: transparent; + color: var(--color-text); + border: 1px solid var(--color-border); +} + +.btn-outline:hover { + background-color: var(--color-surface); + border-color: var(--color-text-muted); + text-decoration: none; +} + +/* Comments */ +#comments { + margin-top: var(--space-2xl); +} + +.comment { + background-color: var(--color-surface); + border: 1px solid var(--color-border); + border-radius: var(--radius-lg); + padding: var(--space-lg); + margin-bottom: var(--space-lg); +} + +.comment-header { + display: flex; + justify-content: space-between; + align-items: flex-start; + margin-bottom: var(--space-md); + gap: var(--space-md); +} + +.comment-meta { + flex: 1; +} + +.comment-author { + margin: 0 0 var(--space-xs) 0; + font-size: var(--text-lg); +} + +.comment time { + font-size: var(--text-sm); + color: var(--color-text-muted); +} + +.comment-content p:last-of-type { + margin-bottom: 0; +} + +.comment-actions { + display: flex; + gap: var(--space-sm); + flex-shrink: 0; +} + +.comments-list { + margin-top: var(--space-lg); +} + +/* Code blocks */ +pre { + background-color: var(--color-surface); + border: 1px solid var(--color-border); + border-radius: var(--radius-md); + padding: var(--space-lg); + overflow-x: auto; + margin-bottom: var(--space-lg); + white-space: pre-wrap; + word-break: break-all; + line-height: 1.4; +} + +code { + font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace; + font-size: var(--text-sm); + background-color: var(--color-border-light); + padding: var(--space-xs) var(--space-sm); + border-radius: var(--radius-sm); + word-break: break-all; + white-space: pre-wrap; +} + +pre code { + background: none; + padding: 0; + white-space: pre-wrap; + word-break: break-all; +} + +.code-example { + margin: var(--space-lg) 0; +} + +.code-example figcaption { + font-size: var(--text-sm); + color: var(--color-text-muted); + margin-bottom: var(--space-sm); + font-weight: 500; +} + +/* Lists */ +ul, ol { + padding-left: var(--space-xl); + margin-bottom: var(--space-lg); +} + +li { + margin-bottom: var(--space-sm); +} + +ul#websites { + list-style: none; + padding: 0; +} + +ul#websites li { + margin-bottom: var(--space-md); +} + +/* Website cards */ +.website-card { + background-color: var(--color-surface); + border: 1px solid var(--color-border); + border-radius: var(--radius-lg); + padding: var(--space-xl); + transition: box-shadow 0.2s ease; +} + +.website-card:hover { + box-shadow: var(--shadow-md); +} + +.website-header { + margin-bottom: var(--space-lg); +} + +.website-name { + margin: 0 0 var(--space-sm) 0; +} + +.website-name a { + color: var(--color-text); + font-weight: 600; + font-size: var(--text-xl); +} + +.website-url { + font-size: var(--text-sm); + color: var(--color-text-muted); + font-family: monospace; +} + +.website-actions { + display: flex; + gap: var(--space-sm); + flex-wrap: wrap; +} + +/* Screen reader only content */ +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border: 0; +} + +/* Notices and alerts */ +.notice, +.warning-notice { + padding: var(--space-md); + border-radius: var(--radius-md); + margin-bottom: var(--space-lg); + border-left: 4px solid var(--color-warning); + background-color: rgba(217, 119, 6, 0.1); +} + +.warning-notice { + border-left-color: var(--color-danger); + background-color: rgba(220, 38, 38, 0.1); +} + +/* Section headers */ +.section-header { + margin-bottom: var(--space-xl); +} + +.section-header:has(.btn) { + display: flex; + justify-content: space-between; + align-items: flex-start; + flex-wrap: wrap; + gap: var(--space-md); +} + +.section-header h1 { + margin-bottom: var(--space-sm); +} + +.section-description { + color: var(--color-text-muted); + margin: 0; +} + +/* Hero section (index.html) */ +.hero { + text-align: center; + padding: var(--space-3xl) 0; + background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-background) 100%); + border-radius: var(--radius-lg); + margin-bottom: var(--space-2xl); +} + +.hero-header h1 { + font-size: var(--text-4xl); + margin-bottom: var(--space-md); +} + +.hero-subtitle { + font-size: var(--text-xl); + color: var(--color-text-muted); + margin: 0; +} + +/* Instruction sections (dashboard_main.html) */ +.instruction-overview { + background-color: var(--color-surface); + border: 1px solid var(--color-border); + border-radius: var(--radius-md); + padding: var(--space-lg); + margin-bottom: var(--space-2xl); +} + +.instruction-method { + margin-bottom: var(--space-2xl); + padding-bottom: var(--space-2xl); + border-bottom: 1px solid var(--color-border); +} + +.instruction-method:last-child { + border-bottom: none; +} + +.instruction-step { + margin-bottom: var(--space-xl); +} + +.instruction-step h3 { + color: var(--color-primary); + margin-bottom: var(--space-md); +} + +.method-note { + background-color: rgba(59, 130, 246, 0.1); + border: 1px solid rgba(59, 130, 246, 0.2); + border-radius: var(--radius-md); + padding: var(--space-md); + margin-top: var(--space-lg); +} + +.help-section { + background-color: var(--color-surface); + border: 1px solid var(--color-border); + border-radius: var(--radius-lg); + padding: var(--space-xl); + margin-top: var(--space-2xl); +} + +/* Utilities */ +hr { + border: none; + height: 1px; + background-color: var(--color-border); + margin: var(--space-lg) 0; +} + +.htmx-indicator{opacity:0} +.htmx-request .htmx-indicator{opacity:1; transition: opacity 200ms ease-in;} +.htmx-request.htmx-indicator{opacity:1; transition: opacity 200ms ease-in;} + +/* Responsive Design */ +@media (max-width: 768px) { + :root { + --space-lg: 1rem; + --space-xl: 1.5rem; + --space-2xl: 2rem; + } + + body > header { + padding: 0 var(--space-md); + } + + nav { + padding: var(--space-md); + flex-direction: column; + align-items: stretch; + gap: var(--space-sm); + } + + .nav-welcome { + text-align: center; + padding-bottom: var(--space-sm); + border-bottom: 1px solid var(--color-border); + } + + .nav-links { + justify-content: center; + gap: var(--space-sm); + } + + .nav-links a { + padding: var(--space-sm); + font-size: var(--text-sm); + } + + main { + padding: var(--space-lg) var(--space-md); + } + + #dashboard { + grid-template-columns: 1fr; + gap: var(--space-lg); + } + + #dashboard nav > div { + padding: var(--space-md); + } + + form { + padding: var(--space-lg); + } + + h1 { font-size: var(--text-2xl); } + h2 { font-size: var(--text-xl); } + + label:has(input[type="radio"]) { + display: block; + margin-bottom: var(--space-sm); + } + + .hero { + padding: var(--space-2xl) 0; + } + + .hero-header h1 { + font-size: var(--text-3xl); + } + + .hero-subtitle { + font-size: var(--text-lg); + } + + .section-header:has(.btn) { + flex-direction: column; + align-items: stretch; + } + + .section-header .btn { + width: 100%; + text-align: center; + } + + .section-description { + font-size: var(--text-sm); + } + + .website-actions { + flex-direction: column; + } + + .website-actions .btn { + width: 100%; + } + + .comment-header { + flex-direction: column; + align-items: stretch; + } + + .comment-actions { + margin-top: var(--space-sm); + } + + pre { + font-size: var(--text-xs); + padding: var(--space-md); + white-space: pre-wrap; + word-break: break-all; + overflow-x: hidden; + } + + code { + font-size: var(--text-xs); + word-break: break-all; + } +} + +@media (max-width: 480px) { + body > header h1 { + font-size: var(--text-xl); + } + + .nav-links { + flex-direction: column; + gap: var(--space-xs); + } + + .nav-links a { + width: 100%; + text-align: center; + } + + button, + input[type="submit"] { + width: 100%; + margin-bottom: var(--space-sm); + } +} + +/* Focus styles for better accessibility */ +button:focus-visible, +input:focus-visible, +textarea:focus-visible, +select:focus-visible { + outline: 2px solid var(--color-primary); + outline-offset: 2px; +} + +/* Print styles */ +@media print { + body > header, + nav, + footer, + button, + input[type="submit"] { + display: none; + } + + main { + max-width: none; + padding: 0; + } + + #dashboard { + grid-template-columns: 1fr; + } +} + diff --git a/ui/static/fontawesome b/ui/static/fontawesome new file mode 160000 index 0000000..5a85d8a --- /dev/null +++ b/ui/static/fontawesome @@ -0,0 +1 @@ +Subproject commit 5a85d8a93237e08d9d1f861aa5630f292424cfc0 diff --git a/ui/views/common.templ b/ui/views/common.templ index e17e270..666b370 100644 --- a/ui/views/common.templ +++ b/ui/views/common.templ @@ -41,31 +41,37 @@ templ commonHeader() { templ topNav(data CommonData) { {{ hxHeaders := fmt.Sprintf("{\"X-CSRF-Token\": \"%s\"}", data.CSRFToken) }} - ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -174,7 +174,7 @@ func commonFooter() templ.Component { templ_7745c5c3_Var5 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -210,13 +210,26 @@ func base(title string, data CommonData) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/common.templ`, Line: 76, Col: 17} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/common.templ`, Line: 82, Col: 17} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, " - webweav.ing") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, " - webweav.ing") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -228,51 +241,34 @@ func base(title string, data CommonData) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if data.Flash != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var8 string - templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(data.Flash) + var templ_7745c5c3_Var9 string + templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(data.Flash) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/common.templ`, Line: 88, Col: 36} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/common.templ`, Line: 96, Col: 43} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var9 string - templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(title) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/common.templ`, Line: 90, Col: 15} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } templ_7745c5c3_Err = templ_7745c5c3_Var6.Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -280,7 +276,7 @@ func base(title string, data CommonData) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/ui/views/guestbooks.templ b/ui/views/guestbooks.templ index ed3f8d1..2d24042 100644 --- a/ui/views/guestbooks.templ +++ b/ui/views/guestbooks.templ @@ -10,91 +10,140 @@ templ GuestbookDashboardCommentsView(title string, data CommonData, website mode
@wSidebar(website)
-

Comments on { website.Name }

-
- if len(comments) == 0 { -

No comments yet!

- } - for _, c := range comments { - @GuestbookDashboardCommentView(data, website, c) - } +
+
+

Comments on { website.Name }

+

Manage, moderate, and organize comments on your guestbook

+
+
+ if len(comments) == 0 { +

No comments yet!

+ } + for i, c := range comments { + @GuestbookDashboardCommentView(data, website, c, i) + } +
} } -templ GuestbookDashboardCommentView(data CommonData, w models.Website, c models.GuestbookComment) { - {{ commentUrl := fmt.Sprintf("%s/dashboard/guestbook/comments/%s", wUrl(w), shortIdToSlug(c.ShortId)) }} - {{ hxHeaders := fmt.Sprintf("{\"X-CSRF-Token\": \"%s\"}", data.CSRFToken) }} -
-
- if c.Deleted.IsZero() { - - - } -
-
- { c.AuthorName } - if len(c.AuthorEmail) > 0 { - {{ email := "mailto:" + c.AuthorEmail }} - | { c.AuthorEmail } - } - if len(c.AuthorSite) > 0 { - | { c.AuthorSite } - } -

- { c.Created.In(data.CurrentUser.Settings.LocalTimezone).Format("01-02-2006 03:04PM") } -

-
-

- { c.CommentText } -

-
+templ GuestbookDashboardCommentDeletePart(text string) { +
+

{ text }

} +templ GuestbookDashboardUpdateButtonPart(data CommonData, w models.Website, c models.GuestbookComment) { + {{ hxHeaders := fmt.Sprintf("{\"X-CSRF-Token\": \"%s\"}", data.CSRFToken) }} + {{ commentUrl := fmt.Sprintf("%s/dashboard/guestbook/comments/%s", wUrl(w), shortIdToSlug(c.ShortId)) }} + +} + +templ GuestbookDashboardCommentView(data CommonData, w models.Website, c models.GuestbookComment, i int) { + {{ commentUrl := fmt.Sprintf("%s/dashboard/guestbook/comments/%s", wUrl(w), shortIdToSlug(c.ShortId)) }} + {{ hxHeaders := fmt.Sprintf("{\"X-CSRF-Token\": \"%s\"}", data.CSRFToken) }} + {{ authorClass := fmt.Sprintf("comment-author-%d", i) }} +
+
+
+
+

{ c.AuthorName }

+ + if len(c.AuthorEmail) > 0 { +
+ {{ email := "mailto:" + c.AuthorEmail }} + + { c.AuthorEmail } +
+ } + if len(c.AuthorSite) > 0 { + + } +
+
+ if c.Deleted.IsZero() { + + @GuestbookDashboardUpdateButtonPart(data, w, c) + } +
+
+
+

+ { c.CommentText } +

+
+
+
+} + templ commentForm(form forms.CommentCreateForm) { -
- - {{ error, exists := form.FieldErrors["authorName"] }} - if exists { - - } - -
-
- - {{ error, exists = form.FieldErrors["authorEmail"] }} - if exists { - - } - -
-
- - {{ error, exists = form.FieldErrors["authorSite"] }} - if exists { - - } - -
-
- - {{ error, exists = form.FieldErrors["content"] }} - if exists { - - } - -
-
- -
+
+ Leave a comment +
+ + {{ error, exists := form.FieldErrors["authorName"] }} + if exists { + + } + + Your name or handle +
+
+ + {{ error, exists = form.FieldErrors["authorEmail"] }} + if exists { + + } + + Your email address will only be shared with the guestbook's owner +
+
+ + {{ error, exists = form.FieldErrors["authorSite"] }} + if exists { + + } + + Link to your website or social profile +
+
+ + {{ error, exists = form.FieldErrors["content"] }} + if exists { + + } + + Share your thoughts, feedback, or just say hello! +
+
+ +
+
} templ GuestbookView(title string, data CommonData, website models.Website, guestbook models.Guestbook, comments []models.GuestbookComment, form forms.CommentCreateForm) { @@ -105,39 +154,46 @@ templ GuestbookView(title string, data CommonData, website models.Website, guest { title } - + + -
-
+
+

{ website.Name } Guestbook

{ data.Flash }
@commentForm(form)
-
-
+ +
+

Comments

if len(comments) == 0 {

No comments yet!

} - for _, c := range comments { -
-

- if c.AuthorSite != "" { - { c.AuthorName } - } else { - { c.AuthorName } - } -

- -

- { c.CommentText } -

-
+ for i, c := range comments { + {{ commentAuthorRole := fmt.Sprintf("comment-author-%d", i+1) }} +
+
+

+ if c.AuthorSite != "" { + { c.AuthorName } + } else { + { c.AuthorName } + } +

+ +
+
+

+ { c.CommentText } +

+
+
} -
+
diff --git a/ui/views/guestbooks_templ.go b/ui/views/guestbooks_templ.go index cb8c492..e12af98 100644 --- a/ui/views/guestbooks_templ.go +++ b/ui/views/guestbooks_templ.go @@ -54,20 +54,20 @@ func GuestbookDashboardCommentsView(title string, data CommonData, website model if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "

Comments on ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "

Comments on ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(website.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 13, Col: 34} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 15, Col: 69} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "


") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "

Manage, moderate, and organize comments on your guestbook


") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -77,13 +77,13 @@ func GuestbookDashboardCommentsView(title string, data CommonData, website model return templ_7745c5c3_Err } } - for _, c := range comments { - templ_7745c5c3_Err = GuestbookDashboardCommentView(data, website, c).Render(ctx, templ_7745c5c3_Buffer) + for i, c := range comments { + templ_7745c5c3_Err = GuestbookDashboardCommentView(data, website, c, i).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -97,7 +97,7 @@ func GuestbookDashboardCommentsView(title string, data CommonData, website model }) } -func GuestbookDashboardCommentView(data CommonData, w models.Website, c models.GuestbookComment) templ.Component { +func GuestbookDashboardCommentDeletePart(text string) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { @@ -118,186 +118,320 @@ func GuestbookDashboardCommentView(data CommonData, w models.Website, c models.G templ_7745c5c3_Var4 = templ.NopComponent } ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var5 string + templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(text) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 33, Col: 11} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) +} + +func GuestbookDashboardUpdateButtonPart(data CommonData, w models.Website, c models.GuestbookComment) templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var6 := templ.GetChildren(ctx) + if templ_7745c5c3_Var6 == nil { + templ_7745c5c3_Var6 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + hxHeaders := fmt.Sprintf("{\"X-CSRF-Token\": \"%s\"}", data.CSRFToken) + commentUrl := fmt.Sprintf("%s/dashboard/guestbook/comments/%s", wUrl(w), shortIdToSlug(c.ShortId)) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) +} + +func GuestbookDashboardCommentView(data CommonData, w models.Website, c models.GuestbookComment, i int) templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var9 := templ.GetChildren(ctx) + if templ_7745c5c3_Var9 == nil { + templ_7745c5c3_Var9 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) commentUrl := fmt.Sprintf("%s/dashboard/guestbook/comments/%s", wUrl(w), shortIdToSlug(c.ShortId)) hxHeaders := fmt.Sprintf("{\"X-CSRF-Token\": \"%s\"}", data.CSRFToken) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "
") + authorClass := fmt.Sprintf("comment-author-%d", i) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "
Delete ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } + var templ_7745c5c3_Var10 string + templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(authorClass) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 59, Col: 70} } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var9 string - templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(c.AuthorName) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 43, Col: 25} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "\">

") + var templ_7745c5c3_Var11 string + templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(authorClass) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 63, Col: 24} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - if len(c.AuthorEmail) > 0 { - email := "mailto:" + c.AuthorEmail - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "| ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var11 string - templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(c.AuthorEmail) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 46, Col: 66} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, " ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "\" class=\"comment-author\">") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err } - if len(c.AuthorSite) > 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "| ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var13 string - templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(c.AuthorSite) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 49, Col: 85} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } + var templ_7745c5c3_Var12 string + templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(c.AuthorName) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 63, Col: 64} } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "

") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var15 string - templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(c.CommentText) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 56, Col: 18} + if len(c.AuthorEmail) > 0 { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) + if len(c.AuthorSite) > 0 { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "

") + var templ_7745c5c3_Var19 string + templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("Actions for comment by %s", c.AuthorName)) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 79, Col: 112} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "\">") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if c.Deleted.IsZero() { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = GuestbookDashboardUpdateButtonPart(data, w, c).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var22 string + templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(c.CommentText) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 97, Col: 19} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "


") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -321,108 +455,108 @@ func commentForm(form forms.CommentCreateForm) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var16 := templ.GetChildren(ctx) - if templ_7745c5c3_Var16 == nil { - templ_7745c5c3_Var16 = templ.NopComponent + templ_7745c5c3_Var23 := templ.GetChildren(ctx) + if templ_7745c5c3_Var23 == nil { + templ_7745c5c3_Var23 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "
Leave a comment
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } error, exists := form.FieldErrors["authorName"] if exists { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, " Your name or handle
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } error, exists = form.FieldErrors["authorEmail"] if exists { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, " Your email address will only be shared with the guestbook's owner
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } error, exists = form.FieldErrors["authorSite"] if exists { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, " Link to your website or social profile
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } error, exists = form.FieldErrors["content"] if exists { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, " Share your thoughts, feedback, or just say hello!
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -446,9 +580,9 @@ func GuestbookView(title string, data CommonData, website models.Website, guestb }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var21 := templ.GetChildren(ctx) - if templ_7745c5c3_Var21 == nil { - templ_7745c5c3_Var21 = templ.NopComponent + templ_7745c5c3_Var28 := templ.GetChildren(ctx) + if templ_7745c5c3_Var28 == nil { + templ_7745c5c3_Var28 = templ.NopComponent } ctx = templ.ClearChildren(ctx) postUrl := fmt.Sprintf("/websites/%s/guestbook/comments/create", shortIdToSlug(website.ShortId)) @@ -458,68 +592,68 @@ func GuestbookView(title string, data CommonData, website models.Website, guestb return templ_7745c5c3_Err } } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "<html><head><title>") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var22 string - templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(title) + var templ_7745c5c3_Var29 string + templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 107, Col: 18} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 156, Col: 18} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var23 string - templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(website.Name) + var templ_7745c5c3_Var30 string + templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(website.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 114, Col: 24} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 164, Col: 24} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, " Guestbook

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, " Guestbook

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var24 string - templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(data.Flash) + var templ_7745c5c3_Var31 string + templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(data.Flash) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 115, Col: 18} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 165, Col: 18} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, "\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -527,104 +661,131 @@ func GuestbookView(title string, data CommonData, website models.Website, guestb if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "

Comments

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if len(comments) == 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "

No comments yet!

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, "

No comments yet!

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - for _, c := range comments { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "

") + for i, c := range comments { + commentAuthorRole := fmt.Sprintf("comment-author-%d", i+1) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if c.AuthorSite != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 59, "\" target=\"_blank\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var28 string - templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(c.AuthorName) + var templ_7745c5c3_Var37 string + templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(c.AuthorName) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 129, Col: 89} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 182, Col: 90} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var37)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else { - var templ_7745c5c3_Var29 string - templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(c.AuthorName) + var templ_7745c5c3_Var38 string + templ_7745c5c3_Var38, templ_7745c5c3_Err = templ.JoinStringErrs(c.AuthorName) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 131, Col: 24} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 184, Col: 25} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var38)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var32 string - templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(c.CommentText) + var templ_7745c5c3_Var41 string + templ_7745c5c3_Var41, templ_7745c5c3_Err = templ.JoinStringErrs(c.CommentText) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 136, Col: 24} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 191, Col: 25} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var41)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 64, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -649,61 +810,61 @@ func settingRadio(selected bool, name, id, value string) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var33 := templ.GetChildren(ctx) - if templ_7745c5c3_Var33 == nil { - templ_7745c5c3_Var33 = templ.NopComponent + templ_7745c5c3_Var42 := templ.GetChildren(ctx) + if templ_7745c5c3_Var42 == nil { + templ_7745c5c3_Var42 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 71, ">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -727,48 +888,48 @@ func EmbeddableGuestbookCommentForm(data CommonData, w models.Website, f forms.C }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var37 := templ.GetChildren(ctx) - if templ_7745c5c3_Var37 == nil { - templ_7745c5c3_Var37 = templ.NopComponent + templ_7745c5c3_Var46 := templ.GetChildren(ctx) + if templ_7745c5c3_Var46 == nil { + templ_7745c5c3_Var46 = templ.NopComponent } ctx = templ.ClearChildren(ctx) postUrl := fmt.Sprintf("/websites/%s/guestbook/comments/create?headless=true", shortIdToSlug(w.ShortId)) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 72, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var38 string - templ_7745c5c3_Var38, templ_7745c5c3_Err = templ.JoinStringErrs(data.Flash) + var templ_7745c5c3_Var47 string + templ_7745c5c3_Var47, templ_7745c5c3_Err = templ.JoinStringErrs(data.Flash) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 158, Col: 15} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 214, Col: 15} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var38)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var47)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 75, "\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -776,7 +937,7 @@ func EmbeddableGuestbookCommentForm(data CommonData, w models.Website, f forms.C if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 76, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -800,12 +961,12 @@ func AllGuestbooksView(data CommonData, websites []models.Website) templ.Compone }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var41 := templ.GetChildren(ctx) - if templ_7745c5c3_Var41 == nil { - templ_7745c5c3_Var41 = templ.NopComponent + templ_7745c5c3_Var50 := templ.GetChildren(ctx) + if templ_7745c5c3_Var50 == nil { + templ_7745c5c3_Var50 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var42 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var51 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { @@ -817,50 +978,50 @@ func AllGuestbooksView(data CommonData, websites []models.Website) templ.Compone }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "

This page exists only for testing the service.

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) - templ_7745c5c3_Err = base("All Guestbooks", data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var42), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = base("All Guestbooks", data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var51), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -884,47 +1045,47 @@ func GuestbookCommentCreateRemoteErrorView(url, err string) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var45 := templ.GetChildren(ctx) - if templ_7745c5c3_Var45 == nil { - templ_7745c5c3_Var45 = templ.NopComponent + templ_7745c5c3_Var54 := templ.GetChildren(ctx) + if templ_7745c5c3_Var54 == nil { + templ_7745c5c3_Var54 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 73, "

An error occurred while posting comment. ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 84, "\">

An error occurred while posting comment. ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var47 string - templ_7745c5c3_Var47, templ_7745c5c3_Err = templ.JoinStringErrs(err) + var templ_7745c5c3_Var56 string + templ_7745c5c3_Var56, templ_7745c5c3_Err = templ.JoinStringErrs(err) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 192, Col: 50} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 248, Col: 50} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var47)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var56)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 75, ". Redirecting.

Redirect

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 86, "\">Redirect

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -948,34 +1109,34 @@ func GuestbookCommentCreateRemoteSuccessView(url string) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var49 := templ.GetChildren(ctx) - if templ_7745c5c3_Var49 == nil { - templ_7745c5c3_Var49 = templ.NopComponent + templ_7745c5c3_Var58 := templ.GetChildren(ctx) + if templ_7745c5c3_Var58 == nil { + templ_7745c5c3_Var58 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 77, "

Comment successfully posted. Redirecting.

Comment successfully posted. Redirecting.

Redirect

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 89, "\">Redirect

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/ui/views/home.templ b/ui/views/home.templ index e4fa8c5..b3693e0 100644 --- a/ui/views/home.templ +++ b/ui/views/home.templ @@ -2,13 +2,14 @@ package views templ Home(title string, data CommonData) { @base(title, data) { -

Welcome

-

- Welcome to webweav.ing, a collection of webmastery tools created by the 32-Bit Cafe. -

-

- Note this service is in a pre-alpha state. Your account and data can disappear at any time. -

+
+

Welcome

+

Welcome to webweav.ing, a collection of webmastery tools created by the 32-Bit Cafe.

+ +
} } @@ -17,3 +18,11 @@ templ ComingSoon(title string, data CommonData) {

Coming Soon

} } + +templ AboutPage(title string, data CommonData) { + @base(title, data) { +
+

About Webweav.ing

+
+ } +} diff --git a/ui/views/home_templ.go b/ui/views/home_templ.go index 23a3c6d..03173a0 100644 --- a/ui/views/home_templ.go +++ b/ui/views/home_templ.go @@ -41,7 +41,7 @@ func Home(title string, data CommonData) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "

Welcome

Welcome to webweav.ing, a collection of webmastery tools created by the 32-Bit Cafe.

Note this service is in a pre-alpha state. Your account and data can disappear at any time.

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "

Welcome

Welcome to webweav.ing, a collection of webmastery tools created by the 32-Bit Cafe.

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -102,4 +102,51 @@ func ComingSoon(title string, data CommonData) templ.Component { }) } +func AboutPage(title string, data CommonData) templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var5 := templ.GetChildren(ctx) + if templ_7745c5c3_Var5 == nil { + templ_7745c5c3_Var5 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var6 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "

About Webweav.ing

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) + templ_7745c5c3_Err = base(title, data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) +} + var _ = templruntime.GeneratedTemplate diff --git a/ui/views/users.templ b/ui/views/users.templ index 92c5a19..dda28ba 100644 --- a/ui/views/users.templ +++ b/ui/views/users.templ @@ -86,20 +86,27 @@ templ UserSettingsView(data CommonData, timezones []string) { {{ user := data.CurrentUser }} @base("User Settings", data) {
-
- - - - -
+
+
+ +
+ User Settings +
+ + +
+
+ +
+
} } diff --git a/ui/views/users_templ.go b/ui/views/users_templ.go index d57378d..72a8bdc 100644 --- a/ui/views/users_templ.go +++ b/ui/views/users_templ.go @@ -444,20 +444,20 @@ func UserSettingsView(data CommonData, timezones []string) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -470,7 +470,7 @@ func UserSettingsView(data CommonData, timezones []string) templ.Component { var templ_7745c5c3_Var23 string templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(tz) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/users.templ`, Line: 95, Col: 25} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/users.templ`, Line: 99, Col: 28} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23)) if templ_7745c5c3_Err != nil { @@ -483,7 +483,7 @@ func UserSettingsView(data CommonData, timezones []string) templ.Component { var templ_7745c5c3_Var24 string templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(tz) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/users.templ`, Line: 95, Col: 48} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/users.templ`, Line: 99, Col: 51} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24)) if templ_7745c5c3_Err != nil { @@ -501,7 +501,7 @@ func UserSettingsView(data CommonData, timezones []string) templ.Component { var templ_7745c5c3_Var25 string templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(tz) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/users.templ`, Line: 97, Col: 25} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/users.templ`, Line: 101, Col: 28} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25)) if templ_7745c5c3_Err != nil { @@ -514,7 +514,7 @@ func UserSettingsView(data CommonData, timezones []string) templ.Component { var templ_7745c5c3_Var26 string templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(tz) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/users.templ`, Line: 97, Col: 32} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/users.templ`, Line: 101, Col: 35} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26)) if templ_7745c5c3_Err != nil { @@ -526,7 +526,7 @@ func UserSettingsView(data CommonData, timezones []string) templ.Component { } } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/ui/views/websites.templ b/ui/views/websites.templ index fab8123..ad80ccd 100644 --- a/ui/views/websites.templ +++ b/ui/views/websites.templ @@ -14,91 +14,126 @@ func wUrl(w models.Website) string { templ wSidebar(website models.Website) { {{ dashUrl := wUrl(website) + "/dashboard" }} {{ gbUrl := wUrl(website) + "/guestbook" }} - ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -129,148 +111,148 @@ func websiteCreateForm(csrfToken string, form forms.WebsiteCreateForm) templ.Com }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var9 := templ.GetChildren(ctx) - if templ_7745c5c3_Var9 == nil { - templ_7745c5c3_Var9 = templ.NopComponent + templ_7745c5c3_Var7 := templ.GetChildren(ctx) + if templ_7745c5c3_Var7 == nil { + templ_7745c5c3_Var7 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "
Website Settings
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + err, exists := form.FieldErrors["ws_name"] + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if exists { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "\" required aria-describedby=\"sitename-help\"> The display name for your website
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - err, exists := form.FieldErrors["sitename"] - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, " ") + err, exists = form.FieldErrors["ws_url"] + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if exists { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "\" required aria-describedby=\"siteurl-help\"> The full URL where your website can be accessed
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - err, exists = form.FieldErrors["siteurl"] - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, " ") + err, exists = form.FieldErrors["ws_author"] + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if exists { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - err, exists = form.FieldErrors["authorname"] - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, " ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if exists { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, " ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "\" required aria-describedby=\"authorname-help\"> Your name or the website owner's name
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -294,12 +276,12 @@ func WebsiteList(title string, data CommonData, websites []models.Website) templ }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var17 := templ.GetChildren(ctx) - if templ_7745c5c3_Var17 == nil { - templ_7745c5c3_Var17 = templ.NopComponent + templ_7745c5c3_Var15 := templ.GetChildren(ctx) + if templ_7745c5c3_Var15 == nil { + templ_7745c5c3_Var15 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var18 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var16 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { @@ -311,60 +293,152 @@ func WebsiteList(title string, data CommonData, websites []models.Website) templ }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "
Add Website
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "

My Websites

Add Website
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if len(websites) == 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "

No Websites yet. Register a website.

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "

No Websites yet.

Create your first website to get started with webweav.ing tools.

Create Your First Website") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) - templ_7745c5c3_Err = base(title, data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var18), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = base(title, data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var16), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -388,12 +462,12 @@ func WebsiteDashboard(title string, data CommonData, website models.Website) tem }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var21 := templ.GetChildren(ctx) - if templ_7745c5c3_Var21 == nil { - templ_7745c5c3_Var21 = templ.NopComponent + templ_7745c5c3_Var27 := templ.GetChildren(ctx) + if templ_7745c5c3_Var27 == nil { + templ_7745c5c3_Var27 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var22 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var28 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { @@ -405,7 +479,7 @@ func WebsiteDashboard(title string, data CommonData, website models.Website) tem }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -413,74 +487,52 @@ func WebsiteDashboard(title string, data CommonData, website models.Website) tem if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "

Embed your Guestbook

Upload this JavaScript WebComponent to your site and include it in your ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var23 string - templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(``) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/websites.templ`, Line: 112, Col: 140} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, " tag.

")
-			if templ_7745c5c3_Err != nil {
-				return templ_7745c5c3_Err
-			}
-			var templ_7745c5c3_Var24 string
-			templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(
-				`
-    
-`)
-			if templ_7745c5c3_Err != nil {
-				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/websites.templ`, Line: 121, Col: 8}
-			}
-			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24))
-			if templ_7745c5c3_Err != nil {
-				return templ_7745c5c3_Err
-			}
-			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "

Then add the custom elements where you want your form and comments to show up

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } gbUrl := fmt.Sprintf("https://%s/websites/%s/guestbook", data.RootUrl, shortIdToSlug(website.ShortId)) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "
")
+			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "

Embed your Guestbook

There are two ways to add your guestbook to your website: using our JavaScript component (recommended) or with an iframe.

Method 1: JavaScript Component (Recommended)

Step 1: Download and upload the component

Download this JavaScript WebComponent and upload it to your website's JavaScript folder.

Step 2: Include in your HTML head

Add this script tag to your <head> section:
<head> <script type="module" src="js/guestbook.js"></script> </head>

Step 3: Add the custom elements

Place these elements where you want your guestbook to appear:
")
 			if templ_7745c5c3_Err != nil {
 				return templ_7745c5c3_Err
 			}
-			var templ_7745c5c3_Var25 string
-			templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf(`
+			var templ_7745c5c3_Var29 string
+			templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf(`
 `, gbUrl, gbUrl))
 			if templ_7745c5c3_Err != nil {
-				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/websites.templ`, Line: 132, Col: 72}
+				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/websites.templ`, Line: 177, Col: 72}
 			}
-			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25))
+			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29))
 			if templ_7745c5c3_Err != nil {
 				return templ_7745c5c3_Err
 			}
-			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "

If your web host does not allow CORS requests, use an iframe instead

")
+			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, "

Method 2: iframe (Alternative)

Use this method if your web host doesn't allow CORS requests

If your hosting provider blocks cross-origin requests, you can embed the guestbook using an iframe instead:

iframe embedding code:
")
 			if templ_7745c5c3_Err != nil {
 				return templ_7745c5c3_Err
 			}
-			var templ_7745c5c3_Var26 string
-			templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf(``, gbUrl))
+			var templ_7745c5c3_Var30 string
+			templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf(``, gbUrl, gbUrl))
 			if templ_7745c5c3_Err != nil {
-				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/websites.templ`, Line: 142, Col: 75}
+				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/websites.templ`, Line: 200, Col: 25}
 			}
-			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26))
+			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30))
 			if templ_7745c5c3_Err != nil {
 				return templ_7745c5c3_Err
 			}
-			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) - templ_7745c5c3_Err = base(title, data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var22), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = base(title, data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var28), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -504,207 +556,207 @@ func websiteSettingsForm(data CommonData, website models.Website, form forms.Web }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var27 := templ.GetChildren(ctx) - if templ_7745c5c3_Var27 == nil { - templ_7745c5c3_Var27 = templ.NopComponent + templ_7745c5c3_Var31 := templ.GetChildren(ctx) + if templ_7745c5c3_Var31 == nil { + templ_7745c5c3_Var31 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "

Website Settings

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "Website Settings
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } err, exists := form.FieldErrors["ws_name"] - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if exists { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, " ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if form.SiteName != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - err, exists = form.FieldErrors["ws_url"] - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, " ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if exists { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, " ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if form.SiteUrl != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var32 string - templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(form.SiteUrl) + templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(err) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/websites.templ`, Line: 172, Col: 68} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/websites.templ`, Line: 226, Col: 29} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, "\" required>") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "\" required aria-describedby=\"sitename-help\"> ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - err, exists = form.FieldErrors["ws_author"] - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, " ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if exists { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 59, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + err, exists = form.FieldErrors["ws_url"] + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if exists { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, "\" required aria-describedby=\"siteurl-help\"> ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 59, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 61, "The full URL where your website can be accessed
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + err, exists = form.FieldErrors["ws_author"] + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if exists { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + if form.AuthorName != "" { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 69, "Your name or the website owner's name
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -728,122 +780,122 @@ func guestbookSettingsForm(data CommonData, website models.Website, gb models.Gu }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var37 := templ.GetChildren(ctx) - if templ_7745c5c3_Var37 == nil { - templ_7745c5c3_Var37 = templ.NopComponent + templ_7745c5c3_Var41 := templ.GetChildren(ctx) + if templ_7745c5c3_Var41 == nil { + templ_7745c5c3_Var41 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "

Guestbook Settings

Allow embedding guestbook on external websites
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -867,53 +919,53 @@ func SettingsForm(data CommonData, website models.Website, form forms.WebsiteSet }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var41 := templ.GetChildren(ctx) - if templ_7745c5c3_Var41 == nil { - templ_7745c5c3_Var41 = templ.NopComponent + templ_7745c5c3_Var45 := templ.GetChildren(ctx) + if templ_7745c5c3_Var45 == nil { + templ_7745c5c3_Var45 = templ.NopComponent } ctx = templ.ClearChildren(ctx) putUrl := fmt.Sprintf("/websites/%s/settings", shortIdToSlug(website.ShortId)) gb := website.Guestbook - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 84, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 89, "\" hx-swap=\"outerHTML\">

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var43 string - templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(msg) + var templ_7745c5c3_Var47 string + templ_7745c5c3_Var47, templ_7745c5c3_Err = templ.JoinStringErrs(msg) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/websites.templ`, Line: 239, Col: 8} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/websites.templ`, Line: 317, Col: 8} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var47)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 86, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 91, "\">
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -921,11 +973,15 @@ func SettingsForm(data CommonData, website models.Website, form forms.WebsiteSet if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 92, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } templ_7745c5c3_Err = guestbookSettingsForm(data, website, gb, form).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 88, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 93, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -949,67 +1005,93 @@ func DeleteForm(data CommonData, website models.Website, form forms.WebsiteDelet }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var45 := templ.GetChildren(ctx) - if templ_7745c5c3_Var45 == nil { - templ_7745c5c3_Var45 = templ.NopComponent + templ_7745c5c3_Var49 := templ.GetChildren(ctx) + if templ_7745c5c3_Var49 == nil { + templ_7745c5c3_Var49 = templ.NopComponent } ctx = templ.ClearChildren(ctx) putUrl := fmt.Sprintf("/websites/%s", shortIdToSlug(website.ShortId)) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 89, "

Delete Website

Deleting a website is permanent. Be absolutely sure before proceeding.

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 96, "\">
Delete Website") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } err, exists := form.FieldErrors["delete"] - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 92, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 97, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if exists { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 93, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 95, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 100, " Type ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var54 string + templ_7745c5c3_Var54, templ_7745c5c3_Err = templ.JoinStringErrs(website.Name) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/websites.templ`, Line: 346, Col: 47} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var54)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 102, " exactly as shown to confirm deletion
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1033,13 +1115,13 @@ func WebsiteDashboardSettings(data CommonData, website models.Website, form form }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var49 := templ.GetChildren(ctx) - if templ_7745c5c3_Var49 == nil { - templ_7745c5c3_Var49 = templ.NopComponent + templ_7745c5c3_Var55 := templ.GetChildren(ctx) + if templ_7745c5c3_Var55 == nil { + templ_7745c5c3_Var55 = templ.NopComponent } ctx = templ.ClearChildren(ctx) title := fmt.Sprintf("%s - Settings", website.Name) - templ_7745c5c3_Var50 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var56 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { @@ -1051,7 +1133,7 @@ func WebsiteDashboardSettings(data CommonData, website models.Website, form form }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 96, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 103, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1059,7 +1141,7 @@ func WebsiteDashboardSettings(data CommonData, website models.Website, form form if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 97, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 104, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1067,17 +1149,21 @@ func WebsiteDashboardSettings(data CommonData, website models.Website, form form if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 105, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } templ_7745c5c3_Err = DeleteForm(data, website, forms.WebsiteDeleteForm{}).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 98, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 106, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) - templ_7745c5c3_Err = base(title, data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var50), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = base(title, data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var56), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1101,12 +1187,12 @@ func WebsiteDashboardComingSoon(title string, data CommonData, website models.We }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var51 := templ.GetChildren(ctx) - if templ_7745c5c3_Var51 == nil { - templ_7745c5c3_Var51 = templ.NopComponent + templ_7745c5c3_Var57 := templ.GetChildren(ctx) + if templ_7745c5c3_Var57 == nil { + templ_7745c5c3_Var57 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var52 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var58 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { @@ -1118,7 +1204,7 @@ func WebsiteDashboardComingSoon(title string, data CommonData, website models.We }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 99, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 107, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1126,13 +1212,13 @@ func WebsiteDashboardComingSoon(title string, data CommonData, website models.We if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 100, "

Coming Soon

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 108, "

Coming Soon

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) - templ_7745c5c3_Err = base(title, data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var52), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = base(title, data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var58), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1156,12 +1242,12 @@ func WebsiteCreate(title string, data CommonData, form forms.WebsiteCreateForm) }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var53 := templ.GetChildren(ctx) - if templ_7745c5c3_Var53 == nil { - templ_7745c5c3_Var53 = templ.NopComponent + templ_7745c5c3_Var59 := templ.GetChildren(ctx) + if templ_7745c5c3_Var59 == nil { + templ_7745c5c3_Var59 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var54 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var60 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { @@ -1173,7 +1259,7 @@ func WebsiteCreate(title string, data CommonData, form forms.WebsiteCreateForm) }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 101, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 109, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1181,13 +1267,13 @@ func WebsiteCreate(title string, data CommonData, form forms.WebsiteCreateForm) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 102, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 110, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) - templ_7745c5c3_Err = base(title, data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var54), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = base(title, data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var60), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err }