mirror of
https://github.com/Theodor-Springmann-Stiftung/lenz-web.git
synced 2025-10-29 09:15:33 +00:00
Basic Briefansicht + parsing
This commit is contained in:
@@ -1,27 +1,12 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/Theodor-Springmann-Stiftung/lenz-web/xmlmodels"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
const DEFAULT_YEAR = 1765
|
||||
|
||||
func GetIndex(c *fiber.Ctx) error {
|
||||
return c.Redirect(JAHRGAENGE_URL + "/" + strconv.Itoa(DEFAULT_YEAR))
|
||||
}
|
||||
|
||||
func GetIndexYear(c *fiber.Ctx) error {
|
||||
lib := xmlmodels.Get()
|
||||
years, yearmap := lib.Years()
|
||||
|
||||
y := c.Params(YEAR_PARAM)
|
||||
year, err := strconv.Atoi(y)
|
||||
if _, ok := yearmap[year]; (err != nil || !ok) && y != "all" {
|
||||
return c.SendStatus(fiber.StatusNotFound)
|
||||
}
|
||||
|
||||
return c.Render(JAHRGAENGE_URL+"/", map[string]any{"years": years, "yearmap": yearmap, "year": year, "all": y == "all"})
|
||||
return c.Redirect(LETTERS_URL + "?year=" + strconv.Itoa(DEFAULT_YEAR))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user