71 lines
2.1 KiB
Plaintext
71 lines
2.1 KiB
Plaintext
-# #game-component-container-container= react_component 'Game', props = {id: @game.id, current_user: current_user}, html_options = {id: "game-component-container"}
|
|
|
|
-# TODO: Remove deprecated commented out code
|
|
%b Status:
|
|
%p
|
|
= @game.status
|
|
|
|
%p
|
|
%b Title:
|
|
= @game.title
|
|
|
|
- if @game.can_accomodate(current_user)
|
|
= link_to 'Join', game_join_path(@game)
|
|
|
|
- if @game.startable? && @game.already_has?(current_user)
|
|
= link_to 'Start', game_start_path(@game)
|
|
|
|
-#.debug
|
|
= button_to 'Debug Start', game_start_path(@game), method: :get
|
|
= link_to 'Edit Game', edit_game_path(@game)
|
|
|
|
.players
|
|
%b Players:
|
|
%ol
|
|
- @game.players.each do |player|
|
|
%li
|
|
|
|
= player.display_name
|
|
|
|
// Show the user which player they are
|
|
= "Me" if player.user == current_user
|
|
|
|
// Show whose turn it is
|
|
- if @game.controlling_player_id
|
|
%strong= "My Turn " if @game.controlling_player == player
|
|
|
|
// Show the players' cards
|
|
- if player.user == current_user && player.inventory.empty? == false
|
|
-##inventory
|
|
|
|
|
|
-# TODO better logic, not in view
|
|
- unless @game.status == nil
|
|
.table
|
|
-# TODO better logic, not in view. Set play to beat = nil; instead of view logic
|
|
- if @game.play_to_beat && @game.player_to_beat != @game.controlling_player
|
|
- if @game.play_to_beat.play
|
|
%h1
|
|
Hand to beat
|
|
%span.hand-type= @game.play_to_beat.play.hand_type
|
|
%div= @game.play_to_beat.play.to_s
|
|
- @game.play_to_beat.play.player_cards.each do |card|
|
|
= card.to_s
|
|
%span.player= @game.play_to_beat.play.player.display_name
|
|
- else
|
|
%h1 Open table
|
|
|
|
.controls
|
|
- if @game.control_user == current_user
|
|
// 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"
|
|
|