separate guestbook from dashboard, add specific comments view
This commit is contained in:
		
							parent
							
								
									d899769ba0
								
							
						
					
					
						commit
						e658f15463
					
				@ -192,7 +192,27 @@ func (app *application) getGuestbook(w http.ResponseWriter, r *http.Request) {
 | 
				
			|||||||
        return
 | 
					        return
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    data := app.newCommonData(r)
 | 
					    data := app.newCommonData(r)
 | 
				
			||||||
    views.GuestbookView("Guestbook", data, guestbook, comments).Render(r.Context(), w)
 | 
					    views.GuestbookView("Guestbook", data, guestbook, comments, forms.CommentCreateForm{}).Render(r.Context(), w)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (app *application) getGuestbookDashboard(w http.ResponseWriter, r *http.Request) {
 | 
				
			||||||
 | 
					    slug := r.PathValue("id")
 | 
				
			||||||
 | 
					    guestbook, err := app.guestbooks.Get(slugToShortId(slug))
 | 
				
			||||||
 | 
					    if err != nil {
 | 
				
			||||||
 | 
					        if errors.Is(err, models.ErrNoRecord) {
 | 
				
			||||||
 | 
					            http.NotFound(w, r)
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            app.serverError(w, r, err)
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    comments, err := app.guestbookComments.GetAll(guestbook.ID)
 | 
				
			||||||
 | 
					    if err != nil {
 | 
				
			||||||
 | 
					        app.serverError(w, r, err)
 | 
				
			||||||
 | 
					        return
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    data := app.newCommonData(r)
 | 
				
			||||||
 | 
					    views.GuestbookDashboardView("Guestbook", data, guestbook, comments).Render(r.Context(), w)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (app *application) getGuestbookComments(w http.ResponseWriter, r *http.Request) {
 | 
					func (app *application) getGuestbookComments(w http.ResponseWriter, r *http.Request) {
 | 
				
			||||||
@ -211,18 +231,8 @@ func (app *application) getGuestbookComments(w http.ResponseWriter, r *http.Requ
 | 
				
			|||||||
        app.serverError(w, r, err)
 | 
					        app.serverError(w, r, err)
 | 
				
			||||||
        return
 | 
					        return
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    data := app.newTemplateData(r)
 | 
					    data := app.newCommonData(r)
 | 
				
			||||||
    data.Guestbook = guestbook
 | 
					    views.GuestbookDashboardCommentsView("Comments", data, guestbook, comments).Render(r.Context(), w)
 | 
				
			||||||
    data.Comments = comments
 | 
					 | 
				
			||||||
    app.render(w, r, http.StatusOK, "commentlist.view.tmpl.html", data)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
type commentCreateForm struct {
 | 
					 | 
				
			||||||
    AuthorName  string  `schema:"authorname"`
 | 
					 | 
				
			||||||
    AuthorEmail string  `schema:"authoremail"`
 | 
					 | 
				
			||||||
    AuthorSite  string  `schema:"authorsite"`
 | 
					 | 
				
			||||||
    Content     string  `schema:"content,required"`
 | 
					 | 
				
			||||||
    validator.Validator `schema:"-"`
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (app *application) getGuestbookCommentCreate(w http.ResponseWriter, r *http.Request) {
 | 
					func (app *application) getGuestbookCommentCreate(w http.ResponseWriter, r *http.Request) {
 | 
				
			||||||
@ -239,7 +249,7 @@ func (app *application) getGuestbookCommentCreate(w http.ResponseWriter, r *http
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    data := app.newTemplateData(r)
 | 
					    data := app.newTemplateData(r)
 | 
				
			||||||
    data.Guestbook = guestbook
 | 
					    data.Guestbook = guestbook
 | 
				
			||||||
    data.Form = commentCreateForm{}
 | 
					    data.Form = forms.CommentCreateForm{}
 | 
				
			||||||
    app.render(w, r, http.StatusOK, "commentcreate.view.tmpl.html", data)
 | 
					    app.render(w, r, http.StatusOK, "commentcreate.view.tmpl.html", data)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -255,7 +265,7 @@ func (app *application) postGuestbookCommentCreate(w http.ResponseWriter, r *htt
 | 
				
			|||||||
        return
 | 
					        return
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var form commentCreateForm
 | 
					    var form forms.CommentCreateForm
 | 
				
			||||||
    err = app.decodePostForm(r, &form)
 | 
					    err = app.decodePostForm(r, &form)
 | 
				
			||||||
    if err != nil {
 | 
					    if err != nil {
 | 
				
			||||||
        app.clientError(w, http.StatusBadRequest)
 | 
					        app.clientError(w, http.StatusBadRequest)
 | 
				
			||||||
 | 
				
			|||||||
@ -30,6 +30,8 @@ func (app *application) routes() http.Handler {
 | 
				
			|||||||
    mux.Handle("GET /guestbooks", protected.ThenFunc(app.getGuestbookList))
 | 
					    mux.Handle("GET /guestbooks", protected.ThenFunc(app.getGuestbookList))
 | 
				
			||||||
    mux.Handle("GET /guestbooks/create", protected.ThenFunc(app.getGuestbookCreate))
 | 
					    mux.Handle("GET /guestbooks/create", protected.ThenFunc(app.getGuestbookCreate))
 | 
				
			||||||
    mux.Handle("POST /guestbooks/create", protected.ThenFunc(app.postGuestbookCreate))
 | 
					    mux.Handle("POST /guestbooks/create", protected.ThenFunc(app.postGuestbookCreate))
 | 
				
			||||||
 | 
					    mux.Handle("GET /guestbooks/{id}/dashboard", protected.ThenFunc(app.getGuestbookDashboard))
 | 
				
			||||||
 | 
					    mux.Handle("GET /guestbooks/{id}/dashboard/comments", protected.ThenFunc(app.getGuestbookComments))
 | 
				
			||||||
    mux.Handle("GET /guestbooks/{id}/comments/create", protected.ThenFunc(app.getGuestbookCommentCreate))
 | 
					    mux.Handle("GET /guestbooks/{id}/comments/create", protected.ThenFunc(app.getGuestbookCommentCreate))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -15,3 +15,11 @@ type UserLoginForm struct {
 | 
				
			|||||||
    validator.Validator `schema:"-"`
 | 
					    validator.Validator `schema:"-"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type CommentCreateForm struct {
 | 
				
			||||||
 | 
					    AuthorName  string  `schema:"authorname"`
 | 
				
			||||||
 | 
					    AuthorEmail string  `schema:"authoremail"`
 | 
				
			||||||
 | 
					    AuthorSite  string  `schema:"authorsite"`
 | 
				
			||||||
 | 
					    Content     string  `schema:"content,required"`
 | 
				
			||||||
 | 
					    validator.Validator `schema:"-"`
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -50,16 +50,17 @@ main {
 | 
				
			|||||||
  padding: 1rem;
 | 
					  padding: 1rem;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
div#main {
 | 
					div#dashboard {
 | 
				
			||||||
  display: flex;
 | 
					  display: flex;
 | 
				
			||||||
  flex-flow: row wrap;
 | 
					  flex-flow: row wrap;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
div#main nav {
 | 
					div#dashboard nav {
 | 
				
			||||||
  flex: 1 1 25%;
 | 
					  flex: 1 1 25%;
 | 
				
			||||||
 | 
					  margin-top: 2rem;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
div#main > div {
 | 
					div#dashboard > div {
 | 
				
			||||||
  flex: 10 1 40%;
 | 
					  flex: 10 1 40%;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -2,6 +2,11 @@ package views
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import "fmt"
 | 
					import "fmt"
 | 
				
			||||||
import "git.32bit.cafe/32bitcafe/guestbook/internal/models"
 | 
					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", gb.Slug())
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
templ gbCreateForm(csrf_token string) {
 | 
					templ gbCreateForm(csrf_token string) {
 | 
				
			||||||
    <input type="hidden" name="csrf_token" value={ csrf_token }>
 | 
					    <input type="hidden" name="csrf_token" value={ csrf_token }>
 | 
				
			||||||
@ -16,8 +21,7 @@ templ gbList(guestbooks []models.Guestbook) {
 | 
				
			|||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        <ul id="guestbooks" hx-get="/guestbooks" hx-trigger="newGuestbook from:body" hx-swap="outerHTML">
 | 
					        <ul id="guestbooks" hx-get="/guestbooks" hx-trigger="newGuestbook from:body" hx-swap="outerHTML">
 | 
				
			||||||
            for _, gb := range guestbooks {
 | 
					            for _, gb := range guestbooks {
 | 
				
			||||||
                {{ gbUrl := fmt.Sprintf("/guestbooks/%s", gb.Slug()) }}
 | 
					                <li><a href={ templ.URL(gbUrl(gb) + "/dashboard") }>
 | 
				
			||||||
                <li><a href={ templ.URL(gbUrl) }>
 | 
					 | 
				
			||||||
                    if len(gb.SiteUrl) == 0 {
 | 
					                    if len(gb.SiteUrl) == 0 {
 | 
				
			||||||
                        Untitled
 | 
					                        Untitled
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
@ -59,22 +63,24 @@ templ GuestbookCreate(title string, data CommonData) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
templ sidebar(guestbook models.Guestbook) {
 | 
					templ sidebar(guestbook models.Guestbook) {
 | 
				
			||||||
    {{ gbUrl := fmt.Sprintf("/guestbooks/%s", guestbook.Slug()) }}
 | 
					    {{ dashUrl := gbUrl(guestbook) + "/dashboard" }}
 | 
				
			||||||
    <nav>
 | 
					    <nav>
 | 
				
			||||||
        <div>
 | 
					        <div>
 | 
				
			||||||
 | 
					            <a href={ templ.URL(gbUrl(guestbook)) } target="_blank">View Guestbook</a>
 | 
				
			||||||
            <h3>Messages</h3>
 | 
					            <h3>Messages</h3>
 | 
				
			||||||
            <ul>
 | 
					            <ul>
 | 
				
			||||||
                <li><a href={ templ.URL(gbUrl + "/comments") }>Manage messages</a></li>
 | 
					                <li><a href={ templ.URL(dashUrl) }>Dashboard</a></li>
 | 
				
			||||||
                <li><a href={ templ.URL(gbUrl + "/comments/queue") }>Review message queue</a></li>
 | 
					                <li><a href={ templ.URL(dashUrl + "/comments") }>Manage messages</a></li>
 | 
				
			||||||
                <li><a href={ templ.URL(gbUrl + "/blocklist") }>Block users</a></li>
 | 
					                <li><a href={ templ.URL(dashUrl + "/comments/queue") }>Review message queue</a></li>
 | 
				
			||||||
                <li><a href={ templ.URL(gbUrl + "/comments/trash") }>Trash</a></li>
 | 
					                <li><a href={ templ.URL(dashUrl + "/blocklist") }>Block users</a></li>
 | 
				
			||||||
 | 
					                <li><a href={ templ.URL(dashUrl + "/comments/trash") }>Trash</a></li>
 | 
				
			||||||
            </ul>
 | 
					            </ul>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
        <div>
 | 
					        <div>
 | 
				
			||||||
            <h3>Design</h3>
 | 
					            <h3>Design</h3>
 | 
				
			||||||
            <ul>
 | 
					            <ul>
 | 
				
			||||||
                <li><a href={ templ.URL(gbUrl + "/themes") }>Themes</a></li>
 | 
					                <li><a href={ templ.URL(dashUrl + "/themes") }>Themes</a></li>
 | 
				
			||||||
                <li><a href={ templ.URL(gbUrl + "/customize") }>Custom CSS</a></li>
 | 
					                <li><a href={ templ.URL(dashUrl + "/customize") }>Custom CSS</a></li>
 | 
				
			||||||
            </ul>
 | 
					            </ul>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
        <div>
 | 
					        <div>
 | 
				
			||||||
@ -88,16 +94,24 @@ templ sidebar(guestbook models.Guestbook) {
 | 
				
			|||||||
    </nav>
 | 
					    </nav>
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
templ GuestbookView(title string, data CommonData, guestbook models.Guestbook, comments []models.GuestbookComment) {
 | 
					templ GuestbookDashboardView(title string, data CommonData, guestbook models.Guestbook, comments []models.GuestbookComment) {
 | 
				
			||||||
    @base(title, data) {
 | 
					    @base(title, data) {
 | 
				
			||||||
        <div id="main">
 | 
					        <div id="dashboard">
 | 
				
			||||||
            @sidebar(guestbook)
 | 
					            @sidebar(guestbook)
 | 
				
			||||||
            <div>
 | 
					            <div>
 | 
				
			||||||
                <h1>Guestbook for { guestbook.SiteUrl }</h1>
 | 
					                <h1>Guestbook for { guestbook.SiteUrl }</h1>
 | 
				
			||||||
                {{ commentCreateUrl := fmt.Sprintf("/guestbooks/%s/comments/create", guestbook.Slug()) }}
 | 
					                <p>Stats and stuff will go here</p>
 | 
				
			||||||
                <p>
 | 
					            </div>
 | 
				
			||||||
                    <a href={ templ.URL(commentCreateUrl) }>New Comment</a>
 | 
					        </div>
 | 
				
			||||||
                </p>
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					templ GuestbookDashboardCommentsView(title string, data CommonData, guestbook models.Guestbook, comments []models.GuestbookComment) {
 | 
				
			||||||
 | 
					    @base(title, data) {
 | 
				
			||||||
 | 
					        <div id="dashboard">
 | 
				
			||||||
 | 
					            @sidebar(guestbook)
 | 
				
			||||||
 | 
					            <div>
 | 
				
			||||||
 | 
					                <h1>Comments on { guestbook.SiteUrl }</h1>
 | 
				
			||||||
                if len(comments) == 0 {
 | 
					                if len(comments) == 0 {
 | 
				
			||||||
                    <p>No comments yet!</p>
 | 
					                    <p>No comments yet!</p>
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@ -114,3 +128,66 @@ templ GuestbookView(title string, data CommonData, guestbook models.Guestbook, c
 | 
				
			|||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					templ commentForm(data CommonData, gb models.Guestbook, form forms.CommentCreateForm) {
 | 
				
			||||||
 | 
					    {{ postUrl := fmt.Sprintf("/guestbooks/%s/comments/create", gb.Slug()) }}
 | 
				
			||||||
 | 
					    <form action={ templ.URL(postUrl) } method="post">
 | 
				
			||||||
 | 
					        <input type="hidden" name="csrf_token" value={data.CSRFToken}>
 | 
				
			||||||
 | 
					        <div>
 | 
				
			||||||
 | 
					            <label for="authorname">Name: </label>
 | 
				
			||||||
 | 
					            {{ error, exists := form.FieldErrors["authorName"] }}
 | 
				
			||||||
 | 
					            if exists {
 | 
				
			||||||
 | 
					                <label class="error">{ error }</label>
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            <input type="text" name="authorname" id="authorname" >
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					        <div>
 | 
				
			||||||
 | 
					            <label for="authoremail">Email: </label>
 | 
				
			||||||
 | 
					            {{ error, exists = form.FieldErrors["authorEmail"] }}
 | 
				
			||||||
 | 
					            if exists {
 | 
				
			||||||
 | 
					                <label class="error">{ error }</label>
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            <input type="text" name="authoremail" id="authoremail" >
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					        <div>
 | 
				
			||||||
 | 
					            <label for="authorsite">Site Url: </label>
 | 
				
			||||||
 | 
					            {{ error, exists = form.FieldErrors["authorSite"] }}
 | 
				
			||||||
 | 
					            if exists {
 | 
				
			||||||
 | 
					                <label class="error">{ error }</label>
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            <input type="text" name="authorsite" id="authorsite" >
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					        <div>
 | 
				
			||||||
 | 
					            <label for="content">Comment: </label>
 | 
				
			||||||
 | 
					            {{ error, exists = form.FieldErrors["content"] }}
 | 
				
			||||||
 | 
					            if exists {
 | 
				
			||||||
 | 
					                <label class="error">{ error }</label>
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            <textarea name="content" id="content"></textarea>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					        <div>
 | 
				
			||||||
 | 
					            <input type="submit" value="Submit">
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					    </form>
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					templ GuestbookView(title string, data CommonData, guestbook models.Guestbook, comments []models.GuestbookComment, form forms.CommentCreateForm) {
 | 
				
			||||||
 | 
					        <div id="main">
 | 
				
			||||||
 | 
					            <div>
 | 
				
			||||||
 | 
					                <h1>Guestbook for { guestbook.SiteUrl }</h1>
 | 
				
			||||||
 | 
					                @commentForm(data, guestbook, form)
 | 
				
			||||||
 | 
					                if len(comments) == 0 {
 | 
				
			||||||
 | 
					                    <p>No comments yet!</p>
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                for  _, c := range comments {
 | 
				
			||||||
 | 
					                    <div>
 | 
				
			||||||
 | 
					                        <strong>{ c.AuthorName }</strong>
 | 
				
			||||||
 | 
					                        { c.Created.Format("01-02-2006 03:04PM") }
 | 
				
			||||||
 | 
					                        <p>
 | 
				
			||||||
 | 
					                            { c.CommentText }
 | 
				
			||||||
 | 
					                        </p>
 | 
				
			||||||
 | 
					                    </div>
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            </div>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -10,6 +10,11 @@ import templruntime "github.com/a-h/templ/runtime"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import "fmt"
 | 
					import "fmt"
 | 
				
			||||||
import "git.32bit.cafe/32bitcafe/guestbook/internal/models"
 | 
					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", gb.Slug())
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func gbCreateForm(csrf_token string) templ.Component {
 | 
					func gbCreateForm(csrf_token string) templ.Component {
 | 
				
			||||||
	return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
 | 
						return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
 | 
				
			||||||
@ -39,7 +44,7 @@ func gbCreateForm(csrf_token string) templ.Component {
 | 
				
			|||||||
		var templ_7745c5c3_Var2 string
 | 
							var templ_7745c5c3_Var2 string
 | 
				
			||||||
		templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(csrf_token)
 | 
							templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(csrf_token)
 | 
				
			||||||
		if templ_7745c5c3_Err != nil {
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
			return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 7, Col: 61}
 | 
								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))
 | 
							_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
 | 
				
			||||||
		if templ_7745c5c3_Err != nil {
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
@ -85,12 +90,11 @@ func gbList(guestbooks []models.Guestbook) templ.Component {
 | 
				
			|||||||
				return templ_7745c5c3_Err
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			for _, gb := range guestbooks {
 | 
								for _, gb := range guestbooks {
 | 
				
			||||||
				gbUrl := fmt.Sprintf("/guestbooks/%s", gb.Slug())
 | 
					 | 
				
			||||||
				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "<li><a href=\"")
 | 
									templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "<li><a href=\"")
 | 
				
			||||||
				if templ_7745c5c3_Err != nil {
 | 
									if templ_7745c5c3_Err != nil {
 | 
				
			||||||
					return templ_7745c5c3_Err
 | 
										return templ_7745c5c3_Err
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				var templ_7745c5c3_Var4 templ.SafeURL = templ.URL(gbUrl)
 | 
									var templ_7745c5c3_Var4 templ.SafeURL = templ.URL(gbUrl(gb) + "/dashboard")
 | 
				
			||||||
				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var4)))
 | 
									_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var4)))
 | 
				
			||||||
				if templ_7745c5c3_Err != nil {
 | 
									if templ_7745c5c3_Err != nil {
 | 
				
			||||||
					return templ_7745c5c3_Err
 | 
										return templ_7745c5c3_Err
 | 
				
			||||||
@ -108,7 +112,7 @@ func gbList(guestbooks []models.Guestbook) templ.Component {
 | 
				
			|||||||
					var templ_7745c5c3_Var5 string
 | 
										var templ_7745c5c3_Var5 string
 | 
				
			||||||
					templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(gb.SiteUrl)
 | 
										templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(gb.SiteUrl)
 | 
				
			||||||
					if templ_7745c5c3_Err != nil {
 | 
										if templ_7745c5c3_Err != nil {
 | 
				
			||||||
						return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 24, Col: 36}
 | 
											return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 28, Col: 36}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
 | 
										_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
 | 
				
			||||||
					if templ_7745c5c3_Err != nil {
 | 
										if templ_7745c5c3_Err != nil {
 | 
				
			||||||
@ -278,62 +282,80 @@ func sidebar(guestbook models.Guestbook) templ.Component {
 | 
				
			|||||||
			templ_7745c5c3_Var10 = templ.NopComponent
 | 
								templ_7745c5c3_Var10 = templ.NopComponent
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		ctx = templ.ClearChildren(ctx)
 | 
							ctx = templ.ClearChildren(ctx)
 | 
				
			||||||
		gbUrl := fmt.Sprintf("/guestbooks/%s", guestbook.Slug())
 | 
							dashUrl := gbUrl(guestbook) + "/dashboard"
 | 
				
			||||||
		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "<nav><div><h3>Messages</h3><ul><li><a href=\"")
 | 
							templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "<nav><div><a href=\"")
 | 
				
			||||||
		if templ_7745c5c3_Err != nil {
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
			return templ_7745c5c3_Err
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		var templ_7745c5c3_Var11 templ.SafeURL = templ.URL(gbUrl + "/comments")
 | 
							var templ_7745c5c3_Var11 templ.SafeURL = templ.URL(gbUrl(guestbook))
 | 
				
			||||||
		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var11)))
 | 
							_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var11)))
 | 
				
			||||||
		if templ_7745c5c3_Err != nil {
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
			return templ_7745c5c3_Err
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "\">Manage messages</a></li><li><a href=\"")
 | 
							templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "\" target=\"_blank\">View Guestbook</a><h3>Messages</h3><ul><li><a href=\"")
 | 
				
			||||||
		if templ_7745c5c3_Err != nil {
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
			return templ_7745c5c3_Err
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		var templ_7745c5c3_Var12 templ.SafeURL = templ.URL(gbUrl + "/comments/queue")
 | 
							var templ_7745c5c3_Var12 templ.SafeURL = templ.URL(dashUrl)
 | 
				
			||||||
		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var12)))
 | 
							_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var12)))
 | 
				
			||||||
		if templ_7745c5c3_Err != nil {
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
			return templ_7745c5c3_Err
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "\">Review message queue</a></li><li><a href=\"")
 | 
							templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "\">Dashboard</a></li><li><a href=\"")
 | 
				
			||||||
		if templ_7745c5c3_Err != nil {
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
			return templ_7745c5c3_Err
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		var templ_7745c5c3_Var13 templ.SafeURL = templ.URL(gbUrl + "/blocklist")
 | 
							var templ_7745c5c3_Var13 templ.SafeURL = templ.URL(dashUrl + "/comments")
 | 
				
			||||||
		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var13)))
 | 
							_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var13)))
 | 
				
			||||||
		if templ_7745c5c3_Err != nil {
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
			return templ_7745c5c3_Err
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "\">Block users</a></li><li><a href=\"")
 | 
							templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "\">Manage messages</a></li><li><a href=\"")
 | 
				
			||||||
		if templ_7745c5c3_Err != nil {
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
			return templ_7745c5c3_Err
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		var templ_7745c5c3_Var14 templ.SafeURL = templ.URL(gbUrl + "/comments/trash")
 | 
							var templ_7745c5c3_Var14 templ.SafeURL = templ.URL(dashUrl + "/comments/queue")
 | 
				
			||||||
		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var14)))
 | 
							_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var14)))
 | 
				
			||||||
		if templ_7745c5c3_Err != nil {
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
			return templ_7745c5c3_Err
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "\">Trash</a></li></ul></div><div><h3>Design</h3><ul><li><a href=\"")
 | 
							templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "\">Review message queue</a></li><li><a href=\"")
 | 
				
			||||||
		if templ_7745c5c3_Err != nil {
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
			return templ_7745c5c3_Err
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		var templ_7745c5c3_Var15 templ.SafeURL = templ.URL(gbUrl + "/themes")
 | 
							var templ_7745c5c3_Var15 templ.SafeURL = templ.URL(dashUrl + "/blocklist")
 | 
				
			||||||
		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var15)))
 | 
							_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var15)))
 | 
				
			||||||
		if templ_7745c5c3_Err != nil {
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
			return templ_7745c5c3_Err
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "\">Themes</a></li><li><a href=\"")
 | 
							templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "\">Block users</a></li><li><a href=\"")
 | 
				
			||||||
		if templ_7745c5c3_Err != nil {
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
			return templ_7745c5c3_Err
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		var templ_7745c5c3_Var16 templ.SafeURL = templ.URL(gbUrl + "/customize")
 | 
							var templ_7745c5c3_Var16 templ.SafeURL = templ.URL(dashUrl + "/comments/trash")
 | 
				
			||||||
		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var16)))
 | 
							_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var16)))
 | 
				
			||||||
		if templ_7745c5c3_Err != nil {
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
			return templ_7745c5c3_Err
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "\">Custom CSS</a></li></ul></div><div><h3>Account</h3><ul><li><a href=\"/users/settings\">Settings</a></li><li><a href=\"/users/privacy\">Privacy</a></li><li><a href=\"/help\">Help</a></li></ul></div></nav>")
 | 
							templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "\">Trash</a></li></ul></div><div><h3>Design</h3><ul><li><a href=\"")
 | 
				
			||||||
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							var templ_7745c5c3_Var17 templ.SafeURL = templ.URL(dashUrl + "/themes")
 | 
				
			||||||
 | 
							_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var17)))
 | 
				
			||||||
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "\">Themes</a></li><li><a href=\"")
 | 
				
			||||||
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							var templ_7745c5c3_Var18 templ.SafeURL = templ.URL(dashUrl + "/customize")
 | 
				
			||||||
 | 
							_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var18)))
 | 
				
			||||||
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "\">Custom CSS</a></li></ul></div><div><h3>Account</h3><ul><li><a href=\"/users/settings\">Settings</a></li><li><a href=\"/users/privacy\">Privacy</a></li><li><a href=\"/help\">Help</a></li></ul></div></nav>")
 | 
				
			||||||
		if templ_7745c5c3_Err != nil {
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
			return templ_7745c5c3_Err
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@ -341,7 +363,7 @@ func sidebar(guestbook models.Guestbook) templ.Component {
 | 
				
			|||||||
	})
 | 
						})
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func GuestbookView(title string, data CommonData, guestbook models.Guestbook, comments []models.GuestbookComment) templ.Component {
 | 
					func GuestbookDashboardView(title string, data CommonData, guestbook models.Guestbook, comments []models.GuestbookComment) templ.Component {
 | 
				
			||||||
	return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
 | 
						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
 | 
							templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
 | 
				
			||||||
		if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
 | 
							if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
 | 
				
			||||||
@ -357,12 +379,12 @@ func GuestbookView(title string, data CommonData, guestbook models.Guestbook, co
 | 
				
			|||||||
			}()
 | 
								}()
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		ctx = templ.InitializeContext(ctx)
 | 
							ctx = templ.InitializeContext(ctx)
 | 
				
			||||||
		templ_7745c5c3_Var17 := templ.GetChildren(ctx)
 | 
							templ_7745c5c3_Var19 := templ.GetChildren(ctx)
 | 
				
			||||||
		if templ_7745c5c3_Var17 == nil {
 | 
							if templ_7745c5c3_Var19 == nil {
 | 
				
			||||||
			templ_7745c5c3_Var17 = templ.NopComponent
 | 
								templ_7745c5c3_Var19 = templ.NopComponent
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		ctx = templ.ClearChildren(ctx)
 | 
							ctx = templ.ClearChildren(ctx)
 | 
				
			||||||
		templ_7745c5c3_Var18 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
 | 
							templ_7745c5c3_Var20 := 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_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
 | 
				
			||||||
			templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
 | 
								templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
 | 
				
			||||||
			if !templ_7745c5c3_IsBuffer {
 | 
								if !templ_7745c5c3_IsBuffer {
 | 
				
			||||||
@ -374,7 +396,7 @@ func GuestbookView(title string, data CommonData, guestbook models.Guestbook, co
 | 
				
			|||||||
				}()
 | 
									}()
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			ctx = templ.InitializeContext(ctx)
 | 
								ctx = templ.InitializeContext(ctx)
 | 
				
			||||||
			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "<div id=\"main\">")
 | 
								templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "<div id=\"dashboard\">")
 | 
				
			||||||
			if templ_7745c5c3_Err != nil {
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
				return templ_7745c5c3_Err
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@ -382,95 +404,398 @@ func GuestbookView(title string, data CommonData, guestbook models.Guestbook, co
 | 
				
			|||||||
			if templ_7745c5c3_Err != nil {
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
				return templ_7745c5c3_Err
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "<div><h1>Guestbook for ")
 | 
								templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "<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(guestbook.SiteUrl)
 | 
					 | 
				
			||||||
			if templ_7745c5c3_Err != nil {
 | 
					 | 
				
			||||||
				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 96, Col: 53}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			_, 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, 24, "</h1>")
 | 
					 | 
				
			||||||
			if templ_7745c5c3_Err != nil {
 | 
					 | 
				
			||||||
				return templ_7745c5c3_Err
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			commentCreateUrl := fmt.Sprintf("/guestbooks/%s/comments/create", guestbook.Slug())
 | 
					 | 
				
			||||||
			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "<p><a href=\"")
 | 
					 | 
				
			||||||
			if templ_7745c5c3_Err != nil {
 | 
					 | 
				
			||||||
				return templ_7745c5c3_Err
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			var templ_7745c5c3_Var20 templ.SafeURL = templ.URL(commentCreateUrl)
 | 
					 | 
				
			||||||
			_, 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, 26, "\">New Comment</a></p>")
 | 
					 | 
				
			||||||
			if templ_7745c5c3_Err != nil {
 | 
					 | 
				
			||||||
				return templ_7745c5c3_Err
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if len(comments) == 0 {
 | 
					 | 
				
			||||||
				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "<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, 28, "<div><strong>")
 | 
					 | 
				
			||||||
			if templ_7745c5c3_Err != nil {
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
				return templ_7745c5c3_Err
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			var templ_7745c5c3_Var21 string
 | 
								var templ_7745c5c3_Var21 string
 | 
				
			||||||
				templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(c.AuthorName)
 | 
								templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(guestbook.SiteUrl)
 | 
				
			||||||
			if templ_7745c5c3_Err != nil {
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
					return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 106, Col: 46}
 | 
									return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 102, Col: 53}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
 | 
								_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
 | 
				
			||||||
			if templ_7745c5c3_Err != nil {
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
				return templ_7745c5c3_Err
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "</strong> ")
 | 
								templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "</h1><p>Stats and stuff will go here</p></div></div>")
 | 
				
			||||||
				if templ_7745c5c3_Err != nil {
 | 
					 | 
				
			||||||
					return templ_7745c5c3_Err
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
				var templ_7745c5c3_Var22 string
 | 
					 | 
				
			||||||
				templ_7745c5c3_Var22, 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: 107, Col: 64}
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
				_, 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, 30, "<p>")
 | 
					 | 
				
			||||||
				if templ_7745c5c3_Err != nil {
 | 
					 | 
				
			||||||
					return templ_7745c5c3_Err
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
				var templ_7745c5c3_Var23 string
 | 
					 | 
				
			||||||
				templ_7745c5c3_Var23, 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: 109, Col: 43}
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
				_, 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, 31, "</p></div>")
 | 
					 | 
				
			||||||
				if templ_7745c5c3_Err != nil {
 | 
					 | 
				
			||||||
					return templ_7745c5c3_Err
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "</div></div>")
 | 
					 | 
				
			||||||
			if templ_7745c5c3_Err != nil {
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
				return templ_7745c5c3_Err
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			return nil
 | 
								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_Var20), templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return nil
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func GuestbookDashboardCommentsView(title string, data CommonData, 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_Var22 := templ.GetChildren(ctx)
 | 
				
			||||||
 | 
							if templ_7745c5c3_Var22 == nil {
 | 
				
			||||||
 | 
								templ_7745c5c3_Var22 = templ.NopComponent
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							ctx = templ.ClearChildren(ctx)
 | 
				
			||||||
 | 
							templ_7745c5c3_Var23 := 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, 27, "<div id=\"dashboard\">")
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								templ_7745c5c3_Err = sidebar(guestbook).Render(ctx, templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "<div><h1>Comments on ")
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								var templ_7745c5c3_Var24 string
 | 
				
			||||||
 | 
								templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(guestbook.SiteUrl)
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 114, Col: 51}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								_, 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, 29, "</h1>")
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								if len(comments) == 0 {
 | 
				
			||||||
 | 
									templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "<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, 31, "<div><strong>")
 | 
				
			||||||
 | 
									if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
										return templ_7745c5c3_Err
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									var templ_7745c5c3_Var25 string
 | 
				
			||||||
 | 
									templ_7745c5c3_Var25, 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: 120, Col: 46}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25))
 | 
				
			||||||
 | 
									if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
										return templ_7745c5c3_Err
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "</strong> ")
 | 
				
			||||||
 | 
									if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
										return templ_7745c5c3_Err
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									var templ_7745c5c3_Var26 string
 | 
				
			||||||
 | 
									templ_7745c5c3_Var26, 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: 121, Col: 64}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26))
 | 
				
			||||||
 | 
									if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
										return templ_7745c5c3_Err
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "<p>")
 | 
				
			||||||
 | 
									if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
										return templ_7745c5c3_Err
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									var templ_7745c5c3_Var27 string
 | 
				
			||||||
 | 
									templ_7745c5c3_Var27, 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: 123, Col: 43}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27))
 | 
				
			||||||
 | 
									if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
										return templ_7745c5c3_Err
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "</p></div>")
 | 
				
			||||||
 | 
									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
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
							templ_7745c5c3_Err = base(title, data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var23), templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return nil
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func commentForm(data CommonData, gb 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_Var28 := templ.GetChildren(ctx)
 | 
				
			||||||
 | 
							if templ_7745c5c3_Var28 == nil {
 | 
				
			||||||
 | 
								templ_7745c5c3_Var28 = templ.NopComponent
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							ctx = templ.ClearChildren(ctx)
 | 
				
			||||||
 | 
							postUrl := fmt.Sprintf("/guestbooks/%s/comments/create", gb.Slug())
 | 
				
			||||||
 | 
							templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "<form action=\"")
 | 
				
			||||||
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							var templ_7745c5c3_Var29 templ.SafeURL = templ.URL(postUrl)
 | 
				
			||||||
 | 
							_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var29)))
 | 
				
			||||||
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "\" method=\"post\"><input type=\"hidden\" name=\"csrf_token\" value=\"")
 | 
				
			||||||
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							var templ_7745c5c3_Var30 string
 | 
				
			||||||
 | 
							templ_7745c5c3_Var30, 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: 135, Col: 68}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							_, 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, 38, "\"><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, 39, "<label class=\"error\">")
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								var templ_7745c5c3_Var31 string
 | 
				
			||||||
 | 
								templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(error)
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 140, Col: 44}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								_, 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, 40, "</label> ")
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "<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, 42, "<label class=\"error\">")
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								var templ_7745c5c3_Var32 string
 | 
				
			||||||
 | 
								templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(error)
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 148, Col: 44}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								_, 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, 43, "</label> ")
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "<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, 45, "<label class=\"error\">")
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								var templ_7745c5c3_Var33 string
 | 
				
			||||||
 | 
								templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(error)
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 156, Col: 44}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33))
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "</label> ")
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "<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, 48, "<label class=\"error\">")
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								var templ_7745c5c3_Var34 string
 | 
				
			||||||
 | 
								templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(error)
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 164, Col: 44}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34))
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "</label> ")
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "<textarea name=\"content\" id=\"content\"></textarea></div><div><input type=\"submit\" value=\"Submit\"></div></form>")
 | 
				
			||||||
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return nil
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func GuestbookView(title string, data CommonData, 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_Var35 := templ.GetChildren(ctx)
 | 
				
			||||||
 | 
							if templ_7745c5c3_Var35 == nil {
 | 
				
			||||||
 | 
								templ_7745c5c3_Var35 = templ.NopComponent
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							ctx = templ.ClearChildren(ctx)
 | 
				
			||||||
 | 
							templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "<div id=\"main\"><div><h1>Guestbook for ")
 | 
				
			||||||
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							var templ_7745c5c3_Var36 string
 | 
				
			||||||
 | 
							templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs(guestbook.SiteUrl)
 | 
				
			||||||
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
								return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 177, Col: 53}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36))
 | 
				
			||||||
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, "</h1>")
 | 
				
			||||||
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							templ_7745c5c3_Err = commentForm(data, guestbook, form).Render(ctx, templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if len(comments) == 0 {
 | 
				
			||||||
 | 
								templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "<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, 54, "<div><strong>")
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								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: 184, Col: 46}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								_, 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, 55, "</strong> ")
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								var templ_7745c5c3_Var38 string
 | 
				
			||||||
 | 
								templ_7745c5c3_Var38, 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: 185, Col: 64}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								_, 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, 56, "<p>")
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								var templ_7745c5c3_Var39 string
 | 
				
			||||||
 | 
								templ_7745c5c3_Var39, 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: 187, Col: 43}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var39))
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, "</p></div>")
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, "</div></div>")
 | 
				
			||||||
		if templ_7745c5c3_Err != nil {
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
			return templ_7745c5c3_Err
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
				
			|||||||
@ -12,18 +12,44 @@ Untitled
 | 
				
			|||||||
</form>
 | 
					</form>
 | 
				
			||||||
<form action=\"/guestbooks/create\" method=\"post\">
 | 
					<form action=\"/guestbooks/create\" method=\"post\">
 | 
				
			||||||
</form>
 | 
					</form>
 | 
				
			||||||
<nav><div><h3>Messages</h3><ul><li><a href=\"
 | 
					<nav><div><a href=\"
 | 
				
			||||||
 | 
					\" target=\"_blank\">View Guestbook</a><h3>Messages</h3><ul><li><a href=\"
 | 
				
			||||||
 | 
					\">Dashboard</a></li><li><a href=\"
 | 
				
			||||||
\">Manage messages</a></li><li><a href=\"
 | 
					\">Manage messages</a></li><li><a href=\"
 | 
				
			||||||
\">Review message queue</a></li><li><a href=\"
 | 
					\">Review message queue</a></li><li><a href=\"
 | 
				
			||||||
\">Block users</a></li><li><a href=\"
 | 
					\">Block users</a></li><li><a href=\"
 | 
				
			||||||
\">Trash</a></li></ul></div><div><h3>Design</h3><ul><li><a href=\"
 | 
					\">Trash</a></li></ul></div><div><h3>Design</h3><ul><li><a href=\"
 | 
				
			||||||
\">Themes</a></li><li><a href=\"
 | 
					\">Themes</a></li><li><a href=\"
 | 
				
			||||||
\">Custom CSS</a></li></ul></div><div><h3>Account</h3><ul><li><a href=\"/users/settings\">Settings</a></li><li><a href=\"/users/privacy\">Privacy</a></li><li><a href=\"/help\">Help</a></li></ul></div></nav>
 | 
					\">Custom CSS</a></li></ul></div><div><h3>Account</h3><ul><li><a href=\"/users/settings\">Settings</a></li><li><a href=\"/users/privacy\">Privacy</a></li><li><a href=\"/help\">Help</a></li></ul></div></nav>
 | 
				
			||||||
<div id=\"main\">
 | 
					<div id=\"dashboard\">
 | 
				
			||||||
<div><h1>Guestbook for 
 | 
					<div><h1>Guestbook for 
 | 
				
			||||||
 | 
					</h1><p>Stats and stuff will go here</p></div></div>
 | 
				
			||||||
 | 
					<div id=\"dashboard\">
 | 
				
			||||||
 | 
					<div><h1>Comments on 
 | 
				
			||||||
 | 
					</h1>
 | 
				
			||||||
 | 
					<p>No comments yet!</p>
 | 
				
			||||||
 | 
					<div><strong>
 | 
				
			||||||
 | 
					</strong> 
 | 
				
			||||||
 | 
					<p>
 | 
				
			||||||
 | 
					</p></div>
 | 
				
			||||||
 | 
					</div></div>
 | 
				
			||||||
 | 
					<form action=\"
 | 
				
			||||||
 | 
					\" method=\"post\"><input type=\"hidden\" name=\"csrf_token\" value=\"
 | 
				
			||||||
 | 
					\"><div><label for=\"authorname\">Name: </label>
 | 
				
			||||||
 | 
					<label class=\"error\">
 | 
				
			||||||
 | 
					</label> 
 | 
				
			||||||
 | 
					<input type=\"text\" name=\"authorname\" id=\"authorname\"></div><div><label for=\"authoremail\">Email: </label>
 | 
				
			||||||
 | 
					<label class=\"error\">
 | 
				
			||||||
 | 
					</label> 
 | 
				
			||||||
 | 
					<input type=\"text\" name=\"authoremail\" id=\"authoremail\"></div><div><label for=\"authorsite\">Site Url: </label>
 | 
				
			||||||
 | 
					<label class=\"error\">
 | 
				
			||||||
 | 
					</label> 
 | 
				
			||||||
 | 
					<input type=\"text\" name=\"authorsite\" id=\"authorsite\"></div><div><label for=\"content\">Comment: </label>
 | 
				
			||||||
 | 
					<label class=\"error\">
 | 
				
			||||||
 | 
					</label> 
 | 
				
			||||||
 | 
					<textarea name=\"content\" id=\"content\"></textarea></div><div><input type=\"submit\" value=\"Submit\"></div></form>
 | 
				
			||||||
 | 
					<div id=\"main\"><div><h1>Guestbook for 
 | 
				
			||||||
</h1>
 | 
					</h1>
 | 
				
			||||||
<p><a href=\"
 | 
					 | 
				
			||||||
\">New Comment</a></p>
 | 
					 | 
				
			||||||
<p>No comments yet!</p>
 | 
					<p>No comments yet!</p>
 | 
				
			||||||
<div><strong>
 | 
					<div><strong>
 | 
				
			||||||
</strong> 
 | 
					</strong> 
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user