Refactor: Centralize template context using unified TemplateData struct

- Introduced models.TemplateData for shared user/context state
- Moved context construction logic into handlers/template_context.go
- Simplified helpers.TemplateContext to accept structured data
- Restored and organized template helper functions
- Updated affected handlers (main.go, draw_handler.go, notifications.go)
- Improved scalability and separation of concerns in template rendering
This commit is contained in:
2025-04-01 21:08:00 +01:00
parent 6dbac8ab14
commit 03b1e095ce
6 changed files with 108 additions and 85 deletions

10
models/template.go Normal file
View File

@@ -0,0 +1,10 @@
package models
type TemplateData struct {
User *User
IsAdmin bool
NotificationCount int
Notifications []Notification
MessageCount int
Messages []Message
}