Toying with Play Now

This commit is contained in:
Jesse C. Fisher 2019-10-20 21:59:40 -07:00
parent af24c7f9c9
commit c2865fb638
2 changed files with 3 additions and 18 deletions

View File

@ -106,9 +106,9 @@ class GamesController < ApplicationController
def play_now
# First joinable game or create new game
@game = Game.play_now(current_user)
@seats = @game.seats.order(:position).map {|s| s.occupied? ? nil : s}
@seats = @game.table.seats.order(:position).map {|s| s.occupied? ? nil : s}
@seats.compact.last.sit(current_user)
redirect_to @game
redirect_to @game.table
end
def join
@ -129,7 +129,7 @@ class GamesController < ApplicationController
end
flash[:notice] = 'Game started.'
redirect_to(@game)
redirect_to(@game.table)
end
def my_inventory

View File

@ -57,20 +57,6 @@
- else
%h1 Open table
-# .controls
- if @game.controlling_player.soft_token == current_user.soft_token
// Play hand form
= form_for @game, :url => play_hand_game_path(@game), remote: true do |f|
// Provide id of current game
-#= f.hidden_field :id
= f.submit "Play Hand"
= form_for @game, :url => play_hand_game_path(@game) do |f|
// Provide id of current game
-#= f.hidden_field :id
= f.hidden_field :hand_type, value: 'pass'
= f.submit "Pass"
#game-component
%h1= @game.title
@ -79,4 +65,3 @@
= render "seat", seat: @seats[0]
#mid
= render "seat", seat: @seats[1]