2024-02-11 19:28:00 +00:00
|
|
|
package handlers
|
2024-02-10 11:59:58 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"text/template"
|
|
|
|
|
2024-02-11 19:28:00 +00:00
|
|
|
"code.tjo.space/mentos1386/zdravko/web/templates"
|
2024-02-12 10:22:14 +00:00
|
|
|
"code.tjo.space/mentos1386/zdravko/web/templates/components"
|
2024-02-10 11:59:58 +00:00
|
|
|
)
|
|
|
|
|
2024-02-11 19:28:00 +00:00
|
|
|
func (h *BaseHandler) Index(w http.ResponseWriter, r *http.Request) {
|
|
|
|
ts, err := template.ParseFS(templates.Templates,
|
2024-02-11 10:56:21 +00:00
|
|
|
"components/base.tmpl",
|
|
|
|
"pages/index.tmpl",
|
2024-02-10 11:59:58 +00:00
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-02-12 10:22:14 +00:00
|
|
|
err = ts.ExecuteTemplate(w, "base", &components.Base{
|
|
|
|
Page: GetPageByTitle("Status"),
|
|
|
|
Pages: Pages,
|
|
|
|
})
|
2024-02-10 11:59:58 +00:00
|
|
|
if err != nil {
|
|
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
|
|
}
|
|
|
|
}
|