diff options
author | Vikas Kushwaha <dev@vikas.rocks> | 2025-02-11 16:31:08 +0530 |
---|---|---|
committer | Vikas Kushwaha <dev@vikas.rocks> | 2025-02-11 16:31:08 +0530 |
commit | 57eb8f6712361a3bf75983ce153fac4846dc0273 (patch) | |
tree | 269a168d59c917c4e313c819e2b4c3ff8175f912 /cmd/web/templates/users/partials/article-favorite-button.tmpl |
Initial commit
Diffstat (limited to 'cmd/web/templates/users/partials/article-favorite-button.tmpl')
-rw-r--r-- | cmd/web/templates/users/partials/article-favorite-button.tmpl | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/cmd/web/templates/users/partials/article-favorite-button.tmpl b/cmd/web/templates/users/partials/article-favorite-button.tmpl new file mode 100644 index 0000000..c63182a --- /dev/null +++ b/cmd/web/templates/users/partials/article-favorite-button.tmpl @@ -0,0 +1,12 @@ +<button class="btn btn-outline-primary btn-sm pull-xs-right {{ if .Article.IsFavorited }} active {{ end }}" + hx-post="/htmx/users/articles/{{ .Article.Slug }}/favorite" + + {{ if .IsSelf }} + hx-swap="delete" + hx-target="closest .post-preview" + {{ else }} + hx-swap="outerHTML" + {{ end }} +> + <i class="ion-heart"></i> {{ .Article.GetFavoriteCount }} +</button>
\ No newline at end of file |