From 98a1694c7c1022d50c30b7dcd46f9f0fc9f5f7b4 Mon Sep 17 00:00:00 2001 From: Cesar G Date: Mon, 7 Oct 2013 17:55:04 -0700 Subject: [PATCH] [ticket/10383] Update the results without the overlay popup. PHPBB3-10383 --- phpBB/styles/prosilver/template/ajax.js | 33 +++++++++++++++++-- .../prosilver/template/viewtopic_body.html | 3 +- phpBB/styles/prosilver/theme/content.css | 6 ++++ phpBB/viewtopic.php | 2 -- 4 files changed, 38 insertions(+), 6 deletions(-) diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js index 39beab4f16..28656d47d3 100644 --- a/phpBB/styles/prosilver/template/ajax.js +++ b/phpBB/styles/prosilver/template/ajax.js @@ -166,8 +166,12 @@ phpbb.addAjaxCallback('vote_poll', function(res) { var panel = poll.find('.panel'); var results_visible = poll.find('dl:first-child .resultbar').is(':visible'); - // Force the current height to prevent the page from jumping when the content changes - panel.height(panel.find('.inner').outerHeight()); + // Set min-height to prevent the page from jumping when the content changes + var update_panel_height = function (height) { + var height = (typeof height === 'undefined') ? panel.find('.inner').outerHeight() : height; + panel.css('min-height', height); + }; + update_panel_height(); // Remove the View results link if (!results_visible) { @@ -213,10 +217,33 @@ phpbb.addAjaxCallback('vote_poll', function(res) { poll.find('.polls').delay(400).fadeIn(500); } + // Display "Your vote has been cast." message. Disappears after 5 seconds. + var confirmation_delay = (res.can_vote) ? 300 : 900; + poll.find('.vote-submitted').delay(confirmation_delay).slideDown(200, function() { + if (results_visible) { + update_panel_height(); + } + + $(this).delay(5000).fadeOut(500, function() { + resize_panel(300); + }); + }); + // Remove the gap resulting from removing options setTimeout(function() { - panel.animate({height: panel.find('.inner').height()}, 500); + resize_panel(500); }, 1500); + + var resize_panel = function (time) { + var panel_height = panel.height(); + var inner_height = panel.find('.inner').outerHeight(); + + if (panel_height != inner_height) { + panel.css({'min-height': '', 'height': panel_height}).animate({height: inner_height}, time, function () { + panel.css({'min-height': inner_height, 'height': ''}); + }); + } + }; } }); diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index 61077fd0c4..e678ea8f8c 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -60,7 +60,7 @@
-
+
@@ -98,6 +98,7 @@ +
diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index c56c7f9ef8..60475aea7d 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -662,6 +662,12 @@ fieldset.polls dd div { border-right: 1px solid transparent; } +.vote-submitted { + font-size: 1.2em; + font-weight: bold; + text-align: center; +} + /* Poster profile block ----------------------------------------*/ .postprofile { diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 43bf3a27c6..3a7e633c99 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -835,8 +835,6 @@ if (!empty($topic_data['poll_start'])) $valid_user_votes = array_intersect(array_keys($vote_counts), $voted_id); $data = array( - 'MESSAGE_TITLE' => $user->lang['INFORMATION'], - 'MESSAGE_TEXT' => $message, 'NO_VOTES' => $user->lang['NO_VOTES'], 'success' => true, 'user_votes' => array_flip($valid_user_votes),