ensl.org/app/views/contesters/_ladder.html.erb

60 lines
2 KiB
Text

<table class="contest striped">
<thead>
<tr>
<th class="rank">Rank</th>
<th class="movement"></th>
<th class="flag"></th>
<th class="team">Team</th>
<th class="awards"></th>
<th class="win">Win</th>
<th class="loss">Loss</th>
<th class="draw">Draw</th>
<% if actions and cuser %>
<th class="actions"></th>
<% end %>
</tr>
</thead>
<tbody>
<% contesters = contest.contesters.active.ranked
contesters.each_with_index do |contester, rank| %>
<tr>
<td><%= h rank + 1%>.</td>
<% if contester.trend == Contester::TREND_UP %>
<td><%= icon 'chevron-up' %></td>
<% elsif contester.trend == Contester::TREND_DOWN %>
<td><%= icon 'chevron-down' %></td>
<% elsif contester.trend == Contester::TREND_FLAT %>
<td><%= icon 'minus' %></td>
<% else %>
<td></td>
<% end %>
<td><%= flag contester.team.country %></td>
<td><%= link_to (h contester.team.name), contester %></td>
<td><%= icon 'trophy' if contester == contester.contest.winner %></td>
<td><%= h contester.win %></td>
<td><%= h contester.loss %></td>
<td><%= h contester.draw %></td>
<% if actions and cuser%>
<td class="actions">
<% if false %>
<% current = cuser.active_contesters.of_contest(contest).first %>
<% if current %>
<% challenge = Challenge.new
challenge.contester1 = current
challenge.contester2 = contester %>
<% if challenge.can_create? cuser %>
<%= link_to 'C', controller: 'challenges', id: contester, action: 'new' %>
<% end %>
<% end %>
<% end %>
<% if cuser and cuser.admin? %>
<%= link_to icon('pencil'), edit_contester_path(contester) %>
<%= link_to icon('times'), contester, confirm: 'Are you sure?', method: :delete %>
<% end %>
</td>
<% end %>
</tr>
<% end %>
</tbody>
</table>