forked from retoor/devplacepy
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
880e993ed8 |
File diff suppressed because one or more lines are too long
@@ -172,6 +172,7 @@
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
touch-action: manipulation;
|
||||||
}
|
}
|
||||||
|
|
||||||
.poll-option[disabled] {
|
.poll-option[disabled] {
|
||||||
@@ -182,6 +183,10 @@
|
|||||||
border-color: var(--border-light);
|
border-color: var(--border-light);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.poll-option:not([disabled]):active {
|
||||||
|
background-color: var(--bg-card-hover);
|
||||||
|
}
|
||||||
|
|
||||||
.poll-option.chosen {
|
.poll-option.chosen {
|
||||||
border-color: var(--accent);
|
border-color: var(--accent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import { OptimisticAction } from "./OptimisticAction.js";
|
|||||||
export class PollManager extends OptimisticAction {
|
export class PollManager extends OptimisticAction {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
document.addEventListener("click", (event) => this.onClick(event));
|
this.container = null;
|
||||||
|
document.addEventListener("pointerdown", (event) => this.onClick(event));
|
||||||
document.addEventListener("submit", (event) => this.onSubmit(event), true);
|
document.addEventListener("submit", (event) => this.onSubmit(event), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +43,8 @@ export class PollManager extends OptimisticAction {
|
|||||||
}
|
}
|
||||||
const pollUid = poll.dataset.pollUid;
|
const pollUid = poll.dataset.pollUid;
|
||||||
const optionUid = option.dataset.optionUid;
|
const optionUid = option.dataset.optionUid;
|
||||||
await this.submit(`/polls/${pollUid}/vote`, { option_uid: optionUid }, null, (result) => this.render(poll, result));
|
this.container = poll;
|
||||||
|
await this.submit(`/polls/${pollUid}/vote`, { option_uid: optionUid }, this.container, (result) => this.render(poll, result));
|
||||||
}
|
}
|
||||||
|
|
||||||
render(poll, result) {
|
render(poll, result) {
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -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