vedia/views/votes_edit.erb
2025-12-03 19:02:45 +01:00

65 lines
1.9 KiB
Text

<h1><%= @vote.title %></h1>
<p><span class="badge bg-primary">Draft</span></p>
<%= markdown(@vote.description) %>
<form action="/votes/<%= @vote.secure_id %>/edit" method="get">
<button type="submit"><%= _("Edit") %></button>
</form>
<h2><%= _("Candidates") %></h2>
<% @vote.candidates.each do |candidate| %>
<h3><%= candidate.name %></h3>
<%= markdown(candidate.description) %>
<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>
<textarea type="text" name="description"></textarea>
</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>