<%= form_for @contest, html: { class: 'square' } do |f| %>
<%= render 'shared/errors', messages: @contest.errors.full_messages %>
<%= hidden_field_tag :type, 'contest' %>
<%= f.label :name %>
<%= f.text_field :name %>
<%= f.label :short_name %>
<%= f.text_field :short_name %>
<%= f.label :start %>
<%= f.datetime_select :start, datetime_separator: '', time_separator: '' %>
<%= f.label :end %>
<%= f.datetime_select :end, datetime_separator: '', time_separator: '' %>
<%= 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, time_separator: '' %>
<%= 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 Contest' %>
<% end %>
<% if @contest.contest_type == Contest::TYPE_BRACKET %>
Bracket |
Slots |
|
<% @contest.brackets.each do |bracket| %>
<%= namelink bracket %> |
<%= bracket.slots %> |
<%= link_to icon('pencil'), edit_bracket_path(bracket) %>
<%= link_to icon('times'), bracket, confirm: 'Are you sure?', method: :delete %>
|
<% end %>
<%= form_for @contest.brackets.build, html: { class: 'square' } do |f| %>
<%= render 'shared/errors', messages: @contest.brackets.last.errors.full_messages %>
<%= hidden_field_tag :type, 'contest' %>
<%= f.hidden_field :contest_id %>
<%= f.label :slots %>
<%= f.text_field :slots %>
<%= f.submit 'Add Bracket' %>
<% end %>
<% end %>
Name |
Download |
|
<% @contest.maps.basic.each do |map| %>
<%= namelink map %> |
<%= h map.download %> |
<%= link_to icon('pencil'), edit_map_path(map) %>
<%= link_to icon('times'), action: "del_map", id: @contest.id, id2: map.id %>
|
<% end %>
<%= form_for @contest do |f| %>
<%= render 'shared/errors', messages: @contest.errors.full_messages %>
<%= hidden_field_tag :type, 'map' %>
<%= select_tag :map, options_from_collection_for_select(Map.basic, :id, :name) %>
<%= f.submit 'Add map' %>
<% end %>
Team |
Score |
Status |
|
<% @contest.contesters.each do |contester| %>
<%= link_to (h contester.team), contester %> |
<%= h contester.score %> |
<%= contester.statuses[contester.active] %> |
<% if contester.active %>
<%= link_to icon('pencil'), edit_contester_path(contester) %>
<%= link_to icon('times'), contester, confirm: 'Are you sure?', method: :delete %>
<% else %>
<%= form_for contester do |c| %>
<%= c.hidden_field :active, { value: 1 } %>
<%= link_to icon('pencil'), edit_contester_path(contester) %>
<%= link_to_function icon('rotate-left'), "$('#edit_contester_#{contester.id}').submit()" %>
<% end %>
<% end %>
|
<% end %>
<%= form_for @contest.contesters.build do |f| %>
<%= render 'shared/errors', messages: @contest.contesters.last.errors.full_messages %>
<%= hidden_field_tag :type, 'team' %>
<%= f.hidden_field :contest_id %>
<%= f.select :team_id, Team.active.ordered.collect{|t| [t, t.id]} %>
<%= f.submit 'Add Team' %>
<% end %>
Name |
Start date |
Map1 |
Map2 |
|
<% @contest.weeks.each do |week| %>
<%= h week.name %> |
<%= week.start_date.strftime("%d %B %y") %> |
<%= h week.map1 %> |
<%= h week.map2 %> |
<%= link_to icon('pencil'), edit_week_path(week) %>
<%= link_to icon('times'), week, confirm: 'Are you sure?', method: :delete %>
|
<% end %>
<%= link_to "New Week", { controller: :weeks, action: :new, id: @contest }, { class: 'button' } %>
Teams |
Date |
Score |
|
<% @contest.matches.each do |match| %>
<%= 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 icon('flag-checkered'), controller: :matches, action: :ref, id: match %>
<%= link_to icon('pencil'), edit_match_path(match) %>
<%= link_to icon('times'), match, confirm: 'Are you sure?', method: :delete %>
|
<% end %>
<%= link_to "New Match", { controller: :matches, action: :new, id: @contest }, { class: 'button' } %>