Implement left/right voting on entries
GET /entry/{pid}/interactions/{mode} now reads the vote tally and, for
mode=left/right (auth required), toggles the user's vote: new vote, repeat
same mode removes it, different mode switches. Returns {left, right,
selected}. A UNIQUE(uid, pid) constraint on the vote table prevents
duplicate votes. The JS frontend renders Links/Rechts buttons with live
counts under each entry.
This completes the voting feature that was left commented-out and broken
in the Flask version.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -73,3 +73,23 @@ button:hover { opacity: 0.9; }
|
||||
|
||||
.msg { color: #ff6b6b; font-size: 0.9rem; min-height: 1.2em; }
|
||||
.end { text-align: center; color: var(--muted); padding: 2rem 0; }
|
||||
|
||||
.interactions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
margin-top: 0.8rem;
|
||||
}
|
||||
.interactions .vote {
|
||||
background: transparent;
|
||||
border: 1px solid #2a2e35;
|
||||
color: var(--fg);
|
||||
padding: 0.3rem 0.7rem;
|
||||
}
|
||||
.interactions .vote:hover { border-color: var(--accent); }
|
||||
.interactions .vote.selected {
|
||||
background: var(--accent);
|
||||
border-color: var(--accent);
|
||||
color: #fff;
|
||||
}
|
||||
.interactions .counts { color: var(--muted); font-size: 0.9rem; }
|
||||
|
||||
Reference in New Issue
Block a user