mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-29 09:05:30 +00:00
Renamed some files, more CSS
This commit is contained in:
30
controllers/jahr_controller.go
Normal file
30
controllers/jahr_controller.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/Theodor-Springmann-Stiftung/kgpz_web/helpers/logging"
|
||||
"github.com/Theodor-Springmann-Stiftung/kgpz_web/viewmodels"
|
||||
"github.com/Theodor-Springmann-Stiftung/kgpz_web/xmlmodels"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func GetYear(kgpz *xmlmodels.Library) fiber.Handler {
|
||||
return func(c *fiber.Ctx) error {
|
||||
y := c.Params("year", strconv.Itoa(MINYEAR))
|
||||
yi, err := strconv.Atoi(y)
|
||||
|
||||
if err != nil || yi < MINYEAR || yi > MAXYEAR {
|
||||
logging.Debug("Jahr nicht gefunden: " + y)
|
||||
return c.SendStatus(fiber.StatusNotFound)
|
||||
}
|
||||
|
||||
view, err := viewmodels.YearView(yi, kgpz)
|
||||
if err != nil {
|
||||
logging.ErrorDebug(err, "Keine Ausgaben für das Jahr "+y)
|
||||
return c.SendStatus(fiber.StatusNotFound)
|
||||
}
|
||||
|
||||
return c.Render("/", fiber.Map{"model": view})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user