vedia/views/votes_edit.erb
2025-06-08 16:07:20 -06:00

69 lines
2.1 KiB
Text

<h1><%= _("Edit draft vote") %></h1>
<form action="/votes/<%= @vote.secure_id %>/edit" method="post">
<p>
<label for="title"><%= _("Title") %></label>
<input type="text" name="title" value="<%= @vote.title %>">
</p>
<p>
<label for="description"><%= _("Description") %></label>
<input type="text" name="description" value="<%= @vote.description %>">
</p>
<button type="submit"><%= _("Save") %></button>
</form>
<h2><%= _("Candidates") %></h2>
<% @vote.candidates.each do |candidate| %>
<h3><%= candidate.name %></h3>
<p><%= candidate.description %></p>
<form action="/votes/<%= @vote.secure_id %>/candidates/<%= candidate.id %>/delete" method="post">
<button type="submit"><%= _("Delete") %></button>
</form>
<% end %>
<h3><%= _("Add candidate") %></h3>
<form action="/votes/<%= @vote.secure_id %>/candidates" method="post">
<p>
<label for="name"><%= _("Name") %></label>
<input type="text" name="name">
</p>
<p>
<label for="description"><%= _("Description") %></label>
<input type="text" name="description">
</p>
<button type="submit"><%= _("Add candidate") %></button>
</form>
<h2><%= _("Organizers") %></h2>
<ul>
<% @vote.organizers.each do |organizer| %>
<li><%= organizer.user.email %></li>
<% end %>
</ul>
<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 organizer") %></button>
</form>
<h3><%= _("Actions for organizers") %></h2>
<form action="/votes/<%= @vote.secure_id %>/open" method="get">
<% if @vote.candidates.length < 2 %>
<button type="submit" disabled><%= _("Open vote to participants") %></button>
<p><%= _("Add at least 2 candidates before opening the vote to participants.") %></p>
<% else %>
<button type="submit"><%= _("Open vote to participants") %></button>
<% end %>
</form>
<form action="/votes/<%= @vote.secure_id %>/delete" method="post">
<button type="submit"><%= _("Delete vote") %></button>
</form>