Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: show total vote count in the footer. #104

Merged
merged 2 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion js/src/forum/components/PollView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export default class PollView extends Component<PollAttrs, PollState> {
);
}

if (poll.canVote()) {
if (poll.canVote() && !poll.hasEnded() && !this.state.hasVoted()) {
items.add(
'max-votes',
<span>
Expand All @@ -191,6 +191,16 @@ export default class PollView extends Component<PollAttrs, PollState> {
}
}

if (poll.hasEnded() || this.state.hasVoted()) {
items.add(
'total-vote-count',
<span>
<i className="icon fas fa-poll fa-fw" aria-hidden="true" />
{app.translator.trans('fof-polls.forum.poll.total_votes', { count: poll.voteCount() })}
</span>
);
}

return items;
}

Expand Down
1 change: 1 addition & 0 deletions resources/locale/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ fof-polls:
submit_button: Vote
start_poll_button: Start Global Poll
cannot_start_poll_button: Cannot Start Poll
total_votes: "{count, plural, one {# vote was given} other {# votes were given}}"

poll_controls:
edit_label: => core.ref.edit
Expand Down
Loading