fix loading of ticket add page
This commit is contained in:
@@ -24,6 +24,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
templateHandlers "synlotto-website/internal/handlers/template"
|
||||||
|
templateHelpers "synlotto-website/internal/helpers/template"
|
||||||
ticketStorage "synlotto-website/internal/storage/tickets"
|
ticketStorage "synlotto-website/internal/storage/tickets"
|
||||||
|
|
||||||
"synlotto-website/internal/models"
|
"synlotto-website/internal/models"
|
||||||
@@ -37,10 +39,17 @@ import (
|
|||||||
const sessionKeyUserID = "UserID"
|
const sessionKeyUserID = "UserID"
|
||||||
|
|
||||||
func AddGet(c *gin.Context) {
|
func AddGet(c *gin.Context) {
|
||||||
c.HTML(http.StatusOK, "account/tickets/add_ticket.html", gin.H{
|
app := c.MustGet("app").(*bootstrap.App)
|
||||||
"title": "Add Ticket",
|
data := templateHandlers.BuildTemplateData(app, c.Writer, c.Request)
|
||||||
"csrfToken": nosurf.Token(c.Request),
|
ctx := templateHelpers.TemplateContext(c.Writer, c.Request, data)
|
||||||
})
|
tmpl := templateHelpers.LoadTemplateFiles("layout.html", "web/templates/account/tickets/add_ticket.html")
|
||||||
|
|
||||||
|
c.Header("Content-Type", "text/html; charset=utf-8")
|
||||||
|
if err := tmpl.ExecuteTemplate(c.Writer, "account/tickets/add_ticket.html", ctx); err != nil {
|
||||||
|
c.String(http.StatusInternalServerError, "render error: %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.Status(http.StatusOK)
|
||||||
}
|
}
|
||||||
|
|
||||||
func AddPost(c *gin.Context) {
|
func AddPost(c *gin.Context) {
|
||||||
|
|||||||
Reference in New Issue
Block a user