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.
 
 
 
 

24 lines
723 B

package handlers
import (
"html/template"
"net/http"
)
func JobsHandler(w http.ResponseWriter, r *http.Request) {
if r.Header.Get("HX-Request") == "true" {
// This is an HTMX request, return only the jobs partial
tmpl := template.Must(template.ParseFiles("templates/partials/jobs.html"))
jobs := []string{"Job 1", "Job 2", "Job 3"} // Replace with actual data fetching
tmpl.Execute(w, jobs)
} else {
// This is a full page request
tmpl := template.Must(template.ParseFiles("templates/layout.html", "templates/partials/jobs.html"))
jobs := []string{"Job 1", "Job 2", "Job 3"} // Replace with actual data fetching
tmpl.Execute(w, map[string]interface{}{
"Title": "Jobs",
"Jobs": jobs,
})
}
}