aboutsummaryrefslogtreecommitdiff
path: root/pkg/tpl/rate.templ
diff options
context:
space:
mode:
authorAlexander Neonxp Kiryukhin <i@neonxp.ru>2024-10-08 03:43:08 +0300
committerAlexander Neonxp Kiryukhin <i@neonxp.ru>2024-10-08 03:50:53 +0300
commite849e705c30cceec3cf7336a21bed96c8a911e90 (patch)
tree93f559bcd4cf3e53193930d112e564a2b7462ac8 /pkg/tpl/rate.templ
parent3ee654f6fb3cdf119630bfba8066c96ec26428c3 (diff)
Добавил рейтинг
Добавил страницу топа Добавил rss/xml/json feed
Diffstat (limited to 'pkg/tpl/rate.templ')
-rw-r--r--pkg/tpl/rate.templ31
1 files changed, 31 insertions, 0 deletions
diff --git a/pkg/tpl/rate.templ b/pkg/tpl/rate.templ
new file mode 100644
index 0000000..bd63df8
--- /dev/null
+++ b/pkg/tpl/rate.templ
@@ -0,0 +1,31 @@
+package tpl
+
+import (
+ "fmt"
+ "sh.org.ru/pkg/model"
+ "strconv"
+)
+
+templ Rate(quote *model.Quote, act int) {
+ <nav class="rate">
+ <a
+ hx-post={ fmt.Sprintf("/rate/%d", quote.ID) }
+ hx-target="closest .rate"
+ hx-vals='{"vote": "up"}'
+ href="#"
+ >
+ <i class="fa fa-plus"></i>
+ </a>
+ &nbsp;
+ { strconv.Itoa(quote.Rating) }
+ &nbsp;
+ <a
+ hx-post={ fmt.Sprintf("/rate/%d", quote.ID) }
+ hx-target="closest .rate"
+ hx-vals='{"vote": "down"}'
+ href="#"
+ >
+ <i class="fa fa-minus"></i>
+ </a>
+ </nav>
+}