Some improvements with the akteure page

This commit is contained in:
Simon Martens
2025-09-21 11:06:28 +02:00
parent 0f6ffbf63f
commit 3f2811acbc
18 changed files with 1404 additions and 463 deletions

View File

@@ -17,6 +17,21 @@ func GetAgents(kgpz *xmlmodels.Library) fiber.Handler {
return func(c *fiber.Ctx) error {
a := c.Params("letterorid", DEFAULT_AGENT)
a = strings.ToLower(a)
// Handle special "autoren" route
if a == "autoren" {
agents := viewmodels.AuthorsView(kgpz)
if len(agents.Agents) == 0 {
logging.Error(nil, "No authors found")
return c.SendStatus(fiber.StatusNotFound)
}
return c.Render(
"/autoren/",
fiber.Map{"model": agents},
)
}
// Handle normal letter/id lookup
agents := viewmodels.AgentsView(a, kgpz)
if len(agents.Agents) == 0 {
logging.Error(nil, "No agents found for letter or id: "+a)