64 lines
1.8 KiB
Text
64 lines
1.8 KiB
Text
<h1><%= @vote.title %></h1>
|
|
|
|
<p><%= @vote.description %></p>
|
|
|
|
<h2><%= _("Your ratings") %></h2>
|
|
|
|
<form action="/votes/<%= @vote.secure_id %>/ratings" method="post">
|
|
<ul>
|
|
<% @vote.candidates.each do |candidate| %>
|
|
<% rating = @vote.ratings.find { |rating| rating.user == current_user and rating.candidate == candidate } %>
|
|
<% value = rating ? rating.value : 0 %>
|
|
<li>
|
|
<p><%= candidate.name %></p>
|
|
<p><%= candidate.description %></p>
|
|
<ul>
|
|
<% settings.values.reverse.each do |v| %>
|
|
<li><input type="radio" name="<%= candidate.id %>" id="<%= candidate.id %>-<%= v[:id] %>" value="<%= v[:id] %>" <% if value == v[:id] %>checked<% end %>><label for="<%= candidate.id %>-<%= v[:id] %>" class="value-<%= v[:id] %>"><%= v[:label] %></label></li>
|
|
<% end %>
|
|
</ul>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|
|
<button type="submit"><%= _("Save") %></button>
|
|
</form>
|
|
|
|
<h2><%= _("Participants") %></h2>
|
|
|
|
<ul>
|
|
<% @vote.ratings.collect { |rating| rating.user }.uniq.each do |user| %>
|
|
<li><%= user.email %></li>
|
|
<% end %>
|
|
</ul>
|
|
|
|
<h2><%= _("Organizers") %></h2>
|
|
|
|
<ul>
|
|
<% @vote.organizers.each do |organizer| %>
|
|
<li><%= organizer.user.email %></li>
|
|
<% end %>
|
|
</ul>
|
|
|
|
<% if @vote.users.exists?(current_user.id) %>
|
|
|
|
<h3><%= _("Actions for organizers") %></h3>
|
|
|
|
<form action="/votes/<%= @vote.secure_id %>/draft" method="post">
|
|
<button type="submit"><%= _("Change back to draft vote") %></button>
|
|
</form>
|
|
|
|
<form action="/votes/<%= @vote.secure_id %>/close" method="post">
|
|
<button type="submit"><%= _("Close votes and show results") %></button>
|
|
</form>
|
|
|
|
<h3><%= _("Add organizer") %></h3>
|
|
|
|
<form action="/votes/<%= @vote.secure_id %>/organizers" method="post">
|
|
<p>
|
|
<label for="email"><%= _("Email") %></label>
|
|
<input type="text" name="email">
|
|
</p>
|
|
<button type="submit"><%= _("Add") %></button>
|
|
</form>
|
|
|
|
<% end %>
|