ensl.org/app/views/matches/_lineup.html.erb
Luke Barratt ac0b47eca9 Improved styling for contests and referee admin pages
Fixes deleting maps form contests
2014-04-25 23:15:15 +01:00

49 lines
2.2 KiB
Text

<div class="players">
<% contester.lineup.each do |teamer| %>
<div class="player fields">
<% if matcher = @match.matchers.first(conditions: { user_id: teamer.user_id }) %>
<%= hidden_field_tag "match[matchers_attributes][#{@n}][id]", matcher.id %>
<% end %>
<%= hidden_field_tag "match[matchers_attributes][#{@n}][user_id]", teamer.user_id %>
<%= hidden_field_tag "match[matchers_attributes][#{@n}][contester_id]", contester.id %>
<%= hidden_field_tag "match[matchers_attributes][#{@n}][match_id]", @match.id %>
<%= hidden_field_tag "match[matchers_attributes][#{@n}][merc]", false %>
<%= check_box_tag "match[matchers_attributes][#{@n}][_destroy]", "keep", @match.users.exists?(teamer.user), { id: "player_#{@n}" } %>
<%= label_tag "player_#{@n}", '', class: 'checkbox' %>
<span><%= teamer.user %></span>
</div>
<% @n = @n + 1 %>
<% end %>
</div>
<div class="mercenaries">
<% @match.matchers.mercs.of_contester(contester).each do |matcher| %>
<div class="player fields">
<%= hidden_field_tag "match[matchers_attributes][#{@n}][id]", matcher.id %>
<%= hidden_field_tag "match[matchers_attributes][#{@n}][user_id]", matcher.user_id %>
<%= hidden_field_tag "match[matchers_attributes][#{@n}][contester_id]", contester.id %>
<%= hidden_field_tag "match[matchers_attributes][#{@n}][match_id]", @match.id %>
<%= hidden_field_tag "match[matchers_attributes][#{@n}][merc]", true %>
<%= check_box_tag "match[matchers_attributes][#{@n}][_destroy]", "keep", true, { id: "player_#{@n}" } %>
<%= label_tag "player_#{@n}", '', class: 'checkbox' %>
<span><%= matcher.user %></span>
</div>
<% @n = @n + 1 %>
<% end %>
<div class="fields">
<%= hidden_field_tag "match[matchers_attributes][#{@n}][contester_id]", contester.id %>
<%= hidden_field_tag "match[matchers_attributes][#{@n}][match_id]", @match.id %>
<%= hidden_field_tag "match[matchers_attributes][#{@n}][merc]", true %>
<%= hidden_field_tag "match[matchers_attributes][#{@n}][_destroy]", "keep" %>
<%= text_field_tag "match[matchers_attributes][#{@n}][user_id]", '', placeholder: 'Mercenary' %>
</div>
</div>