From ff63178547fbc699129ff77510a5ef287dee5f98 Mon Sep 17 00:00:00 2001 From: "Jesse C. Fisher" Date: Sun, 20 Oct 2019 05:06:22 -0700 Subject: [PATCH] Adds top seat, player, controls --- app/views/tables/show.html.haml | 25 +++++++++ config/routes.rb | 2 +- stashtable.txt | 96 ++++++++++----------------------- 3 files changed, 54 insertions(+), 69 deletions(-) diff --git a/app/views/tables/show.html.haml b/app/views/tables/show.html.haml index 5ea42456..d459b68e 100644 --- a/app/views/tables/show.html.haml +++ b/app/views/tables/show.html.haml @@ -100,3 +100,28 @@ - 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"} + + diff --git a/config/routes.rb b/config/routes.rb index 2ad13b1a..7db0097f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -26,7 +26,7 @@ Rails.application.routes.draw do get 'my-inventory' post 'start' post 'join' - patch 'play_hand' + post 'play_hand' end resources :seats do member do diff --git a/stashtable.txt b/stashtable.txt index 440aedf1..6162046e 100644 --- a/stashtable.txt +++ b/stashtable.txt @@ -1,69 +1,29 @@ - {/* Show player controls if player is owned by current_user */} - {(this.props.soft_token == this.props.game.current_user_soft_token) && (this.props.game.is_started == true) - ? ( ) - : -
- {[...Array(this.props.inventory_count)].map((card, index) => )} -
- } +
+ +
+ +
+ +
+ +
+
+ +
+
- - - - - - - - - - : "Empty" } - - - - - - -
-
- -
- -
- -
-
-
-
- -
-
-