101 lines
3.2 KiB
Text
101 lines
3.2 KiB
Text
<h1 class="mb-5"><%= _("Admin") %></h1>
|
|
|
|
<h2 class="mb-4"><%= @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>
|
|
|
|
<% if @vote.state == 'closed' or @vote.state == 'open' %>
|
|
<form action="/admin/votes/<%= @vote.id %>" method="post">
|
|
<p>
|
|
<%= _("Closing date: ") %>
|
|
<% year = Time.now.strftime('%Y').to_i %>
|
|
<select name='year'>
|
|
<% (-1..1).each do |i| %>
|
|
<option value="<%= year + i %>"<% if TZInfo::Timezone.get(session[:timezone]).to_local(@vote.expire_on).strftime('%Y').to_i == year + i %> selected="selected"<% end %>><%= year + i %></option>
|
|
<% end %>
|
|
</select>
|
|
-
|
|
<select name='month'>
|
|
<% (1..11).each do |m| %>
|
|
<option value="<%= m %>"<% if TZInfo::Timezone.get(session[:timezone]).to_local(@vote.expire_on).strftime('%m').to_i == m %> selected="selected"<% end %>><%= m %></option>
|
|
<% end %>
|
|
</select>
|
|
-
|
|
<select name='day'>
|
|
<% (1..31).each do |d| %>
|
|
<option value="<%= d %>"<% if TZInfo::Timezone.get(session[:timezone]).to_local(@vote.expire_on).strftime('%d').to_i == d %> selected="selected"<% end %>><%= d %></option>
|
|
<% end %>
|
|
</select>
|
|
|
|
<select name='hour'>
|
|
<% (0..23).each do |h| %>
|
|
<option value="<%= h %>"<% if TZInfo::Timezone.get(session[:timezone]).to_local(@vote.expire_on).strftime('%H').to_i == h %> selected="selected"<% end %>><%= h %></option>
|
|
<% end %>
|
|
</select>
|
|
:
|
|
<select name='minute'>
|
|
<% (0..59).each do |m| %>
|
|
<option value="<%= m %>"<% if TZInfo::Timezone.get(session[:timezone]).to_local(@vote.expire_on).strftime('%M').to_i == m %> selected="selected"<% end %>><%= m %></option>
|
|
<% end %>
|
|
</select>
|
|
(<%= format_timezone %>)
|
|
<button type="submit" class="btn btn-link"><%= _("Change") %></button>
|
|
</p>
|
|
</form>
|
|
<% end %>
|
|
|
|
<p class="mb-5"><%= _("State: %{state}") % { state: @vote.state } %></p>
|
|
|
|
<h2 class="mb-4"><%= _("Organizers") %></h2>
|
|
|
|
<% unless @vote.organizers.blank? %>
|
|
|
|
<ul class="mb-5">
|
|
<% @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 class="mb-4"><%= _("Ratings") %></h2>
|
|
|
|
<% unless @vote.ratings.blank? %>
|
|
|
|
<ul>
|
|
<% @vote.ratings.collect { |rating| rating.user }.uniq.sort_by { |user| user.email }.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 %>
|