28 lines
628 B
Go
28 lines
628 B
Go
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)
|
|
}
|