Compare commits

..
Author SHA1 Message Date
Typosaurus ecaed0adaa ticket #94 attempt 1 2026-07-19 19:59:58 +00:00
3 changed files with 15 additions and 13 deletions
+9 -6
View File
@@ -5,18 +5,21 @@ import { OptimisticAction } from "./OptimisticAction.js";
export class VoteManager extends OptimisticAction {
constructor() {
super();
this.initVoteButtons();
document.addEventListener("click", (event) => this.onClick(event));
}
initVoteButtons() {
document.querySelectorAll('form[action^="/votes/"] button[type="submit"]').forEach((button) => {
onClick(event) {
const button = event.target.closest('form[action^="/votes/"] button[type="submit"]');
if (!button) {
return;
}
const form = button.closest("form");
button.addEventListener("click", (event) => {
if (!form) {
return;
}
event.preventDefault();
event.stopPropagation();
this.cast(form, button);
});
});
}
cast(form, button) {
+1 -1
View File
@@ -29,7 +29,7 @@ def is_self(user, uid) -> bool:
def guest_disabled(user) -> Markup:
if user:
return Markup("")
return Markup(' disabled aria-disabled="true"')
return Markup(' disabled aria-disabled="true" title="Log in to vote"')
def static_url(path) -> str:
+1 -2
View File
@@ -4,8 +4,7 @@ version = "1.0.0"
description = "DevPlace - The Developer Social Network"
requires-python = ">=3.12"
dependencies = [
"fastapi>=0.110.0",
"starlette>=0.37.0",
"fastapi",
"uvicorn[standard]",
"jinja2",
"python-multipart",