mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-06 14:36:59 +00:00
Auto creating of high school weights
This commit is contained in:
@@ -67,6 +67,19 @@ class StaticPagesController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def createCustomWeights
|
||||
if user_signed_in?
|
||||
else
|
||||
redirect_to root_path
|
||||
end
|
||||
@tournament = Tournament.find(params[:tournament])
|
||||
@custom = params[:customValue].to_s
|
||||
@tournament.createCustomWeights(@custom)
|
||||
|
||||
redirect_to "/tournaments/#{@tournament.id}"
|
||||
end
|
||||
|
||||
|
||||
def noMatches
|
||||
if params[:tournament]
|
||||
@tournament = Tournament.find(params[:tournament])
|
||||
|
||||
@@ -61,6 +61,14 @@ class TournamentsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def createHsWeights
|
||||
if params[:tournament]
|
||||
if user_signed_in?
|
||||
@tournament.createHsWeights
|
||||
end
|
||||
redirect_to "/tournaments/#{@tournament.id}"
|
||||
end
|
||||
end
|
||||
# DELETE /tournaments/1
|
||||
# DELETE /tournaments/1.json
|
||||
def destroy
|
||||
|
||||
@@ -42,15 +42,16 @@ class WeightsController < ApplicationController
|
||||
end
|
||||
@weight = Weight.new(weight_params)
|
||||
@tournament = Tournament.find(weight_params[:tournament_id])
|
||||
respond_to do |format|
|
||||
if @weight.save
|
||||
format.html { redirect_to @tournament, notice: 'Weight was successfully created.' }
|
||||
format.json { render action: 'show', status: :created, location: @weight }
|
||||
else
|
||||
format.html { render action: 'new' }
|
||||
format.json { render json: @weight.errors, status: :unprocessable_entity }
|
||||
|
||||
respond_to do |format|
|
||||
if @weight.save
|
||||
format.html { redirect_to @tournament, notice: 'Weight was successfully created.' }
|
||||
format.json { render action: 'show', status: :created, location: @weight }
|
||||
else
|
||||
format.html { render action: 'new' }
|
||||
format.json { render json: @weight.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /weights/1
|
||||
|
||||
Reference in New Issue
Block a user