diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js index d2a070d11b..4df38f4275 100644 --- a/phpBB/styles/prosilver/template/ajax.js +++ b/phpBB/styles/prosilver/template/ajax.js @@ -244,10 +244,12 @@ phpbb.addAjaxCallback('vote_poll', function(res) { var option = $(this); var option_id = option.attr('data-poll-option-id'); var voted = (typeof res.user_votes[option_id] !== 'undefined') ? true : false; + var most_voted = (res.vote_counts[option_id] == most_votes) ? true : false; var percent = (!res.total_votes) ? 0 : Math.round((res.vote_counts[option_id] / res.total_votes) * 100); var percent_rel = (most_votes == 0) ? 0 : Math.round((res.vote_counts[option_id] / most_votes) * 100); option.toggleClass('voted', voted); + option.toggleClass('most-votes', most_voted); // Update the bars var bar = option.find('.resultbar div'); diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index 4e3561c4a2..649129923a 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -72,7 +72,7 @@
-
title="{L_POLL_VOTED_OPTION}" data-poll-option-id="{poll_option.POLL_OPTION_ID}"> +
title="{L_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}
diff --git a/phpBB/styles/subsilver2/template/viewtopic_body.html b/phpBB/styles/subsilver2/template/viewtopic_body.html index a5a50780fe..307ed0f391 100644 --- a/phpBB/styles/subsilver2/template/viewtopic_body.html +++ b/phpBB/styles/subsilver2/template/viewtopic_body.html @@ -80,7 +80,7 @@ - + class="most-votes"> checked="checked" /> diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index ad7e8c29bc..9dc965240f 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -858,6 +858,7 @@ if (!empty($topic_data['poll_start'])) $option_pct_txt = sprintf("%.1d%%", round($option_pct * 100)); $option_pct_rel = ($poll_most > 0) ? $poll_option['poll_option_total'] / $poll_most : 0; $option_pct_rel_txt = sprintf("%.1d%%", round($option_pct_rel * 100)); + $option_most_votes = ($poll_option['poll_option_total'] > 0 && $poll_option['poll_option_total'] == $poll_most) ? true : false; $template->assign_block_vars('poll_option', array( 'POLL_OPTION_ID' => $poll_option['poll_option_id'], @@ -868,6 +869,7 @@ if (!empty($topic_data['poll_start'])) 'POLL_OPTION_PCT' => round($option_pct * 100), 'POLL_OPTION_WIDTH' => round($option_pct * 250), 'POLL_OPTION_VOTED' => (in_array($poll_option['poll_option_id'], $cur_voted_id)) ? true : false, + 'POLL_OPTION_MOST_VOTES' => $option_most_votes, )); }