summaryrefslogtreecommitdiff
path: root/app/views/tournaments
diff options
context:
space:
mode:
authorguntasgrewal <guntasgrewal@gmail.com>2014-04-26 23:38:36 -0400
committerguntasgrewal <guntasgrewal@gmail.com>2014-04-26 23:38:36 -0400
commit506486a6a38fc73b49dd35077cfaafbdf891c664 (patch)
treef7eac08b42735c51692abd44c500711253a38aca /app/views/tournaments
parent4638a832b3b9da87bf076f4370e0d99bdf11ee78 (diff)
Some shit I did
Diffstat (limited to 'app/views/tournaments')
-rw-r--r--app/views/tournaments/_selected.html.erb38
-rw-r--r--app/views/tournaments/_stages.html.erb36
-rw-r--r--app/views/tournaments/new.html.erb6
3 files changed, 46 insertions, 34 deletions
diff --git a/app/views/tournaments/_selected.html.erb b/app/views/tournaments/_selected.html.erb
index 9240c49..e89550e 100644
--- a/app/views/tournaments/_selected.html.erb
+++ b/app/views/tournaments/_selected.html.erb
@@ -3,51 +3,21 @@
<%= f.hidden_field(:game_id) %>
<% @tournament.attributes.each do |name, value| %>
- <% if (name == "id") or (name =~ /.*_at$/) or (name == "game_id") or (name == "status") or (name == "set_rounds") %>
+ <% if (name == "randomized_teams") or(name == "max_teams_per_match") or (name == "max_players_per_team") or (name == "id") or (name =~ /.*_at$/) or (name == "game_id") or (name == "status") or (name == "set_rounds") %>
<% next %>
<% end %>
<p>
<%= f.label name %><br>
<% unless @tournament.game.attributes[name].nil? %>
<% if name == "sampling_method" %>
- <%= f.select( name, @tournament.game.sampling_method.split(',') ) %>
+ <%= f.select( name, Tournament.sampling_methods) %>
<% else %>
- <%= f.text_field(name, :value => @tournament.game.attributes[name] ) %>
+ <%= f.text_field(name, :value => @tournament.game.attributes[name] ) %>
<% end %>
<% else %>
- <%= f.text_field name %>
+ <%= f.select( name, Tournament.scoring_methods) %>
<% end %>
</p>
<% end %>
-
- <%= fields_for "tournament[settings]", @tournament.settings do |setting_fields| %>
- <% @tournament.game.settings.each do |setting| %>
- <p>
- <%= setting_fields.label setting.name %>
- <br>
- <% case setting.vartype %>
- <% when 0 %>
- <%= setting_fields.text_field( setting.name ) %>
- <% when 1 %>
- <%= setting_fields.text_area( setting.name ) %>
- <% when 2 %>
- <% setting.type_opt.split(',').each do |option|%>
- <%= setting_fields.radio_button( setting.name, option ) %> <%= option %> <br>
- <% end %>
- <% when 3 %>
- <% setting.type_opt.split(',').each do |option|%>
- <%= check_box_tag(setting.name, value = option, checked = false, options = {}) %> <%= option %> <br>
- <% end %>
- <% when 4 %>
- <%# setting_fields.label "true" %>
- <%= setting_fields.radio_button( setting.name, "true" ) %> True
- <%# setting_fields.label "false" %>
- <%= setting_fields.radio_button( setting.name, "false" ) %> False
- <% when 5 %>
- <%= setting_fields.select( setting.name, setting.type_opt.split(',') ) %>
- <% end %>
- <% end %>
- </p>
- <% end %>
<%= f.submit %>
<% end %>
diff --git a/app/views/tournaments/_stages.html.erb b/app/views/tournaments/_stages.html.erb
new file mode 100644
index 0000000..20c7b3f
--- /dev/null
+++ b/app/views/tournaments/_stages.html.erb
@@ -0,0 +1,36 @@
+ <%= form_for(@tournament) do |f| %>
+ <%= render "common/error_messages", :target => @tournament %>
+ <%= f.hidden_field(:game_id) %>
+ <%= fields_for "tournament[settings]", @tournament.settings do |setting_fields| %>
+
+ <% @tournament.game.settings.each do |setting| %>
+ <p>
+ <%= setting_fields.label setting.name %>
+ <br>
+ <% case setting.vartype %>
+ <% when 0 %>
+ <%= setting_fields.text_field( setting.name ) %>
+ <% when 1 %>
+ <%= setting_fields.text_area( setting.name ) %>
+ <% when 2 %>
+ <% setting.type_opt.split(',').each do |option|%>
+ <%= setting_fields.radio_button( setting.name, option ) %> <%= option %> <br>
+ <% end %>
+ <% when 3 %>
+ <% setting.type_opt.split(',').each do |option|%>
+ <%= check_box_tag(setting.name, value = option, checked = false, options = {}) %> <%= option %> <br>
+ <% end %>
+ <% when 4 %>
+ <%# setting_fields.label "true" %>
+ <%= setting_fields.radio_button( setting.name, "true" ) %> True
+ <%# setting_fields.label "false" %>
+ <%= setting_fields.radio_button( setting.name, "false" ) %> False
+ <% when 5 %>
+ <%= setting_fields.select( setting.name, setting.type_opt.split(',') ) %>
+ <% end %>
+ <% end %>
+ </p>
+ <% end %>
+
+ <%= f.submit %>
+<% end %>
diff --git a/app/views/tournaments/new.html.erb b/app/views/tournaments/new.html.erb
index 2837708..af74ea8 100644
--- a/app/views/tournaments/new.html.erb
+++ b/app/views/tournaments/new.html.erb
@@ -13,4 +13,10 @@
<% end %>
</div>
+<div id='ajax-form'>
+ <% if not @tournament.game.nil? %>
+ <%= render 'stages' %>
+ <% end %>
+</div>
+
<%= link_to 'Back', tournaments_path %>