32 lines
520 B
Text
32 lines
520 B
Text
|
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>
|
||
|
|
||
|
{ strconv.Itoa(quote.Rating) }
|
||
|
|
||
|
<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>
|
||
|
}
|