mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-13 16:40:48 +00:00
Update seeds on one page.
This commit is contained in:
@@ -10,8 +10,12 @@ class WeightsController < ApplicationController
|
|||||||
# GET /weights/1
|
# GET /weights/1
|
||||||
# GET /weights/1.json
|
# GET /weights/1.json
|
||||||
def show
|
def show
|
||||||
|
if params[:wrestler]
|
||||||
|
Wrestler.update(params[:wrestler].keys, params[:wrestler].values)
|
||||||
|
end
|
||||||
@wrestlers = Wrestler.all
|
@wrestlers = Wrestler.all
|
||||||
@tournament = Tournament.find(@weight.tournament_id)
|
@tournament = Tournament.find(@weight.tournament_id)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /weights/new
|
# GET /weights/new
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<%= form_tag @wrestlers_update_path do %>
|
||||||
<% @wrestlers.order("original_seed asc").each do |wrestler| %>
|
<% @wrestlers.order("original_seed asc").each do |wrestler| %>
|
||||||
<% if wrestler.weight_id == @weight.id %>
|
<% if wrestler.weight_id == @weight.id %>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -30,7 +31,9 @@
|
|||||||
<td><%= School.find(wrestler.school_id).name %></td>
|
<td><%= School.find(wrestler.school_id).name %></td>
|
||||||
<td>
|
<td>
|
||||||
<% if user_signed_in? %>
|
<% if user_signed_in? %>
|
||||||
<%= wrestler.original_seed %>
|
<%= fields_for "wrestler[]", wrestler do |w| %>
|
||||||
|
<%= w.text_field :original_seed %>
|
||||||
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= wrestler.original_seed %>
|
<%= wrestler.original_seed %>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -50,6 +53,9 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<%= submit_tag "Save"%>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ Wrestling::Application.routes.draw do
|
|||||||
|
|
||||||
resources :wrestlers
|
resources :wrestlers
|
||||||
|
|
||||||
|
post "/weights/:id" => "weights#show"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user