layout refact
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user