From d4d97f40deff86134944b340433619dff76ac896 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 27 Apr 2014 21:54:42 -0400 Subject: tournaments form: fix changing game type --- app/views/tournaments/_form.html.erb | 185 ++++++++++++++++++----------------- 1 file changed, 93 insertions(+), 92 deletions(-) (limited to 'app/views/tournaments/_form.html.erb') diff --git a/app/views/tournaments/_form.html.erb b/app/views/tournaments/_form.html.erb index e322601..b457ce4 100644 --- a/app/views/tournaments/_form.html.erb +++ b/app/views/tournaments/_form.html.erb @@ -1,113 +1,114 @@ -<%= form_for(@tournament, - url: (@tournament.game.nil? ? new_tournament_path : tournaments_path), - method: (@tournament.game.nil? ? "get" : "post")) do |f| %> +<%= render "common/error_messages", :target => @tournament %> +
Attributes +<%= form_for(@tournament, url: new_tournament_path, method: "get") do |f| %> <%= render "common/error_messages", :target => @tournament %> - -
Attributes

<%= f.label :game_id, "Select a game type" %> <%= f.select(:game_id, Game.all.map{|game| [game.name, game.id]}) %> <%= f.submit("Select") %>

+<% end %> - <% if @tournament.game.nil? %> -
- <% else %> +<% if @tournament.game.nil? %> +
+<% else %> + <%= form_for(@tournament, url: tournaments_path, method: "post") do |f| %> -

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

-

- - - - - - - - - - -
MinimumMaximum
Players per team: <%= f.text_field(:min_players_per_team, type: :number, min: 1) %><%= f.text_field(:max_players_per_team, type: :number, min: 1) %>
+ <%= f.label :name %> + <%= f.text_field :name %>

-
+
+

+ + + + + + + + + + +
MinimumMaximum
Players per team: <%= f.text_field(:min_players_per_team, type: :number, min: 1) %><%= f.text_field(:max_players_per_team, type: :number, min: 1) %>
+

+
-
-

- - - - - - -
Teams per match: <%= f.text_field(:min_teams_per_match, type: :number, min: 1) %><%= f.text_field(:max_teams_per_match, type: :number, min: 1) %>
-

-
+
+

+ + + + + + +
Teams per match: <%= f.text_field(:min_teams_per_match, type: :number, min: 1) %><%= f.text_field(:max_teams_per_match, type: :number, min: 1) %>
+

+
-

- <%= f.label :scoring_method %> - <%= f.select(:scoring_method, @tournament.scoring_methods.map{|method| [method.humanize, method]}) %> -

+

+ <%= f.label :scoring_method %> + <%= f.select(:scoring_method, @tournament.scoring_methods.map{|method| [method.humanize, method]}) %> +

-

- <%= f.label :sampling_method %> - <%= f.select(:sampling_method, @tournament.sampling_methods.map{|method| [method.humanize, method]}) %> -

+

+ <%= f.label :sampling_method %> + <%= f.select(:sampling_method, @tournament.sampling_methods.map{|method| [method.humanize, method]}) %> +

- + -
Settings - <%= f.fields_for :settings do |setting_fields| %> - <% @tournament.tournament_settings.each do |setting| %>

- <%= setting_fields.label setting.name %> -
- <% case setting.vartype %> - <% when 0 %> - <%= setting_fields.text_field( setting.name ) %> - <% when 1 %> - <%= setting_fields.text_area( setting.name ) %> - <% when 2 %> -

- <% when 3 %> - - <% when 4 %> - <%= setting_fields.radio_button( setting.name, "true" ) %> True - <%= setting_fields.radio_button( setting.name, "false" ) %> False - <% when 5 %> - <%= setting_fields.select( setting.name, setting.type_opt.split(',') ) %> - <% end %> -

<% end %> - <% end %> -
- - <%= f.fields_for :stages do |stages_fields| %>
Stages - - - <%# stage_fields.submit("Set Stages") %> - <% for i in 1..(params[:num_stages].to_i) do %> -

- <%= stages_fields.fields_for i.to_s do |stage_fields| %>

Stage <%= i %> - <%= stage_fields.label :scheduling_method %> - <%= stage_fields.select(:scheduling_method, @tournament.scheduling_methods.map{|method| [method.humanize, method]}) %> - <%= stage_fields.label :seeding_method %> - <%= stage_fields.select(:seeding_method, @tournament.seeding_methods.map{|method| [method.humanize, method]}) %> -
<% end %> -

+

<% end %> <% end %> -
<% end %> + - <%= f.submit %> + <%= f.fields_for :stages do |stages_fields| %>
Stages + + + <%# stage_fields.submit("Set Stages") %> + <% for i in 1..(params[:num_stages].to_i) do %> +

+ <%= stages_fields.fields_for i.to_s do |stage_fields| %>

Stage <%= i %> + <%= stage_fields.label :scheduling_method %> + <%= stage_fields.select(:scheduling_method, @tournament.scheduling_methods.map{|method| [method.humanize, method]}) %> + <%= stage_fields.label :seeding_method %> + <%= stage_fields.select(:seeding_method, @tournament.seeding_methods.map{|method| [method.humanize, method]}) %> +
<% end %> +

+ <% end %> +
<% end %> + + <%= f.submit %> - <%# render 'stages' %> + <%# render 'stages' %> + <% end %> <% end %> <% end %> -- cgit v1.2.3