From: Alexander Ebert Date: Thu, 20 Aug 2020 22:50:53 +0000 (+0200) Subject: Update the number of votes in a poll after voting X-Git-Tag: 5.3.0_Alpha_1~40 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=15b322c05f4ee84ee421d55b430fb22a35778b6b;p=GitHub%2FWoltLab%2FWCF.git Update the number of votes in a poll after voting --- diff --git a/com.woltlab.wcf/templates/poll.tpl b/com.woltlab.wcf/templates/poll.tpl index f95bcb514f..a897291f21 100644 --- a/com.woltlab.wcf/templates/poll.tpl +++ b/com.woltlab.wcf/templates/poll.tpl @@ -9,7 +9,7 @@
-

{$poll->question} {#$poll->votes}

+

{$poll->question} {#$poll->votes}

{if !$__wcf->getUser()->userID} diff --git a/wcfsetup/install/files/js/WCF.Poll.js b/wcfsetup/install/files/js/WCF.Poll.js index e8d8cd1fcc..68d0207d1d 100644 --- a/wcfsetup/install/files/js/WCF.Poll.js +++ b/wcfsetup/install/files/js/WCF.Poll.js @@ -603,6 +603,10 @@ WCF.Poll.Manager = Class.extend({ this._canViewParticipants[$pollID] = true; } + var totalVotes = elBySel('.jsPollTotalVotes', this._polls[$pollID][0]); + totalVotes.textContent = WCF.String.formatNumeric(data.totalVotes); + elData(totalVotes, 'tooltip', data.totalVotesTooltip); + this._showResult(null, $pollID); break; } diff --git a/wcfsetup/install/files/lib/action/PollAction.class.php b/wcfsetup/install/files/lib/action/PollAction.class.php index 3c05b13b05..ac588e1646 100644 --- a/wcfsetup/install/files/lib/action/PollAction.class.php +++ b/wcfsetup/install/files/lib/action/PollAction.class.php @@ -201,5 +201,7 @@ class PollAction extends AJAXProxyAction { } $returnValues['canVote'] = $this->poll->isChangeable ? 1 : 0; + $returnValues['totalVotes'] = $this->poll->votes; + $returnValues['totalVotesTooltip'] = WCF::getLanguage()->getDynamicVariable('wcf.poll.totalVotes', ['poll' => $this->poll]); } }