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

20 lines
609 B
Text
Raw Normal View History

<h5><%= @poll.question %></h5>
<div>
<% @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 %>
<%= 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>