Refactor project structure and update configurations. Now first working version

- Updated `.air.conf` for Nix compatibility and simplified build commands.
- Enhanced `.gitignore` to include `tmp` directory.
- Improved `README.md` with clearer instructions and added language details.
- Refined CSS styles for better UI consistency and added alert styles.
- Upgraded `flake.nix` to use Go 1.24 and improved shell environment setup.
- Modified authentication logic in `auth.go` for better user handling.
- Updated `main.go` to dynamically set the listening port and improved logging.
- Added new `routes.go` file for handling game entry and history.
- Enhanced user models and added statistics tracking in `models.go`.
- Improved template rendering and added user feedback messages in HTML templates.
- Removed obsolete build error logs and binaries.
This commit is contained in:
Jonas Hahn
2025-08-24 12:08:14 +02:00
parent c9a3196ccb
commit 4b4377a24e
19 changed files with 376 additions and 278 deletions

View File

@@ -30,14 +30,20 @@ func NewTemplateManager(dir string, base string, ext string) *TemplateManager {
tm := &TemplateManager{
templates: make(map[string]*template.Template),
funcs: template.FuncMap{
// Attach functions to the templates here
"fmtTime": func(t time.Time) string {
return t.Local().Format("2006-01-02 15:04") // Gos reference time
},
"cmpTwo": func(a, b int) bool {
return a == b
},
},
base: base,
dir: dir,
ext: ext,
}
// Populate template manager
tm.LoadTemplates()
return tm
@@ -58,7 +64,7 @@ func (tm *TemplateManager) LoadTemplates() {
}
name := stripAfterDot(filepath.Base(file))
logger.Println(name)
lg.Println(name)
// Parse base + view template together
tpl, err := template.New(name).