<% (0..cols).each do |col| %>
<% exp = 2**(col+1) %>
<% element_class = "empty" %>
<% bracketer = bracket.get_bracketer(row, col) %>
<% if (row % exp) == exp/2 %>
<% if bracketer %>
<% element_class = "team" %>
<% else %>
<% element_class = "empty" %>
<% end %>
<% elsif ( (((row+exp/2) - (row+exp/2) % exp) / exp) % 2 == 1 ) and col < cols-1 %>
<% if ( (((row+exp/2) - (row+exp/2) % exp) / exp) % 2 == 1 ) and col < cols-1 %>
<% element_class = "connector" %>
<% end %>
<% end %>
<% if element_class == "team" %>
<% if defined? edit %>
<%= select_tag "cell[#{row}][#{col}]", options_for_select(bracket.options, :selected => bracket.default(row, col)) %>
<% elsif bracketer %>
<% if bracketer.match %>
<%= link_to bracketer, bracketer.match %>
<% elsif bracketer.contester %>
<%= flag bracketer.contester.team.country %> |
<%= link_to bracketer.contester, bracketer.contester %> |
<% end %>
<% end %>
<% end %>
|
<% end %>
<% end %>