vedia/views/home.erb

31 lines
745 B
Text

<h1>Home</h1>
<p>Hello, <%= current_user.email %>.</p>
<h2>Votes</h2>
<ul>
<% @votes.reverse.each do |vote| %>
<li>
<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>
<% end %>
</ul>
<form action="/votes/new" method="get">
<button type="submit">Create new vote</button>
</form>