diff options
Diffstat (limited to 'pkg/tpl/rate.templ')
-rw-r--r-- | pkg/tpl/rate.templ | 31 |
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> + + { 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> +} |