mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-29 00:55:32 +00:00
Saner file names
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/Theodor-Springmann-Stiftung/kgpz_web/app"
|
||||
"github.com/Theodor-Springmann-Stiftung/kgpz_web/templating"
|
||||
)
|
||||
|
||||
// ControllerFunc is a function that get injected all dependencies and returns a http.HandlerFunc
|
||||
// A controller is resposible for executing all the neccessary middlewares and rendering the HTML
|
||||
type ControllerFunc func(kgpz *app.KGPZ, layouts *templating.LayoutRegistry, templates *templating.TemplateRegistry) http.HandlerFunc
|
||||
@@ -13,17 +13,18 @@ func GetYear(kgpz *app.KGPZ) 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.Error(err, "Year is not a valid number")
|
||||
logging.Debug("Jahr nicht gefunden: " + y)
|
||||
return c.SendStatus(fiber.StatusNotFound)
|
||||
}
|
||||
|
||||
issues, err := viewmodels.YearView(y, kgpz.Library)
|
||||
view, err := viewmodels.YearView(y, kgpz.Library)
|
||||
if err != nil {
|
||||
logging.Error(err, "Keine Ausgaben für das Jahr "+y)
|
||||
logging.ErrorDebug(err, "Keine Ausgaben für das Jahr "+y)
|
||||
return c.SendStatus(fiber.StatusNotFound)
|
||||
}
|
||||
|
||||
return c.Render("/", fiber.Map{"model": issues, "title": "Ausgaben " + y})
|
||||
return c.Render("/", fiber.Map{"model": view})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user