567 lines
		
	
	
		
			24 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			567 lines
		
	
	
		
			24 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
// Code generated by templ - DO NOT EDIT.
 | 
						|
 | 
						|
// templ: version: v0.3.833
 | 
						|
package views
 | 
						|
 | 
						|
//lint:file-ignore SA4006 This context is only used if a nested component is present.
 | 
						|
 | 
						|
import "github.com/a-h/templ"
 | 
						|
import templruntime "github.com/a-h/templ/runtime"
 | 
						|
 | 
						|
import "fmt"
 | 
						|
import "git.32bit.cafe/32bitcafe/guestbook/internal/models"
 | 
						|
import "git.32bit.cafe/32bitcafe/guestbook/internal/forms"
 | 
						|
 | 
						|
func gbUrl(gb models.Guestbook) string {
 | 
						|
	return fmt.Sprintf("/guestbooks/%s", shortIdToSlug(gb.ShortId))
 | 
						|
}
 | 
						|
 | 
						|
func gbCreateForm(csrf_token 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 {
 | 
						|
			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_Var1 := templ.GetChildren(ctx)
 | 
						|
		if templ_7745c5c3_Var1 == nil {
 | 
						|
			templ_7745c5c3_Var1 = templ.NopComponent
 | 
						|
		}
 | 
						|
		ctx = templ.ClearChildren(ctx)
 | 
						|
		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<input type=\"hidden\" name=\"csrf_token\" value=\"")
 | 
						|
		if templ_7745c5c3_Err != nil {
 | 
						|
			return templ_7745c5c3_Err
 | 
						|
		}
 | 
						|
		var templ_7745c5c3_Var2 string
 | 
						|
		templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(csrf_token)
 | 
						|
		if templ_7745c5c3_Err != nil {
 | 
						|
			return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 12, Col: 61}
 | 
						|
		}
 | 
						|
		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
 | 
						|
		if templ_7745c5c3_Err != nil {
 | 
						|
			return templ_7745c5c3_Err
 | 
						|
		}
 | 
						|
		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\"> <label for=\"siteurl\">Site URL: </label> <input type=\"text\" name=\"siteurl\" id=\"siteurl\" required> <button type=\"submit\">Submit</button>")
 | 
						|
		if templ_7745c5c3_Err != nil {
 | 
						|
			return templ_7745c5c3_Err
 | 
						|
		}
 | 
						|
		return nil
 | 
						|
	})
 | 
						|
}
 | 
						|
 | 
						|
func GuestbookDashboardCommentsView(title string, data CommonData, website models.Website, guestbook models.Guestbook, comments []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_Var3 := templ.GetChildren(ctx)
 | 
						|
		if templ_7745c5c3_Var3 == nil {
 | 
						|
			templ_7745c5c3_Var3 = templ.NopComponent
 | 
						|
		}
 | 
						|
		ctx = templ.ClearChildren(ctx)
 | 
						|
		templ_7745c5c3_Var4 := 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, "<div id=\"dashboard\">")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			templ_7745c5c3_Err = wSidebar(website).Render(ctx, templ_7745c5c3_Buffer)
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "<div><h1>Comments on ")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			var templ_7745c5c3_Var5 string
 | 
						|
			templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(website.SiteUrl)
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 23, Col: 49}
 | 
						|
			}
 | 
						|
			_, 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, 5, "</h1>")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			if len(comments) == 0 {
 | 
						|
				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "<p>No comments yet!</p>")
 | 
						|
				if templ_7745c5c3_Err != nil {
 | 
						|
					return templ_7745c5c3_Err
 | 
						|
				}
 | 
						|
			}
 | 
						|
			for _, c := range comments {
 | 
						|
				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "<div><strong>")
 | 
						|
				if templ_7745c5c3_Err != nil {
 | 
						|
					return templ_7745c5c3_Err
 | 
						|
				}
 | 
						|
				var templ_7745c5c3_Var6 string
 | 
						|
				templ_7745c5c3_Var6, 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: 29, Col: 46}
 | 
						|
				}
 | 
						|
				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
 | 
						|
				if templ_7745c5c3_Err != nil {
 | 
						|
					return templ_7745c5c3_Err
 | 
						|
				}
 | 
						|
				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "</strong> ")
 | 
						|
				if templ_7745c5c3_Err != nil {
 | 
						|
					return templ_7745c5c3_Err
 | 
						|
				}
 | 
						|
				var templ_7745c5c3_Var7 string
 | 
						|
				templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(c.Created.Format("01-02-2006 03:04PM"))
 | 
						|
				if templ_7745c5c3_Err != nil {
 | 
						|
					return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 30, Col: 64}
 | 
						|
				}
 | 
						|
				_, 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, 9, "<p>")
 | 
						|
				if templ_7745c5c3_Err != nil {
 | 
						|
					return templ_7745c5c3_Err
 | 
						|
				}
 | 
						|
				var templ_7745c5c3_Var8 string
 | 
						|
				templ_7745c5c3_Var8, 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: 32, Col: 43}
 | 
						|
				}
 | 
						|
				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
 | 
						|
				if templ_7745c5c3_Err != nil {
 | 
						|
					return templ_7745c5c3_Err
 | 
						|
				}
 | 
						|
				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "</p></div>")
 | 
						|
				if templ_7745c5c3_Err != nil {
 | 
						|
					return templ_7745c5c3_Err
 | 
						|
				}
 | 
						|
			}
 | 
						|
			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "</div></div>")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			return nil
 | 
						|
		})
 | 
						|
		templ_7745c5c3_Err = base(title, data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer)
 | 
						|
		if templ_7745c5c3_Err != nil {
 | 
						|
			return templ_7745c5c3_Err
 | 
						|
		}
 | 
						|
		return nil
 | 
						|
	})
 | 
						|
}
 | 
						|
 | 
						|
