From 5e39a7ab72db9320ce1e38403ebb87d6a48c41f9 Mon Sep 17 00:00:00 2001 From: javiexin Date: Fri, 19 Jun 2015 11:33:37 +0200 Subject: [PATCH] [ticket/13748] Wrong tooltip after poll vote change Store the "voted" tooltip in an extra attribute in HTML, and use it with the JS that refreshes after poll vote. PHPBB3-13748 --- phpBB/styles/prosilver/template/ajax.js | 7 +++++++ phpBB/styles/prosilver/template/viewtopic_body.html | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js index 168efff4b4..72b8aaa750 100644 --- a/phpBB/styles/prosilver/template/ajax.js +++ b/phpBB/styles/prosilver/template/ajax.js @@ -242,7 +242,14 @@ phpbb.addAjaxCallback('vote_poll', function(res) { var mostVoted = (res.vote_counts[optionId] === mostVotes); var percent = (!res.total_votes) ? 0 : Math.round((res.vote_counts[optionId] / res.total_votes) * 100); var percentRel = (mostVotes === 0) ? 0 : Math.round((res.vote_counts[optionId] / mostVotes) * 100); + var altText; + altText = $this.attr('data-alt-text'); + if (voted) { + $this.attr('title', $.trim(altText)); + } else { + $this.attr('title', ''); + }; $this.toggleClass('voted', voted); $this.toggleClass('most-votes', mostVoted); diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index 5b8078877e..5289d6a604 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -80,7 +80,7 @@
-
title="{L_POLL_VOTED_OPTION}" data-poll-option-id="{poll_option.POLL_OPTION_ID}"> +
title="{L_POLL_VOTED_OPTION}" data-alt-text="{LA_POLL_VOTED_OPTION}" data-poll-option-id="{poll_option.POLL_OPTION_ID}">
{poll_option.POLL_OPTION_CAPTION}
checked="checked" /> checked="checked" />
{poll_option.POLL_OPTION_RESULT}