mirror of
https://github.com/airlabspl/uptimemonitor.git
synced 2025-08-14 20:29:16 +02:00
39 lines
711 B
Go
39 lines
711 B
Go
package handler
|
|
|
|
import (
|
|
"html/template"
|
|
"net/http"
|
|
"uptimemonitor"
|
|
"uptimemonitor/html"
|
|
)
|
|
|
|
var sponsors = []uptimemonitor.Sponsor{
|
|
{
|
|
Name: "AIR Labs",
|
|
Url: "https://airlabs.pl",
|
|
Image: "/static/img/airlabs.svg",
|
|
},
|
|
}
|
|
|
|
func (*Handler) ListSponsors() http.HandlerFunc {
|
|
layout := template.Must(template.ParseFS(html.FS, "layout.html"))
|
|
sponsor := template.Must(template.ParseFS(html.FS, "sponsor.html"))
|
|
|
|
type data struct {
|
|
Sponsors []uptimemonitor.Sponsor
|
|
}
|
|
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
if r.Header.Get("HX-Request") != "true" {
|
|
layout.ExecuteTemplate(w, "sponsors", nil)
|
|
return
|
|
}
|
|
|
|
d := data{
|
|
Sponsors: sponsors,
|
|
}
|
|
|
|
sponsor.Execute(w, d)
|
|
}
|
|
}
|