ensl.org/app/views/polls/_show.html.erb

25 lines
654 B
Text

<h3>
<%= h @poll.question %>
</h3>
<div id="pollOptions">
<% @poll.options.all.each do |opt| %>
<p>
<% if cuser and !@poll.voted?(cuser) %>
<%= link_to (h opt), :controller => "votes", :action => "create", :vote => {:votable_id => opt.id, :votable_type => "Option"} %>
<% else %>
<%= h opt.option %> <br />
<% end %>
<% if opt.votes > 0 %>
<%= image_tag "/images/icons/poll.png", :class => "bar", :height => 6, :width => opt.votes*100/@poll.votes %>
<% end %>
<span>
<%= opt.votes %>
</span>
</p>
<% end %>
</div>
<p>
<%= link_to "Archive..", polls_path %>
</p>