feat: replace legacy vote buttons with AJAX submission and dynamic count updates

Replace static form-based vote buttons with a new VoteManager class that submits votes via fetch, returns JSON with net/up/down/current value, and updates vote count spans using data-vote-count attributes across all templates. Add JSONResponse endpoint in votes router for AJAX requests, switch VoteManager import from Http to Toast for error feedback, and refactor link_attachments to handle comma-separated UIDs.
This commit is contained in:
2026-05-27 19:06:18 +00:00
parent 9c55ef272e
commit 74571f7737
14 changed files with 182 additions and 32 deletions
+1 -1
View File
@@ -183,7 +183,7 @@
<input type="hidden" name="value" value="1">
<button type="submit" class="post-action-btn vote-up">+</button>
</form>
<span class="post-vote-count">{{ item.post.get('stars', 0) }}</span>
<span class="post-vote-count" data-vote-count="{{ item.post['uid'] }}">{{ item.post.get('stars', 0) }}</span>
<form method="POST" action="/votes/post/{{ item.post['uid'] }}" class="inline-form">
<input type="hidden" name="value" value="-1">
<button type="submit" class="post-action-btn vote-down">−</button>