diff --git a/Gemfile b/Gemfile index e8f83262..e5cd4939 100644 --- a/Gemfile +++ b/Gemfile @@ -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' diff --git a/Gemfile.lock b/Gemfile.lock index a3da8304..72f0fd44 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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 diff --git a/app/assets/javascripts/games.js.coffee b/app/assets/javascripts/games.js.coffee index 24f83d18..a3cdaf99 100644 --- a/app/assets/javascripts/games.js.coffee +++ b/app/assets/javascripts/games.js.coffee @@ -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() diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index a443db34..12fbc02a 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -13,3 +13,8 @@ *= require_tree . *= require_self */ + +header li { + display: inline-block; + margin-right: 12px; +} diff --git a/app/assets/stylesheets/games.css.scss b/app/assets/stylesheets/games.css.sass similarity index 56% rename from app/assets/stylesheets/games.css.scss rename to app/assets/stylesheets/games.css.sass index 3e6a7ecc..5fffc158 100644 --- a/app/assets/stylesheets/games.css.scss +++ b/app/assets/stylesheets/games.css.sass @@ -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 diff --git a/app/models/game.rb b/app/models/game.rb index 742b6079..3ae125e8 100644 --- a/app/models/game.rb +++ b/app/models/game.rb @@ -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 diff --git a/app/views/games/show.html.haml b/app/views/games/show.html.haml index 57b18a3c..7a47c80d 100644 --- a/app/views/games/show.html.haml +++ b/app/views/games/show.html.haml @@ -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 diff --git a/app/views/layouts/_navigation_links.html.erb b/app/views/layouts/_navigation_links.html.erb index 90ad27be..b82b705a 100644 --- a/app/views/layouts/_navigation_links.html.erb +++ b/app/views/layouts/_navigation_links.html.erb @@ -14,3 +14,4 @@
  • <%= link_to 'Users', users_path %>
  • <% end %> <% end %> +
  • <%= link_to 'Debug', '#showDebugTools', id: 'showDebugTools' %>