diff options
author | Tomer Kimia <tkimia@purdue.edu> | 2014-04-01 18:51:03 -0400 |
---|---|---|
committer | Tomer Kimia <tkimia@purdue.edu> | 2014-04-01 18:51:03 -0400 |
commit | aa6e8f12a24e33d88a5751cee5e93bf4a038e2ef (patch) | |
tree | 1b198c27c38d344d69d4e713ab680a06127703cd /app/controllers | |
parent | 0867bc68749873aa131c0f3b273771b5f70ae778 (diff) |
AJAX is now working in the tournament loading page
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/tournaments_controller.rb | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb index 2f04e1f..4455ad2 100644 --- a/app/controllers/tournaments_controller.rb +++ b/app/controllers/tournaments_controller.rb @@ -11,10 +11,20 @@ class TournamentsController < ApplicationController # GET /tournaments/1 # GET /tournaments/1.json def show - case @tournament.status - when 0 - when 1..2 - redirect_to "/tournaments/" + @tournament.id.to_s + "/matches" #tournament_matches_page(@tournament) + respond_to do |format| + format.html { + case @tournament.status + when 0 + render action: 'show' + when 1..2 + redirect_to "/tournaments/" + @tournament.id.to_s + "/matches" #tournament_matches_page(@tournament) + end + } + format.json { + data = JSON.parse(@tournament.to_json) + data["players"] = @tournament.players; + render :json => data.to_json + } end end |