root/polls/view_poll.tt
[%- meta.title = poll.question -%]
<div class="pollbooth">
<form id="poll" action="[% c.uri_for('vote') %]" method="post">
<h4>
[% poll.question %]
</h4>
<p>
<input type="hidden" name="poll" value="[% poll.id%]">
[%- FOREACH answer IN poll.poll_answers %]
<input type="radio" name="answer" value="[% answer.id%]"> [% answer.answer | html %]<br>
[%- END %]
</p>
<p>
<input type="submit" value="Vote">
</p>
</form>
</div>
<h3>
Results
</h3>
[%- FOREACH answer IN poll.poll_answers %]
<p>
[% answer.answer | html -%]
<span style="display:block;background:#000088;width:[% 800 * ( answer.votes / ( poll.votes + 1 ) ) %]px;"> </span> ([% answer.votes %] vote[% 's' UNLESS answer.votes == 1 %])<br>
</p>
[%- END %]