diff --git a/context/foreign_wishlist.go b/context/foreign_wishlist.go index d27f4a5..ce8165c 100644 --- a/context/foreign_wishlist.go +++ b/context/foreign_wishlist.go @@ -39,12 +39,12 @@ func (ctx *Context) ForeignWishlist(w http.ResponseWriter, r *http.Request) { templates.Execute(w, "foreign_wishlist.gotmpl", p) } -type publicForeignWishlistProps struct { +type publicWishlistProps struct { Username string GiftCount int } -func (ctx *Context) PublicForeignWishlist(w http.ResponseWriter, r *http.Request) { +func (ctx *Context) PublicWishlist(w http.ResponseWriter, r *http.Request) { userReference := r.PathValue("userReference") otherUser, err := db.GetUserByReference(userReference) if err != nil { @@ -60,6 +60,6 @@ func (ctx *Context) PublicForeignWishlist(w http.ResponseWriter, r *http.Request error.Page(w, "An error occurred while fetching data about this user :(", http.StatusInternalServerError, err) return } - p := publicForeignWishlistProps{Username: otherUser.Name, GiftCount: giftCount} + p := publicWishlistProps{Username: otherUser.Name, GiftCount: giftCount} templates.Execute(w, "public_foreign_wishlist.gotmpl", p) } diff --git a/main.go b/main.go index d58fa5c..5ceca5e 100644 --- a/main.go +++ b/main.go @@ -33,7 +33,7 @@ func main() { publicMux.HandleFunc("POST /register", authMiddleware.RegisterPost) publicMux.HandleFunc("GET /", authMiddleware.Login) publicMux.HandleFunc("POST /", authMiddleware.LoginPost) - publicMux.HandleFunc("GET /list/{userReference}", ctx.PublicForeignWishlist) + publicMux.HandleFunc("GET /list/{userReference}", ctx.PublicWishlist) protectedMux.HandleFunc("GET /{$}", ctx.Home) protectedMux.HandleFunc("POST /{$}", ctx.HomePost) diff --git a/templates/public_foreign_wishlist.gotmpl b/templates/public_foreign_wishlist.gotmpl index 5e85b6b..3cd4206 100644 --- a/templates/public_foreign_wishlist.gotmpl +++ b/templates/public_foreign_wishlist.gotmpl @@ -19,14 +19,14 @@

{{.Username}}'s list

{{if eq .GiftCount 0}} -

{{.Username}} doesn't have any gift ideas!

+

{{.Username}} hasn't written any gift ideas!

{{template "login_prompt"}} to add some! :^)

{{else}} {{if eq .GiftCount 1}} -

{{.Username}} only has one gift idea.

+

{{.Username}} has only written one gift idea.

{{template "login_prompt"}} to claim it, or add more! :^)

{{else}} -

{{.Username}} has {{.GiftCount}} gift ideas.

+

{{.Username}} has written {{.GiftCount}} gift ideas.

{{template "login_prompt"}} to claim an idea, or add more! :^)

{{end}} {{end}} @@ -34,4 +34,4 @@
-{{end}} \ No newline at end of file +{{end}} diff --git a/templates/templates.go b/templates/templates.go index 570477f..f36b24c 100644 --- a/templates/templates.go +++ b/templates/templates.go @@ -30,14 +30,14 @@ func loadTemplates() map[string]*template.Template { loginTmpl := template.Must(template.ParseFiles("templates/base.gotmpl", "templates/login.gotmpl")) registerTmpl := template.Must(template.ParseFiles("templates/base.gotmpl", "templates/register.gotmpl")) foreignTmpl := template.Must(template.ParseFiles("templates/base.gotmpl", "templates/foreign_wishlist.gotmpl")) - publicForeignTmpl := template.Must(template.ParseFiles("templates/base.gotmpl", "templates/public_foreign_wishlist.gotmpl")) + publicWishlistTmpl := template.Must(template.ParseFiles("templates/base.gotmpl", "templates/public_foreign_wishlist.gotmpl")) errorTmpl := template.Must(template.ParseFiles("templates/base.gotmpl", "templates/error_page.gotmpl")) return map[string]*template.Template{ "home.gotmpl": homeTmpl, "login.gotmpl": loginTmpl, "register.gotmpl": registerTmpl, "foreign_wishlist.gotmpl": foreignTmpl, - "public_foreign_wishlist.gotmpl": publicForeignTmpl, + "public_foreign_wishlist.gotmpl": publicWishlistTmpl, "error_page.gotmpl": errorTmpl, } }