diff options
author | DavisLWebb <davislwebb@ymail.com> | 2014-03-06 22:21:39 -0500 |
---|---|---|
committer | DavisLWebb <davislwebb@ymail.com> | 2014-03-06 22:21:39 -0500 |
commit | e7562550fdaff859b0ead5a37e58c5f2b920ca80 (patch) | |
tree | b68d699bf397b7167a8713d789770b7ca59bdb16 /app/controllers | |
parent | 4b672af0e7893a9db1c059c97b06afeafb9c742c (diff) | |
parent | 5f2247dd1e701a91fb0359bf7265bdadd5486a60 (diff) |
Merge branch 'master' of http://github.com/LukeShu/leaguer
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/tournaments_controller.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb index 3f6de26..74a1f56 100644 --- a/app/controllers/tournaments_controller.rb +++ b/app/controllers/tournaments_controller.rb @@ -46,8 +46,7 @@ class TournamentsController < ApplicationController # PATCH/PUT /tournaments/1 # PATCH/PUT /tournaments/1.json def update - require 'pp' - pp params + if params[:update_action].nil? check_perms respond_to do |format| @@ -70,8 +69,15 @@ class TournamentsController < ApplicationController format.html { render action: 'permission_denied', status: :forbidden } format.json { render json: "Permission denied", status: :forbidden } end - #when "open" - # TODO + when "open" + respond_to do |format| + if @tournament.setup + format.html { render action: 'show', notice: 'You have joined this tournament.' } + format.json { head :no_content } + end + format.html { render action: 'permission_denied', status: :forbidden } + format.json { render json: "Permission denied", status: :forbidden } + end #when "close" # TODO else @@ -110,6 +116,6 @@ class TournamentsController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def tournament_params - params.require(:tournament).permit(:game, :game_id, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :status) + params.require(:tournament).permit(:game, :game_id, :status, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams) end end |