Update interactive

This commit is contained in:
Eden Kirin
2024-01-21 14:32:32 +01:00
parent 26635bbff1
commit 728d37faba
12 changed files with 1280 additions and 251 deletions

View 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)
}