aboutsummaryrefslogtreecommitdiff
path: root/pkg/tpl/rate.templ
blob: bd63df80052d607c7704404a0dc1bdb049efa4ea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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>
}