vedia/views/admin_votes.erb
2025-06-08 20:47:09 -06:00

63 lines
1.5 KiB
Text

<h1><%= _("Admin") %></h1>
<h2><%= @vote.title %></h2>
<p><a href="/votes/<%= @vote.secure_id %>"><%= _("View vote") %></a></p>
<p><%= _("Created: %{date}") % { date: format_date(@vote.created_at) } %></p>
<p><%= _("Updated: %{date}") % { date: format_date(@vote.updated_at) } %></p>
<p><%= _("Secure ID: %{secure_id}") % { secure_id: @vote.secure_id } %></p>
<p><%= _("Description: %{description}") % { description: @vote.description } %></p>
<p><%= _("Closing date: %{date}") % { date: @vote.expire_on ? format_date_and_time(@vote.expire_on) : _("None") } %></p>
<p><%= _("State: %{state}") % { state: @vote.state } %></p>
<h2><%= _("Organizers") %></h2>
<% unless @vote.organizers.blank? %>
<ul>
<% @vote.organizers.each do |organizer| %>
<li>
<%= organizer.user.email %>
<a href="/admin/votes/<%= @vote.id %>/organizers/<%= organizer.user.id %>/delete"><%= _("Delete") %></a>
</li>
<% end %>
</ul>
<% else %>
<p><%= _("No organizer.") %></p>
<% end %>
<h2><%= _("Ratings") %></h2>
<% unless @vote.ratings.blank? %>
<ul>
<% @vote.ratings.collect { |rating| rating.user }.uniq.each do |user| %>
<li>
<%= user.email %>
<a href="/admin/votes/<%= @vote.id %>/ratings/<%= user.id %>/delete"><%= _("Delete") %></a>
</li>
<% end %>
</ul>
<% else %>
<p><%= _("No rating.") %></p>
<% end %>
<% if @vote.ratings.blank? and @vote.organizers.blank? %>
<form action="/admin/votes/<%= @vote.id %>/delete" method="post">
<button type="submit"><%= _("Delete vote") %></button>
</form>
<% end %>