1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

Swap page is now working and also moved swaping logic from tournament model to its own class

This commit is contained in:
2016-01-27 14:13:49 +00:00
parent 96c7cd446c
commit a8b96c96e8
10 changed files with 80 additions and 73 deletions

View File

@@ -16,14 +16,15 @@
<%= f.label :name %><br>
<%= f.text_field :name %>
</div>
<% if @tournament %>
<%= f.hidden_field :school_id, :value => @school.id %>
<% else %>
<div class="field">
<%= f.label 'School' %><br>
<%= f.collection_select :school_id, @school.tournament.schools, :id, :name %>
</div>
<% if can? :manage, @wrestler.tournament %>
<% if @tournament %>
<%= f.hidden_field :school_id, :value => @school.id %>
<% else %>
<div class="field">
<%= f.label 'School' %><br>
<%= f.collection_select :school_id, @school.tournament.schools, :id, :name %>
</div>
<% end %>
<% end %>
<div class="field">
<%= f.label 'Weight Class' %><br>
@@ -56,8 +57,8 @@
<% if can? :manage, @wrestler.tournament %>
<br><br>
<h3>Swap Bracket Position</h3>
<%= form_for @wrestler, :url => url_for(:controller => 'wrestlers', :action => 'swap', :method => "post") do |f| %>
<%= form_for(Wrestler.new, url: swap_wrestlers_path(@wrestler.tournament)) do |f| %>
<%= f.hidden_field :originalId, :value => @wrestler.id %>
<div class="field">
<%= f.label 'Swap With' %><br>
<%= f.collection_select :swapId, @wrestler.weight.wrestlers, :id, :name %>