layout refact

This commit is contained in:
2026-01-29 20:47:18 +01:00
parent 44700d51cb
commit 27131b3029
10 changed files with 150 additions and 55 deletions
+20 -2
View File
@@ -24,24 +24,42 @@ func (c *SoftwareController) Index(w http.ResponseWriter, r *http.Request) {
return
}
data := map[string]interface{}{
"Softwares": softwares,
}
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
}
tmpl.Execute(w, softwares)
tmpl.Execute(w, data)
}
func (c *SoftwareController) Show(w http.ResponseWriter, r *http.Request) {
name := chi.URLParam(r, "name")
data, err := c.softwareService.GetForShowByName(name)
showData, err := c.softwareService.GetForShowByName(name)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
softwares, err := c.softwareService.List()
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
data := map[string]interface{}{
"Software": showData.Software,
"Releases": showData.Releases,
"LatestRelease": showData.LatestRelease,
"WebPlayableRelease": showData.WebPlayableRelease,
"Softwares": softwares,
}
tmpl, err := template_utils.GetTemplate("software_show", "http/views/shared/layout.html", "http/views/software/show.html")
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)