From fcd21a7ffa3f1a77861790e014f3074b588939a2 Mon Sep 17 00:00:00 2001 From: Zsolt Tasnadi Date: Sun, 7 Dec 2025 15:15:00 +0100 Subject: [PATCH] restructure html templates --- domain/service.software_updater_tic80.go | 2 -- http/controller.play.go | 2 +- http/controller.software.go | 4 ++-- http/views/{ => play}/play.html | 2 +- http/views/{layouts/main.html => shared/layout.html} | 0 http/views/{ => software}/index.html | 2 +- http/views/{ => software}/releases.html | 0 lib/mysql_utils/db_mock.go | 2 -- 8 files changed, 5 insertions(+), 9 deletions(-) rename http/views/{ => play}/play.html (97%) rename http/views/{layouts/main.html => shared/layout.html} (100%) rename http/views/{ => software}/index.html (99%) rename http/views/{ => software}/releases.html (100%) diff --git a/domain/service.software_updater_tic80.go b/domain/service.software_updater_tic80.go index 0717f7e..02113f7 100644 --- a/domain/service.software_updater_tic80.go +++ b/domain/service.software_updater_tic80.go @@ -31,13 +31,11 @@ func (s *SoftwareUpdaterTIC80Service) Update(name string) error { fmt.Printf("TIC80 Updater: Starting update for name: %s\n", name) contentsPath, _ := os.LookupEnv("GAMES_DIR") - // Case 1: HTML content (name.html.zip) if err := s.handleHTMLContent(name, contentsPath); err == nil { fmt.Printf("TIC80 Updater: Successfully processed HTML content: %s\n", name) return nil } - // Case 2: TIC-80 Lua cartridge (name.lua and name.tic) if err := s.handleLuaCartridge(name, contentsPath); err != nil { return err } diff --git a/http/controller.play.go b/http/controller.play.go index 6ed5eb7..60dd4ae 100644 --- a/http/controller.play.go +++ b/http/controller.play.go @@ -24,7 +24,7 @@ func (c *PlayController) Play(w http.ResponseWriter, r *http.Request) { return } - tmpl, err := template_utils.GetTemplate("play", "http/views/layouts/main.html", "http/views/play.html") + tmpl, err := template_utils.GetTemplate("play_controller_play", "http/views/shared/layout.html", "http/views/play/play.html") if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return diff --git a/http/controller.software.go b/http/controller.software.go index b25949b..6cdf85c 100644 --- a/http/controller.software.go +++ b/http/controller.software.go @@ -24,7 +24,7 @@ func (c *SoftwareController) index(w http.ResponseWriter, r *http.Request) { return } - tmpl, err := template_utils.GetTemplate("index", "http/views/layouts/main.html", "http/views/index.html") + tmpl, err := template_utils.GetTemplate("software_index", "http/views/shared/layout.html", "http/views/software/index.html") if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return @@ -45,7 +45,7 @@ func (c *SoftwareController) releases(w http.ResponseWriter, r *http.Request) { return } - tmpl, err := template_utils.GetTemplate("releases", "http/views/layouts/main.html", "http/views/releases.html") + tmpl, err := template_utils.GetTemplate("software_releases", "http/views/shared/layout.html", "http/views/software/releases.html") if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return diff --git a/http/views/play.html b/http/views/play/play.html similarity index 97% rename from http/views/play.html rename to http/views/play/play.html index af65ca2..a81f1ad 100644 --- a/http/views/play.html +++ b/http/views/play/play.html @@ -7,4 +7,4 @@

Back to Softwares

-{{end}} \ No newline at end of file +{{end}} diff --git a/http/views/layouts/main.html b/http/views/shared/layout.html similarity index 100% rename from http/views/layouts/main.html rename to http/views/shared/layout.html diff --git a/http/views/index.html b/http/views/software/index.html similarity index 99% rename from http/views/index.html rename to http/views/software/index.html index 6515002..71b451e 100644 --- a/http/views/index.html +++ b/http/views/software/index.html @@ -25,4 +25,4 @@ {{end}} -{{end}} \ No newline at end of file +{{end}} diff --git a/http/views/releases.html b/http/views/software/releases.html similarity index 100% rename from http/views/releases.html rename to http/views/software/releases.html diff --git a/lib/mysql_utils/db_mock.go b/lib/mysql_utils/db_mock.go index 16b5ee8..b83b78f 100755 --- a/lib/mysql_utils/db_mock.go +++ b/lib/mysql_utils/db_mock.go @@ -39,8 +39,6 @@ func NewDBMockSuite() *DBMockSuite { panic("GORM open error") } - // gormdb.AutoMigrate() - return &DBMockSuite{ DB: gormdb, Mock: mock,