<%= namelink contester.team %>

Team members
<% contester.lineup.each do |teamer| %>

<% 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) %> <%= teamer.user %>

<% @n = @n + 1; end %>
<% if contester.team.logo %> <%= image_tag contester.team.logo.url%> <% end %>
Mercenaries
<% @match.matchers.mercs.of_contester(contester).each do |matcher| %>

<%= 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 %> <%= matcher.user %>

<% @n = @n + 1; end %>

<%= 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" %> <%= link_to_function 'Merc', "findUser('match[matchers_attributes][#{@n}][merc][user_id]')" %>: <%= text_field_tag "match[matchers_attributes][#{@n}][user_id]", '', :size => 5 %>