an updated and hopefully faster version of the ST Toolbox
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

31 lines
881 B

package web
import (
"log"
root "marmic/servicetrade-toolbox"
"net/http"
)
func DashboardHandler(w http.ResponseWriter, r *http.Request) {
tmpl := root.WebTemplates
data := map[string]interface{}{
"Title": "Dashboard",
}
if r.Header.Get("HX-Request") == "true" {
// For HTMX requests, execute the dashboard template directly
if err := tmpl.ExecuteTemplate(w, "dashboard.html", data); err != nil {
log.Printf("Template execution error: %v", err)
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
return
}
} else {
// For full page requests, we'll use the layout template
// which will include the content template
if err := tmpl.ExecuteTemplate(w, "layout.html", data); err != nil {
log.Printf("Template execution error: %v", err)
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
return
}
}
}