Update interactive
This commit is contained in:
27
app/handlers/interactive.go
Normal file
27
app/handlers/interactive.go
Normal file
@ -0,0 +1,27 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"templ-tests/app/data"
|
||||
"templ-tests/app/templates"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
var pcInteractive templates.PageContext = templates.PageContext{
|
||||
Title: "Welcome to the demo",
|
||||
ActivePage: "interactive",
|
||||
}
|
||||
|
||||
func Interactive(c *gin.Context) {
|
||||
templates.Interactive(pcInteractive, data.CatBreeds).Render(c, c.Writer)
|
||||
}
|
||||
|
||||
func InteractiveSwapContent(c *gin.Context) {
|
||||
contentIndexStr := c.Query("content")
|
||||
contentIndex, err := strconv.Atoi(contentIndexStr)
|
||||
if err != nil {
|
||||
contentIndex = 0
|
||||
}
|
||||
templates.InteractiveSwapContent(pcInteractive, contentIndex).Render(c, c.Writer)
|
||||
}
|
||||
Reference in New Issue
Block a user