mirror of
https://github.com/Theodor-Springmann-Stiftung/lenz-web.git
synced 2025-10-29 17:25:32 +00:00
Basic Briefansicht + parsing
This commit is contained in:
23
controllers/uebersicht.go
Normal file
23
controllers/uebersicht.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/Theodor-Springmann-Stiftung/lenz-web/xmlmodels"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func GetLetters(c *fiber.Ctx) error {
|
||||
lib := xmlmodels.Get()
|
||||
years, yearmap := lib.Years()
|
||||
y := c.Query(YEAR_PARAM, strconv.Itoa(DEFAULT_YEAR))
|
||||
// TODO: does not work ATM
|
||||
c.Locals("path", c.Path())
|
||||
|
||||
year, err := strconv.Atoi(y)
|
||||
if _, ok := yearmap[year]; (err != nil || !ok) && y != "all" {
|
||||
return c.SendStatus(fiber.StatusNotFound)
|
||||
}
|
||||
|
||||
return c.Render(LETTERS_URL+"/", fiber.Map{"years": years, "yearmap": yearmap, "year": year, "all": y == "all"})
|
||||
}
|
||||
Reference in New Issue
Block a user