ensl.org/app/views/contests/index.html.erb

73 lines
2.2 KiB
Text
Raw Normal View History

<h1 class="title">Listing Contests</h1>
<% if cuser and cuser.admin? %>
<%= link_to 'New Contest', new_contest_path, class: 'button' %>
<% end %>
<div id="contests">
<div class="current">
<h3 class="title">Current Contests</h3>
<table class="current striped">
<tr>
<th class="name">Name</th>
<th class="date">Start</th>
<th class="status">Status</th>
<% if cuser and cuser.admin? %>
<th class="actions"></th>
<% end %>
</tr>
<% @contests_active.each do |contest| %>
<tr>
<td><%= link_to (h contest.name), contest %></td>
<td><%= longdate contest.start %></td>
<td><%= contest.statuses[contest.status] %></td>
<% if cuser and cuser.admin? %>
<td class="actions">
<%= link_to icon('pencil'), edit_contest_path(contest) %>
<%= link_to icon('times'), contest, confirm: 'Are you sure?', method: :delete %>
</td>
<% end %>
</tr>
<% end %>
</table>
</div>
<div class="previous">
<h3 class="title">Previous Contests</h3>
<table class="previous striped">
<tr>
<th class="name">Name</th>
<th class="date">Date</th>
<th class="winner">Winner</th>
<% if cuser and cuser.admin? %>
<th class="actions"></th>
<% end %>
</tr>
<% @contests_inactive.reverse_each do |contest| %>
<tr>
<td><%= link_to (h contest.name), contest %></td>
<td><%= longdate contest.start %></td>
<% if contest.winner then %>
<td><%= flag contest.winner.team.country %> <%= link_to (h contest.winner.team.name), contest.winner %></td>
<% else %>
<td></td>
<% end %>
<% if cuser and cuser.admin? %>
<td class="actions">
<%= link_to icon('pencil'), edit_contest_path(contest) %>
<%= link_to icon('times'), contest, confirm: 'Are you sure?', method: :delete %>
</td>
<% end %>
</tr>
<% end %>
</table>
</div>
<% if cuser and cuser.admin? %>
<%= link_to 'New Contest', new_contest_path, class: 'button' %>
<% end %>
</div>