Preset button states to prevent layout jumps
authorAlexander Ebert <ebert@woltlab.com>
Fri, 3 Jun 2016 22:47:16 +0000 (00:47 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 3 Jun 2016 22:48:21 +0000 (00:48 +0200)
com.woltlab.wcf/templates/poll.tpl

index e6285440f86567404a889595e222d0a8b0bbcda4..4d78b4a151b1d7707c16c46b66063633b1b42cf3 100644 (file)
                <div class="pollInnerContainer">
                        {if !$__wcf->getUser()->userID}
                                {if $poll->canSeeResult()}
+                                       {assign var='__pollView' value='result'}
                                        {include file='pollResult'}
                                {else}
+                                       {assign var='__pollView' value='vote'}
                                        {include file='pollVote'}
                                {/if}
                        {else}
                                {if $poll->canVote() && !$poll->isParticipant()}
+                                       {assign var='__pollView' value='vote'}
                                        {include file='pollVote'}
                                {else}
+                                       {assign var='__pollView' value='result'}
                                        {include file='pollResult'}
                                {/if}
                        {/if}
        </section>
        
        {hascontent}
-               <div class="formSubmit jsOnly">
+               <div class="formSubmit jsOnly"{if !$poll->canVote() && $__pollView === 'result'} style="display: none"{/if}>
                        {content}
                                {if $__wcf->getUser()->userID}
-                                       <button class="small jsButtonPollVote">{lang}wcf.poll.button.vote{/lang}</button>
-                                       <button class="small jsButtonPollShowVote">{lang}wcf.poll.button.showVote{/lang}</button>
-                                       <button class="small jsButtonPollShowResult">{lang}wcf.poll.button.showResult{/lang}</button>
+                                       <button class="small jsButtonPollShowVote"{if $__pollView === 'vote'} style="display: none;"{/if}>{lang}wcf.poll.button.showVote{/lang}</button>
+                                       <button class="small jsButtonPollShowResult"{if $__pollView === 'result'} style="display: none;"{/if}>{lang}wcf.poll.button.showResult{/lang}</button>
                                {/if}
                                {if $poll->canViewParticipants()}
-                                       <button class="small jsButtonPollShowParticipants">{lang}wcf.poll.button.showParticipants{/lang}</button>
+                                       <button class="small jsButtonPollShowParticipants"{if $__pollView === 'vote' || !$poll->canVote()} style="display: none"{/if}>{lang}wcf.poll.button.showParticipants{/lang}</button>
                                {/if}
                                
                                {event name='pollButtons'}