diff options
Diffstat (limited to 'cmd/web/templates/projects/partials/favorite-button.tmpl')
-rw-r--r-- | cmd/web/templates/projects/partials/favorite-button.tmpl | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cmd/web/templates/projects/partials/favorite-button.tmpl b/cmd/web/templates/projects/partials/favorite-button.tmpl new file mode 100644 index 0000000..f72a320 --- /dev/null +++ b/cmd/web/templates/projects/partials/favorite-button.tmpl @@ -0,0 +1,15 @@ +<button class="btn btn-outline-primary btn-sm {{ if .IsProjectFavorited }} active {{ end }} favorite-button" + hx-post="/htmx/projects/{{ .Project.Slug }}/favorite" + + {{ if .IsOob }} + hx-swap-oob="outerHTML:.favorite-button" + {{ end }} +> + <i class="ion-heart"></i> + {{ if .IsProjectFavorited }} + Unfavorite Post + {{ else }} + Favorite Post + {{ end }} + ({{ .Project.GetFavoriteCount }}) +</button>
\ No newline at end of file |