2024-10-06 17:04:37 +03:00
|
|
|
package tpl
|
|
|
|
|
2024-10-07 04:18:59 +03:00
|
|
|
import (
|
2024-10-08 03:43:08 +03:00
|
|
|
"sh.org.ru/pkg/config"
|
|
|
|
"sh.org.ru/pkg/middleware"
|
2024-10-07 04:18:59 +03:00
|
|
|
"sh.org.ru/pkg/model"
|
|
|
|
)
|
2024-10-06 17:04:37 +03:00
|
|
|
|
|
|
|
templ Random(quotes []model.Quote) {
|
2024-10-08 03:43:08 +03:00
|
|
|
{{ 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-target="#random"
|
|
|
|
hx-indicator="#loader"
|
|
|
|
>
|
|
|
|
Загрузить ещё...
|
|
|
|
</a>
|
|
|
|
<span aria-busy="true" id="loader" class="htmx-indicator">Загрузка...</span>
|
|
|
|
</div>
|
2024-10-06 17:04:37 +03:00
|
|
|
}
|
|
|
|
}
|