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

24 lines
702 B
Text
Raw Normal View History

<div class="widget-content-wrapper">
<div class="question">
<h5><%= @poll.question %></h5>
<% @poll.options.all.each do |opt| %>
<p class="option">
<% 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 %>
<%= content_tag :div, "", { class: "bar", style: "width: #{opt.votes*100/@poll.votes}%;" } %>
<% end %>
<span><%= opt.votes %></span>
</p>
<% end %>
</div>
2014-05-03 01:21:29 +00:00
<%= link_to "Archive", polls_path, class: "button" %>
</div>
2014-05-03 01:21:29 +00:00