another stash

This commit is contained in:
Jesse C. Fisher 2015-04-19 05:58:05 -07:00
parent 4db7bb0eb9
commit b70d09fee8
8 changed files with 69 additions and 18 deletions

View File

@ -20,7 +20,9 @@ gem 'simple_form'
gem 'upmin-admin'
group :development do
gem 'better_errors'
gem 'binding_of_caller', :platforms=>[:mri_21]
gem 'rubocop', require: false
gem 'haml-lint', require: false
gem 'binding_of_caller'
gem 'capistrano', '~> 3.0.1'
gem 'capistrano-bundler'
gem 'capistrano-rails', '~> 1.1.0'

View File

@ -122,6 +122,10 @@ GEM
rspec (>= 2.99.0, < 4.0)
haml (4.1.0.beta.1)
tilt
haml-lint (0.12.0)
haml (~> 4.0)
rubocop (>= 0.25.0)
sysexits (~> 1.1)
haml-rails (0.6.0)
actionpack (>= 4.0.1)
activesupport (>= 4.0.1)
@ -294,6 +298,7 @@ GEM
colorize (>= 0.7.0)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
sysexits (1.2.0)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
@ -341,6 +346,7 @@ DEPENDENCIES
guard-bundler
guard-rails
guard-rspec
haml-lint
haml-rails
high_voltage
html2haml

View File

@ -1,3 +1,9 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
$ ->
$('body')
.on 'click', '#showDebugTools', ->
console.log "Showing Debug Tools"
$('.debug').show()

View File

@ -13,3 +13,8 @@
*= require_tree .
*= require_self
*/
header li {
display: inline-block;
margin-right: 12px;
}

View File

@ -1,3 +1,15 @@
// Place all the styles related to the Games controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
.players
display: inline-block
width: 40%
.table
display: inline-block
width: 40%
vertical-align: top
.debug
display: none

View File

@ -43,17 +43,16 @@ class Game < ActiveRecord::Base
return true
end
def current_hand
return nil
end
def startable?
begin
self.validate_startable
self.validate_startable
rescue
return false
end
#@player_count = players.count
#tests = [
#@player_count.between?(2, 4),
#status != 'Game Started'
#]
#return tests.all?
end
def lowest_card

View File

@ -12,28 +12,48 @@
- if @game.startable? && @game.already_has?(current_user)
= link_to 'Start', game_start_path(@game)
= link_to 'Debug Start', game_start_path(@game)
.debug
= button_to 'Debug Start', game_start_path(@game), method: :get
= link_to 'Edit Game', edit_game_path(@game)
%p
.players
%b Players:
%ol
- @game.players.each do |player|
%li
%strong= "My Turn " if @game.control_player == player
// 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.player_cards.empty?
%ul.cards
- player.player_cards.order(:value).each do |card|
%li
%label
= check_box_tag 'player_card_ids[]', card.id
// 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.rank, card.suit].join(' ')
%p
- if @game.control_user == current_user
= link_to 'Play Hand', '#'
.table
- if @game.current_hand
%h1 Hand to beat
- else
%h1 Open table
.controls
- if @game.control_user == current_user
// Show the Play Hand form
-#= form_for @game, :url => {:action => "Bro"} do |f|
= form_for @game do |f|
// Provide id of current game
= f.hidden_field :id
= f.submit "Play Hand"
= link_to 'Edit', edit_game_path(@game)
\|
= link_to 'Back', games_path

View File

@ -14,3 +14,4 @@
<li><%= link_to 'Users', users_path %></li>
<% end %>
<% end %>
<li><%= link_to 'Debug', '#showDebugTools', id: 'showDebugTools' %></li>