aboutsummaryrefslogtreecommitdiff
path: root/pkg/tpl/random.templ
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/tpl/random.templ')
-rw-r--r--pkg/tpl/random.templ27
1 files changed, 24 insertions, 3 deletions
diff --git a/pkg/tpl/random.templ b/pkg/tpl/random.templ
index 39ce3ff..2d25a03 100644
--- a/pkg/tpl/random.templ
+++ b/pkg/tpl/random.templ
@@ -1,12 +1,33 @@
package tpl
import (
+ "sh.org.ru/pkg/config"
+ "sh.org.ru/pkg/middleware"
"sh.org.ru/pkg/model"
)
templ Random(quotes []model.Quote) {
- for _, q := range quotes {
- @Quote(&q)
+ {{ 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>
}
- <a role="button" hx-get="/random" hx-swap="outerHTML">Загрузить ещё...</a>
}