Adding slug as way to get admin pages
This commit is contained in:
parent
bc76465c82
commit
bd94cf0f55
|
@ -45,6 +45,13 @@ func GetAdminLetsPlay(c *gin.Context) {
|
|||
"LP": LP,
|
||||
"page": "admin_lp",
|
||||
})
|
||||
} else if database.Db.Where("slug=?", id).First(&LP).Error == nil {
|
||||
//LP found
|
||||
c.HTML(200, "admin_lp.html", gin.H{
|
||||
"title": "Admin Let's Plays",
|
||||
"LP": LP,
|
||||
"page": "admin_lp",
|
||||
})
|
||||
} else {
|
||||
//LP not found
|
||||
c.AbortWithStatus(404)
|
||||
|
@ -105,6 +112,13 @@ func GetAdminLetsTest(c *gin.Context) {
|
|||
"LT": LT,
|
||||
"page": "admin_lt",
|
||||
})
|
||||
} else if database.Db.Where("slug=?", id).First(<).Error == nil {
|
||||
//LT found
|
||||
c.HTML(200, "admin_lt.html", gin.H{
|
||||
"title": "Admin Let's Tests",
|
||||
"LT": LT,
|
||||
"page": "admin_lt",
|
||||
})
|
||||
} else {
|
||||
//LT not found
|
||||
c.AbortWithStatus(404)
|
||||
|
@ -176,6 +190,13 @@ func GetAdminEpisode(c *gin.Context) {
|
|||
"EP": EP,
|
||||
"page": "admin_ep",
|
||||
})
|
||||
} else if database.Db.Where("slug=?", id).First(&EP).Error == nil {
|
||||
//EP found
|
||||
c.HTML(200, "admin_ep.html", gin.H{
|
||||
"title": "Admin Episoden",
|
||||
"EP": EP,
|
||||
"page": "admin_ep",
|
||||
})
|
||||
} else {
|
||||
//EP not found
|
||||
c.AbortWithStatus(404)
|
||||
|
@ -250,6 +271,13 @@ func GetAdminAuthor(c *gin.Context) {
|
|||
"AT": AT,
|
||||
"page": "admin_at",
|
||||
})
|
||||
} else if database.Db.Where("slug=?", id).First(&AT).Error == nil {
|
||||
//AT found
|
||||
c.HTML(200, "admin_at.html", gin.H{
|
||||
"title": "Admin Sprecher",
|
||||
"AT": AT,
|
||||
"page": "admin_at",
|
||||
})
|
||||
} else {
|
||||
//AT not found
|
||||
c.AbortWithStatus(404)
|
||||
|
|
Loading…
Reference in a new issue