37 lines
601 B
Go
37 lines
601 B
Go
package controllers
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"git.readonly.ch/bouzoure/pop-camarades/helpers"
|
|
"github.com/gofiber/fiber/v2"
|
|
)
|
|
|
|
func SetColorMode(c *fiber.Ctx) error {
|
|
colorMode := "light"
|
|
if c.FormValue("color_mode") == "dark" {
|
|
colorMode = "dark"
|
|
}
|
|
|
|
sess, err := helpers.GetSessionStore(c)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
sess.Set("color-mode", colorMode)
|
|
err = sess.Save()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return c.SendString(fmt.Sprintf(
|
|
"New color mode: %s",
|
|
colorMode,
|
|
))
|
|
}
|
|
|
|
func Licences(c *fiber.Ctx) error {
|
|
return c.Render("licences", fiber.Map{
|
|
"PageTitle": "Licences",
|
|
})
|
|
}
|