mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/10383] Update the results without the overlay popup.
PHPBB3-10383
This commit is contained in:
parent
7f31277269
commit
98a1694c7c
4 changed files with 38 additions and 6 deletions
|
@ -166,8 +166,12 @@ phpbb.addAjaxCallback('vote_poll', function(res) {
|
||||||
var panel = poll.find('.panel');
|
var panel = poll.find('.panel');
|
||||||
var results_visible = poll.find('dl:first-child .resultbar').is(':visible');
|
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
|
// Set min-height to prevent the page from jumping when the content changes
|
||||||
panel.height(panel.find('.inner').outerHeight());
|
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
|
// Remove the View results link
|
||||||
if (!results_visible) {
|
if (!results_visible) {
|
||||||
|
@ -213,10 +217,33 @@ phpbb.addAjaxCallback('vote_poll', function(res) {
|
||||||
poll.find('.polls').delay(400).fadeIn(500);
|
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
|
// Remove the gap resulting from removing options
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
panel.animate({height: panel.find('.inner').height()}, 500);
|
resize_panel(500);
|
||||||
}, 1500);
|
}, 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': ''});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
|
|
||||||
<!-- IF S_HAS_POLL -->
|
<!-- IF S_HAS_POLL -->
|
||||||
<form method="post" action="{S_POLL_ACTION}" data-ajax="vote_poll" class="topic_poll">
|
<form method="post" action="{S_POLL_ACTION}" data-ajax="vote_poll" data-overlay="false" class="topic_poll">
|
||||||
|
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
|
@ -98,6 +98,7 @@
|
||||||
</dl>
|
</dl>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
<div class="vote-submitted hidden">{L_VOTE_SUBMITTED}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -662,6 +662,12 @@ fieldset.polls dd div {
|
||||||
border-right: 1px solid transparent;
|
border-right: 1px solid transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.vote-submitted {
|
||||||
|
font-size: 1.2em;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
/* Poster profile block
|
/* Poster profile block
|
||||||
----------------------------------------*/
|
----------------------------------------*/
|
||||||
.postprofile {
|
.postprofile {
|
||||||
|
|
|
@ -835,8 +835,6 @@ if (!empty($topic_data['poll_start']))
|
||||||
$valid_user_votes = array_intersect(array_keys($vote_counts), $voted_id);
|
$valid_user_votes = array_intersect(array_keys($vote_counts), $voted_id);
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
|
|
||||||
'MESSAGE_TEXT' => $message,
|
|
||||||
'NO_VOTES' => $user->lang['NO_VOTES'],
|
'NO_VOTES' => $user->lang['NO_VOTES'],
|
||||||
'success' => true,
|
'success' => true,
|
||||||
'user_votes' => array_flip($valid_user_votes),
|
'user_votes' => array_flip($valid_user_votes),
|
||||||
|
|
Loading…
Add table
Reference in a new issue