Editing Contest

<%= form_for @contest do |f| %>
    <% @contest.errors.full_messages.each do |msg| %>
  • <%= msg %>
  • <% end %>

<%= f.label :name %>
<%= f.text_field :name %>

<%= f.label :short_name %>
<%= f.text_field :short_name %>

<%= f.label :start %>
<%= f.datetime_select :start %>

<%= f.label :end %>
<%= f.datetime_select :end %>

<%= f.label :status %>
<%= f.select :status, @contest.statuses.invert %>

<%= f.label :demos_id %>
<%= f.select :demos_id, Directory.all.collect{|d| [d, d.id]} %>

<%= f.label :default_time %>
<%= f.time_select :default_time %>

<%= f.label :winner_id %>
<%= f.select :winner_id, @contest.contesters.collect{|t| [t.team, t.id]}, :include_blank => true %>

<%= f.label :rules_id %>
<%= f.select :rules_id, Category.find(Category::RULES).articles.collect{|a| [a, a.id]}, :include_blank => true %>

<% if @contest.contest_type == Contest::TYPE_LADDER %>

<%= f.label :weight %>
<%= f.text_field :weight %>

<%= f.label :modulus_base %>
<%= f.text_field :modulus_base %>

<%= f.label :modulus_even %>
<%= f.text_field :modulus_even %>

<%= f.label :modulus_3to1 %>
<%= f.text_field :modulus_3to1 %>

<%= f.label :modulus_4to0 %>
<%= f.text_field :modulus_4to0 %>

<% end %>

<%= f.submit 'Save' %>

<% end %>
<% if @contest.contest_type == Contest::TYPE_BRACKET %>
<% @contest.brackets.each do |bracket| %> <% end %>
Bracket Slots Options
<%= namelink bracket %> <%= bracket.slots %> <%= link_to 'Edit', edit_bracket_path(bracket) %> <%= link_to 'Destroy', bracket, :confirm => 'Are you sure?', :method => :delete %>
<%= form_for @contest.brackets.build do |f| %>
    <% @contest.brackets.last.errors.full_messages.each do |msg| %>
  • <%= msg %>
  • <% end %>
<%= f.hidden_field :contest_id %>

<%= f.label :slots %> <%= f.text_field :slots %> <%= f.submit 'Add Bracket' %>

<% end %>
<% end %>
<% @contest.maps.basic.each do |map| %> <% end %>
Name Download Options
<%= namelink map %> <%= h map.download %> <%= link_to 'Edit', edit_map_path(map) %> <%= link_to 'Remove', :action => "del_map", :id => @contest.id, :id2 => map.id %>
<%= form_for @contest do |f| %>
    <% @contest.errors.full_messages.each do |msg| %>
  • <%= msg %>
  • <% end %>

<%= select_tag :map, options_from_collection_for_select(Map.basic, :id, :name) %> <%= f.submit 'Add map' %>

<% end %>
<% @contest.contesters.each do |contester| %> <% end %>
Team Score Status Actions
<%= link_to (h contester.team), contester %> <%= h contester.score %> <%= contester.statuses[contester.active] %> <% if contester.active %> <%= link_to 'Edit', edit_contester_path(contester) %> <%= link_to 'Delete', contester, :confirm => 'Are you sure?', :method => :delete %> <% else %> <%= form_for contester do |c| %> <%= c.hidden_field :active, {:value => 1} %> <%= link_to 'Edit', edit_contester_path(contester) %> <%= link_to_function 'Recover', "$('edit_contester_#{contester.id}').submit()" %> <% end %> <% end %>
<%= form_for @contest.contesters.build do |f| %>
    <% @contest.contesters.last.errors.full_messages.each do |msg| %>
  • <%= msg %>
  • <% end %>
<%= f.hidden_field :contest_id %>

<%= f.select :team_id, Team.active.ordered.collect{|t| [t, t.id]} %> <%= f.submit 'Add team' %>

<% end %>
<% @contest.weeks.each do |week| %> <% end %>
Name Start date Map1 Map2 Options
<%= h week.name %> <%= week.start_date.strftime("%d %B %y") %> <%= h week.map1 %> <%= h week.map2 %> <%= link_to 'Edit', edit_week_path(week) %> <%= link_to 'Destroy', week, :confirm => 'Are you sure?', :method => :delete %>
<%= link_to "New Week", :controller => :weeks, :action => :new, :id => @contest %>
<% @contest.matches.each do |match| %> <% end %>
Teams Date Score Options
<%= namelink match.contester1.team %> vs <%= namelink match.contester2.team %> <%= longtime match.match_time %> <% link_to match do %> <%= h match.score1 %> - <%= h match.score2 %> <% end %> <%= link_to 'Referee', :controller => :matches, :action => :ref, :id => match %> <%= link_to 'Edit', edit_match_path(match) %> <%= link_to 'Delete', match, :confirm => 'Are you sure?', :method => :delete %>
<%= link_to "New Match", :controller => :matches, :action => :new, :id => @contest %>
<%= link_to 'Back', @contest %>