Clear Play To Beat when play is passed by all other players
This commit is contained in:
parent
00b24af7a2
commit
bbfb20a390
@ -115,7 +115,6 @@ ol#cards-to-beat
|
|||||||
margin-left: -21vmin
|
margin-left: -21vmin
|
||||||
// Don't offset first card
|
// Don't offset first card
|
||||||
&:first-of-type
|
&:first-of-type
|
||||||
// margin-left: 0
|
|
||||||
margin-left: -4vmin
|
margin-left: -4vmin
|
||||||
flex: 1 1 auto
|
flex: 1 1 auto
|
||||||
//flex: 1 1 auto
|
//flex: 1 1 auto
|
||||||
|
|||||||
@ -124,6 +124,11 @@ class Game < ActiveRecord::Base
|
|||||||
when 'next'
|
when 'next'
|
||||||
self.controlling_player_id = self.next_player_id
|
self.controlling_player_id = self.next_player_id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Clear play to beat if play returns to owner
|
||||||
|
if self.play_to_beat.try(:player).try(:id) == self.controlling_player_id
|
||||||
|
self.play_to_beat_id = nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def joinable? user
|
def joinable? user
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
class PlayToBeat < ActiveRecord::Base
|
class PlayToBeat < ActiveRecord::Base
|
||||||
belongs_to :game
|
belongs_to :game
|
||||||
belongs_to :play
|
belongs_to :play
|
||||||
|
has_one :player, through: :play
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#play-to-beat
|
#play-to-beat
|
||||||
%h4 Hand to beat:
|
%h4 Hand to beat:
|
||||||
- if @game.play_to_beat.play == nil
|
- if @game.play_to_beat == nil
|
||||||
None
|
None
|
||||||
- else
|
- else
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user