func commentForm(form forms.CommentCreateForm) 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)
 | 
						|
		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "<div><label for=\"authorname\">Name: </label>")
 | 
						|
		if templ_7745c5c3_Err != nil {
 | 
						|
			return templ_7745c5c3_Err
 | 
						|
		}
 | 
						|
		error, exists := form.FieldErrors["authorName"]
 | 
						|
		if exists {
 | 
						|
			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "<label class=\"error\">")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			var templ_7745c5c3_Var10 string
 | 
						|
			templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(error)
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 46, Col: 36}
 | 
						|
			}
 | 
						|
			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "</label> ")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
		}
 | 
						|
		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "<input type=\"text\" name=\"authorname\" id=\"authorname\"></div><div><label for=\"authoremail\">Email: </label>")
 | 
						|
		if templ_7745c5c3_Err != nil {
 | 
						|
			return templ_7745c5c3_Err
 | 
						|
		}
 | 
						|
		error, exists = form.FieldErrors["authorEmail"]
 | 
						|
		if exists {
 | 
						|
			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "<label class=\"error\">")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			var templ_7745c5c3_Var11 string
 | 
						|
			templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(error)
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 54, Col: 36}
 | 
						|
			}
 | 
						|
			_, 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, 17, "</label> ")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
		}
 | 
						|
		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "<input type=\"text\" name=\"authoremail\" id=\"authoremail\"></div><div><label for=\"authorsite\">Site Url: </label>")
 | 
						|
		if templ_7745c5c3_Err != nil {
 | 
						|
			return templ_7745c5c3_Err
 | 
						|
		}
 | 
						|
		error, exists = form.FieldErrors["authorSite"]
 | 
						|
		if exists {
 | 
						|
			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "<label class=\"error\">")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			var templ_7745c5c3_Var12 string
 | 
						|
			templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(error)
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 62, Col: 36}
 | 
						|
			}
 | 
						|
			_, 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, 20, "</label> ")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
		}
 | 
						|
		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "<input type=\"text\" name=\"authorsite\" id=\"authorsite\"></div><div><label for=\"content\">Comment: </label>")
 | 
						|
		if templ_7745c5c3_Err != nil {
 | 
						|
			return templ_7745c5c3_Err
 | 
						|
		}
 | 
						|
		error, exists = form.FieldErrors["content"]
 | 
						|
		if exists {
 | 
						|
			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "<label class=\"error\">")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			var templ_7745c5c3_Var13 string
 | 
						|
			templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(error)
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 70, Col: 36}
 | 
						|
			}
 | 
						|
			_, 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, 23, "</label> ")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
		}
 | 
						|
		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "<textarea name=\"content\" id=\"content\"></textarea></div><div><input type=\"submit\" value=\"Submit\"></div>")
 | 
						|
		if templ_7745c5c3_Err != nil {
 | 
						|
			return templ_7745c5c3_Err
 | 
						|
		}
 | 
						|
		return nil
 | 
						|
	})
 | 
						|
}
 | 
						|
 | 
						|
func GuestbookCommentList(comments []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_Var14 := templ.GetChildren(ctx)
 | 
						|
		if templ_7745c5c3_Var14 == nil {
 | 
						|
			templ_7745c5c3_Var14 = templ.NopComponent
 | 
						|
		}
 | 
						|
		ctx = templ.ClearChildren(ctx)
 | 
						|
		if len(comments) == 0 {
 | 
						|
			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "<p>No comments yet!</p>")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
		}
 | 
						|
		for _, c := range comments {
 | 
						|
			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "<div><strong>")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			var templ_7745c5c3_Var15 string
 | 
						|
			templ_7745c5c3_Var15, 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: 85, Col: 34}
 | 
						|
			}
 | 
						|
			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "</strong> ")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			var templ_7745c5c3_Var16 string
 | 
						|
			templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(c.Created.Format("01-02-2006 03:04PM"))
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 86, Col: 52}
 | 
						|
			}
 | 
						|
			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "<p>")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			var templ_7745c5c3_Var17 string
 | 
						|
			templ_7745c5c3_Var17, 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: 88, Col: 31}
 | 
						|
			}
 | 
						|
			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "</p></div>")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
		}
 | 
						|
		return nil
 | 
						|
	})
 | 
						|
}
 | 
						|
 | 
						|
