- if policy(@table).update? .owner-controls = link_to 'Edit', edit_table_path(@table) = link_to 'Destroy', game, :method => :delete, :data => { :confirm => 'Are you sure?' } -# #table-component-container-container= react_component 'Table', props = {url: "#{table_path @table}"}, html_options = {id: "table-component-container"} %h1= @table.title - 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.soft_token == current_user.soft_token // 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 %p %b Game: = @game.title %p = @game.status -# 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" #game-component %h1= @game.title - if @game.started? - else %section#game-controls -# TODO: If not joinable, show why. i.e. game full -# TODO: DEPRECATED use seat sit instead this.state.data.is_joinable ? : null -# TODO: If not startable, show why. i.e. need more players -# - if @game.can_accomodate(current_user) = button_to "Join", join_game_path(@game) #playerList #top .game-seat.position-1 .seat .seat-controls - if @seats[0].occupied? - if @seats[0].occupied_by? current_user = button_to "Stand", stand_seat_path(@seats[0]) - else = button_to "Sit", sit_seat_path(@seats[0]) - if @seats[0].player .player .user-name= @seats[0].player.display_name - if @game.started? .inventory-count= @seats[0].player.inventory.count -# Show player controls if player is owned by current_user - if @seats[0].player.soft_token = current_user.soft_token = form_for @game, play_hand_game_path %ul#inventory - @seats[0].player.inventory.each do |card| %li %label %input{form: "player_controls_" + card.player_id, type: "checkbox", name: "player_card_ids[]", data: {card_name: card.rank.gsub('11','J') .gsub('12','Q') .gsub('13','K') .gsub('14','A') .gsub('15','2') + ' ' + card.suit}, value: card.id} %img{src: "/assets/cards/png/" + (card.rank.gsub('J','jack').gsub('Q','queen').gsub('K','king').gsub('A','ace') + '_of_' + card.suit.downcase + "s.png").gsub('11','jack') .gsub('12','queen') .gsub('13','king') .gsub('14','ace') .gsub('15','2') } -# = image_tag("hi") %input{type: "submit", value: "Play Hand", name: "commit"} %input{disabled: (@game.controlling_player_id == @seats[0].player.id ? nil : "disabled"), type: "submit", value: "Pass", name: "pass"}