Display state of votes on Home

This commit is contained in:
ricola 2025-04-06 17:04:31 -06:00
parent ac32ce243a
commit 75e9630b8f

View file

@ -5,9 +5,23 @@
<h2>Votes</h2> <h2>Votes</h2>
<ul> <ul>
<% @votes.each do |vote| %> <% @votes.reverse.each do |vote| %>
<li> <li>
<a href="/votes/<%= vote.secure_id %>"><%= vote.title %></a> <a href="/votes/<%= vote.secure_id %>"><%= vote.title %></a>
<% case vote.state
when "draft" %>
<% if vote.users.exists?(current_user.id) %>(Draft, organized by you)
<% else %>(Draft)
<% end %>
<% when "open" %>
<% if vote.users.exists?(current_user.id) %>(Open, organized by you)
<% else %>(Open)
<% end %>
<% when "closed" %>
<% if vote.users.exists?(current_user.id) %>(Closed, organized by you)
<% else %>(Closed)
<% end %>
<% end %>
</li> </li>
<% end %> <% end %>
</ul> </ul>