forked from retoor/devplacepy
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20757d104d |
File diff suppressed because one or more lines are too long
@@ -5,21 +5,18 @@ import { OptimisticAction } from "./OptimisticAction.js";
|
|||||||
export class VoteManager extends OptimisticAction {
|
export class VoteManager extends OptimisticAction {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
document.addEventListener("click", (event) => this.onClick(event));
|
this.initVoteButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
onClick(event) {
|
initVoteButtons() {
|
||||||
const button = event.target.closest('form[action^="/votes/"] button[type="submit"]');
|
document.querySelectorAll('form[action^="/votes/"] button[type="submit"]').forEach((button) => {
|
||||||
if (!button) {
|
const form = button.closest("form");
|
||||||
return;
|
button.addEventListener("click", (event) => {
|
||||||
}
|
event.preventDefault();
|
||||||
const form = button.closest("form");
|
event.stopPropagation();
|
||||||
if (!form) {
|
this.cast(form, button);
|
||||||
return;
|
});
|
||||||
}
|
});
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
this.cast(form, button);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cast(form, button) {
|
cast(form, button) {
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
<a class="skip-link" href="#main-content">Skip to main content</a>
|
<a class="skip-link" href="#main-content">Skip to main content</a>
|
||||||
<nav class="topnav" aria-label="Primary">
|
<nav class="topnav" aria-label="Primary">
|
||||||
<div class="topnav-inner">
|
<div class="topnav-inner">
|
||||||
<a href="/feed" class="topnav-logo">Dev<span>Place</span></a>
|
<a href="/" class="topnav-logo">Dev<span>Place</span></a>
|
||||||
<div class="topnav-links">
|
<div class="topnav-links">
|
||||||
<a href="/" class="topnav-link {{ nav_active(request, '/') }}"><span class="icon">๐ </span> Home</a>
|
<a href="/" class="topnav-link {{ nav_active(request, '/') }}"><span class="icon">๐ </span> Home</a>
|
||||||
<a href="/feed" class="topnav-link {{ nav_active(request, '/feed') }}"><span class="icon">๐</span> Posts</a>
|
<a href="/feed" class="topnav-link {{ nav_active(request, '/feed') }}"><span class="icon">๐</span> Posts</a>
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ def is_self(user, uid) -> bool:
|
|||||||
def guest_disabled(user) -> Markup:
|
def guest_disabled(user) -> Markup:
|
||||||
if user:
|
if user:
|
||||||
return Markup("")
|
return Markup("")
|
||||||
return Markup(' disabled aria-disabled="true" title="Log in to vote"')
|
return Markup(' disabled aria-disabled="true"')
|
||||||
|
|
||||||
|
|
||||||
def static_url(path) -> str:
|
def static_url(path) -> str:
|
||||||
|
|||||||
Reference in New Issue
Block a user