66 lines
1.7 KiB
Plaintext
66 lines
1.7 KiB
Plaintext
%p
|
|
%b Status:
|
|
= @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
|
|
|
|
// Show the users email TODO show username instead
|
|
= player.user.email
|
|
|
|
// Show the user which player they are
|
|
= "Me" if player.user == current_user
|
|
|
|
// Show whose turn it is
|
|
%strong= "My Turn " if @game.control_player == player
|
|
|
|
// Show the players' cards
|
|
- unless player.inventory.empty?
|
|
%ul.cards
|
|
- player.inventory.each do |card|
|
|
%li
|
|
%label
|
|
// If the cards belong to the user, allow them to select the cards to play as a hand
|
|
= check_box_tag 'player_card_ids[]', card.id, false, form: "edit_game_#{@game.id}" if player.user == current_user
|
|
// Show the card TODO hide values of cards of other players
|
|
= card.to_s
|
|
|
|
-# TODO better logic, not in view
|
|
- unless @game.status == nil
|
|
.table
|
|
- if @game.current_hand
|
|
%h1 Hand to beat
|
|
- else
|
|
%h1 Open table
|
|
%h2
|
|
Played
|
|
- if @game.plays.count > 0
|
|
- @game.plays.last.player_cards.each do |card|
|
|
= card.to_s
|
|
|
|
.controls
|
|
- if @game.control_user == current_user
|
|
// Play hand form
|
|
= form_for @game, :url => play_hand_game_path(@game) do |f|
|
|
// Provide id of current game
|
|
-#= f.hidden_field :id
|
|
= f.submit "Play Hand"
|
|
|