Toying with Play Now
This commit is contained in:
parent
b23d044438
commit
d6c58efe0c
@ -106,9 +106,9 @@ class GamesController < ApplicationController
|
|||||||
def play_now
|
def play_now
|
||||||
# First joinable game or create new game
|
# First joinable game or create new game
|
||||||
@game = Game.play_now(current_user)
|
@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)
|
@seats.compact.last.sit(current_user)
|
||||||
redirect_to @game
|
redirect_to @game.table
|
||||||
end
|
end
|
||||||
|
|
||||||
def join
|
def join
|
||||||
@ -129,7 +129,7 @@ class GamesController < ApplicationController
|
|||||||
end
|
end
|
||||||
flash[:notice] = 'Game started.'
|
flash[:notice] = 'Game started.'
|
||||||
|
|
||||||
redirect_to(@game)
|
redirect_to(@game.table)
|
||||||
end
|
end
|
||||||
|
|
||||||
def my_inventory
|
def my_inventory
|
||||||
|
|||||||
@ -57,20 +57,6 @@
|
|||||||
- else
|
- else
|
||||||
%h1 Open table
|
%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
|
#game-component
|
||||||
%h1= @game.title
|
%h1= @game.title
|
||||||
|
|
||||||
@ -79,4 +65,3 @@
|
|||||||
= render "seat", seat: @seats[0]
|
= render "seat", seat: @seats[0]
|
||||||
#mid
|
#mid
|
||||||
= render "seat", seat: @seats[1]
|
= render "seat", seat: @seats[1]
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user