%= form_for(@tournament) do |f| %> <%= render "common/error_messages", :target => @tournament %> <%= 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") %> <% next %> <% end %>
<%= f.label name %>
<% unless @tournament.game.attributes[name].nil? %>
<% if name == "sampling_method" %>
<%= f.select( name, @tournament.game.sampling_method.split(',') ) %>
<% else %>
<%= f.text_field(name, :value => @tournament.game.attributes[name] ) %>
<% end %>
<% else %>
<%= f.text_field name %>
<% end %>
<%= 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 %>
<% setting.type_opt.split(',').each do |option|%>
<%= setting_fields.radio_button( setting.name, option ) %> <%= option %>
<% end %>
<% when 3 %>
<% setting.type_opt.split(',').each do |option|%>
<%= check_box_tag(setting.name, value = option, checked = false, options = {}) %> <%= option %>
<% 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 %>