mirror of
https://github.com/airlabspl/uptimemonitor.git
synced 2025-08-14 12:19:19 +02:00
add sponors to other pages
This commit is contained in:
@@ -1,13 +1,20 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"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"))
|
||||
@@ -23,36 +30,9 @@ func (*Handler) ListSponsors() http.HandlerFunc {
|
||||
}
|
||||
|
||||
d := data{
|
||||
Sponsors: []uptimemonitor.Sponsor{
|
||||
{
|
||||
Name: "AIR Labs",
|
||||
Url: "https://airlabs.pl",
|
||||
Image: "/static/img/airlabs.svg",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
req, err := http.NewRequest(http.MethodGet, "https://sponsors.uptimemonitor.dev", nil)
|
||||
if err != nil {
|
||||
sponsor.Execute(w, d)
|
||||
return
|
||||
}
|
||||
|
||||
res, err := http.DefaultClient.Do(req)
|
||||
if err != nil {
|
||||
sponsor.Execute(w, d)
|
||||
return
|
||||
}
|
||||
|
||||
var sponsors []uptimemonitor.Sponsor
|
||||
err = json.NewDecoder(res.Body).Decode(&sponsors)
|
||||
if err != nil {
|
||||
sponsor.Execute(w, d)
|
||||
return
|
||||
}
|
||||
|
||||
sponsor.Execute(w, data{
|
||||
Sponsors: sponsors,
|
||||
})
|
||||
}
|
||||
|
||||
sponsor.Execute(w, d)
|
||||
}
|
||||
}
|
||||
|
@@ -124,25 +124,25 @@
|
||||
<ul class="list bg-base-100 rounded-box border border-base-200 p-2 text-left">
|
||||
<form class="block list-row justify-stretch px-0 py-0" hx-delete="/incidents/{{ .Incident.ID }}"
|
||||
hx-confirm="Are you sure?" hx-swap="none">
|
||||
<button type="submit">
|
||||
<div class="list-col-grow">
|
||||
<button class="btn btn-ghost w-full text-left align-start justify-start text-error">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
||||
stroke-width="1.5" stroke="currentColor" class="size-5!">
|
||||
<path stroke-linecap="round" stroke-linejoin="round"
|
||||
d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" />
|
||||
</svg>
|
||||
<div class="list-col-grow">
|
||||
<button class="btn btn-ghost w-full text-left align-start justify-start text-error"
|
||||
type="submit">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
|
||||
stroke="currentColor" class="size-5!">
|
||||
<path stroke-linecap="round" stroke-linejoin="round"
|
||||
d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" />
|
||||
</svg>
|
||||
|
||||
Remove incident
|
||||
</button>
|
||||
</div>
|
||||
</button>
|
||||
Remove incident
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</ul>
|
||||
|
||||
<div>
|
||||
{{ template "sponsors" . }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
@@ -136,6 +136,10 @@
|
||||
</a>
|
||||
</div>
|
||||
</ul>
|
||||
|
||||
<div>
|
||||
{{ template "sponsors" . }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user