func GuestbookView(title string, data CommonData, website models.Website, guestbook models.Guestbook, comments []models.GuestbookComment, form forms.CommentCreateForm) 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_Var18 := templ.GetChildren(ctx)
 | 
						|
		if templ_7745c5c3_Var18 == nil {
 | 
						|
			templ_7745c5c3_Var18 = templ.NopComponent
 | 
						|
		}
 | 
						|
		ctx = templ.ClearChildren(ctx)
 | 
						|
		postUrl := fmt.Sprintf("/websites/%s/guestbook/comments/create", shortIdToSlug(website.ShortId))
 | 
						|
		if data.IsHtmx {
 | 
						|
			templ_7745c5c3_Err = commentForm(form).Render(ctx, templ_7745c5c3_Buffer)
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
		} else {
 | 
						|
			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "<div id=\"main\"><div><h1>Guestbook for ")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			var templ_7745c5c3_Var19 string
 | 
						|
			templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(website.SiteUrl)
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 101, Col: 51}
 | 
						|
			}
 | 
						|
			_, 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, 31, "</h1><form action=\"")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			var templ_7745c5c3_Var20 templ.SafeURL = templ.URL(postUrl)
 | 
						|
			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var20)))
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "\" method=\"post\"><input type=\"hidden\" name=\"csrf_token\" value=\"")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			var templ_7745c5c3_Var21 string
 | 
						|
			templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(data.CSRFToken)
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 103, Col: 80}
 | 
						|
			}
 | 
						|
			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
 | 
						|
			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
 | 
						|
			}
 | 
						|
			templ_7745c5c3_Err = commentForm(form).Render(ctx, templ_7745c5c3_Buffer)
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "</form></div><div id=\"comments\">")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			templ_7745c5c3_Err = GuestbookCommentList(comments).Render(ctx, templ_7745c5c3_Buffer)
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "</div></div>")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
		}
 | 
						|
		return nil
 | 
						|
	})
 | 
						|
}
 | 
						|
 | 
						|
func CreateGuestbookComment(title string, data CommonData, website models.Website, guestbook models.Guestbook, form forms.CommentCreateForm) 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_Var22 := templ.GetChildren(ctx)
 | 
						|
		if templ_7745c5c3_Var22 == nil {
 | 
						|
			templ_7745c5c3_Var22 = templ.NopComponent
 | 
						|
		}
 | 
						|
		ctx = templ.ClearChildren(ctx)
 | 
						|
		postUrl := fmt.Sprintf("/websites/%s/guestbook/comments/create", shortIdToSlug(website.ShortId))
 | 
						|
		if data.IsHtmx {
 | 
						|
			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "<form hx-post=\"")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			var templ_7745c5c3_Var23 string
 | 
						|
			templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(postUrl)
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 117, Col: 31}
 | 
						|
			}
 | 
						|
			_, 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, 37, "\" hx-target=\"closest div\">")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			templ_7745c5c3_Err = commentForm(form).Render(ctx, templ_7745c5c3_Buffer)
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "</form>")
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
		} else {
 | 
						|
			templ_7745c5c3_Var24 := 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, 39, "<form action=\"")
 | 
						|
				if templ_7745c5c3_Err != nil {
 | 
						|
					return templ_7745c5c3_Err
 | 
						|
				}
 | 
						|
				var templ_7745c5c3_Var25 templ.SafeURL = templ.URL(postUrl)
 | 
						|
				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var25)))
 | 
						|
				if templ_7745c5c3_Err != nil {
 | 
						|
					return templ_7745c5c3_Err
 | 
						|
				}
 | 
						|
				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "\" method=\"post\">")
 | 
						|
				if templ_7745c5c3_Err != nil {
 | 
						|
					return templ_7745c5c3_Err
 | 
						|
				}
 | 
						|
				templ_7745c5c3_Err = commentForm(form).Render(ctx, templ_7745c5c3_Buffer)
 | 
						|
				if templ_7745c5c3_Err != nil {
 | 
						|
					return templ_7745c5c3_Err
 | 
						|
				}
 | 
						|
				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "</form>")
 | 
						|
				if templ_7745c5c3_Err != nil {
 | 
						|
					return templ_7745c5c3_Err
 | 
						|
				}
 | 
						|
				return nil
 | 
						|
			})
 | 
						|
			templ_7745c5c3_Err = base(title, data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var24), templ_7745c5c3_Buffer)
 | 
						|
			if templ_7745c5c3_Err != nil {
 | 
						|
				return templ_7745c5c3_Err
 | 
						|
			}
 | 
						|
		}
 | 
						|
		return nil
 | 
						|
	})
 | 
						|
}
 | 
						|
 | 
						|
var _ = templruntime.GeneratedTemplate
 |