From d7a0fffe1aab9de4b18db88c409fcd5dc486ab5c Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 1 May 2014 16:19:34 -0400 Subject: clean up forms --- app/views/tournaments/_form.html.erb | 43 ++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 17 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 fe2a5c6..93badeb 100644 --- a/app/views/tournaments/_form.html.erb +++ b/app/views/tournaments/_form.html.erb @@ -1,12 +1,20 @@ <%= render "common/error_messages", :target => @tournament %>
- Game Type + Basic information <%= form_for(@tournament, url: new_tournament_path, method: "get") do |f| %> -

+

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

+
+
+ + +
+ <% if @tournament.game %> + <%= f.submit("Update (Will reset the rest of the form)", class: "btn-danger") %> + <% else %> + <%= f.submit("Submit") %> + <% end %> <% end %>
@@ -16,10 +24,10 @@ Attributes <%= f.hidden_field(:game_id) %> -

+

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

+
@@ -41,17 +49,17 @@
-

+

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

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

+

<%= setting_fields.label setting.name, setting.name.to_s.titleize %>
<% case setting.vartype %> @@ -77,7 +85,7 @@ <% when 5 %> <%= setting_fields.select( setting.name, setting.type_opt.split(',').collect {|opt| opt.humanize.titleize} ) %> <% end %> -

+
<% end %> <% end %>
@@ -85,17 +93,18 @@ <%= 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, :scheduling_method.to_s.titleize %> - <%= stage_fields.select(:scheduling_method, @tournament.scheduling_methods.map{|method| [method.humanize.titleize, method]}) %> - <%= stage_fields.label :seeding_method, :seeding_method.to_s.titleize %> - <%= stage_fields.select(:seeding_method, @tournament.seeding_methods.map{|method| [method.humanize.titleize, method]}) %> +
+ <%= stage_fields.label :scheduling_method, :scheduling_method.to_s.titleize %> + <%= stage_fields.select(:scheduling_method, @tournament.scheduling_methods.map{|method| [method.humanize.titleize, method]}) %> +
+
+ <%= stage_fields.label :seeding_method, :seeding_method.to_s.titleize %> + <%= stage_fields.select(:seeding_method, @tournament.seeding_methods.map{|method| [method.humanize.titleize, method]}) %> +
<% end %> <% end %> -- cgit v1.2.3