ShOrgRu/pkg/tpl/random.templ

33 lines
711 B
Text

package tpl
import (
"sh.org.ru/pkg/config"
"sh.org.ru/pkg/middleware"
"sh.org.ru/pkg/model"
)
templ Random(quotes []model.Quote) {
{{ host := ctx.Value(middleware.ContextKey("config")).(*config.Config).Host }}
@Layout(HeaderParams{
Title: "Цитатник Рунета",
Description: "Новый цитатник Рунета",
URL: host,
}) {
<div id="random">
for _, q := range quotes {
@Quote(&q)
}
<a
role="button"
hx-get="/random"
hx-swap="outerHTML"
hx-select="#random"
hx-indicator="#loader"
>
Загрузить ещё...
</a>
</div>
<span aria-busy="true" id="loader" class="htmx-indicator">Загрузка...</span>
}
}