+
{this.props.email}
+ {this.props.game.is_started
+ ?
+
Inventory count: {this.props.inventory_count}
+ : null }
{/* Show player controls if player is owned by current_user */}
- {this.props.user_id == this.props.current_user_id
+ {(this.props.user_id == this.props.game.current_user_id) && (this.props.game.is_started == true)
? (
)
+ controlling_player_id={this.props.game.controlling_player_id} /> )
: null }
);
diff --git a/app/assets/javascripts/components/player_list.js.jsx b/app/assets/javascripts/components/player_list.js.jsx
index f5b193d9..5f6de9c8 100644
--- a/app/assets/javascripts/components/player_list.js.jsx
+++ b/app/assets/javascripts/components/player_list.js.jsx
@@ -4,24 +4,35 @@ var PlayerList = React.createClass({
game_id: React.PropTypes.number
},
- render: function() {
+ playerNodes: function() {
var playerList = this;
- var playerNodes = this.props.players.map(function (player) {
+ var playerNodes = this.props.game.players.map(function (player) {
return (
- PlayerList:
- {playerNodes}
+
+
+ {this.playerNodes()[0]}
+
+
+ {this.playerNodes()[1]}
+
Hand to beat: {this.props.game.play_to_beat_string}
+ {this.playerNodes()[2]}
+
+
+ {this.playerNodes()[3]}
+
);
}
diff --git a/app/assets/javascripts/header-scroll.js b/app/assets/javascripts/header-scroll.js
new file mode 100644
index 00000000..640dbe6d
--- /dev/null
+++ b/app/assets/javascripts/header-scroll.js
@@ -0,0 +1,38 @@
+// Hide Header on on scroll down
+var didScroll;
+var lastScrollTop = 0;
+var delta = 5;
+var navbarHeight = $('header > nav').outerHeight();
+
+$(window).scroll(function(event){
+ didScroll = true;
+});
+
+setInterval(function() {
+ if (didScroll) {
+ hasScrolled();
+ didScroll = false;
+ }
+}, 250);
+
+function hasScrolled() {
+ var st = $(this).scrollTop();
+
+ // Make sure they scroll more than delta
+ if(Math.abs(lastScrollTop - st) <= delta)
+ return;
+
+ // If they scrolled down and are past the navbar, add class .nav-up.
+ // This is necessary so you never see what is "behind" the navbar.
+ if (st > lastScrollTop && st > navbarHeight){
+ // Scroll Down
+ $('header > nav').removeClass('nav-down').addClass('nav-up');
+ } else {
+ // Scroll Up
+ if(st + $(window).height() < $(document).height()) {
+ $('header > nav').removeClass('nav-up').addClass('nav-down');
+ }
+ }
+
+ lastScrollTop = st;
+}
diff --git a/app/assets/stylesheets/application.css.sass b/app/assets/stylesheets/application.css.sass
index fc00ca13..4a835437 100644
--- a/app/assets/stylesheets/application.css.sass
+++ b/app/assets/stylesheets/application.css.sass
@@ -16,17 +16,18 @@
html
box-sizing: border-box
- display: flex
+ //display: flex
justify-content: center
min-height: 100vh
body
- flex: 1 1 auto
+ //flex: 1 1 auto
display: flex
flex-direction: column
- min-height: 100vmin
+ min-height: 100vh
margin: 0
- background: darkgreen
+ background: url('backgrounds/felt-green.png')
+ font-size: 4vmin
a
text-decoration: none
@@ -35,22 +36,30 @@ a
h1
font-size: 7vmin
+ margin: 0 0 5vmin 0
header
- flex: 1 1 auto
font-size: 3vmin
+ margin-bottom: 10vmin
nav
padding: 1vmin
background: #222
+ position: fixed
+ top: 0
+ transition: top 0.2s ease-in-out
+ width: 100%
+ &.nav-up
+ top: -40px
ul
margin: 0
display: flex
li
flex: 1 1 auto
+ text-align: center
#content
flex: 3 1 auto
- background: darkgreen
+ //background: hotpink
display: flex
flex-direction: column
flex-wrap: wrap
@@ -62,6 +71,7 @@ header
text-align: center
h1
font-size: 10vmin
+ color: #111
background: green
padding: 5vmin
margin: 0
diff --git a/app/assets/stylesheets/game.css.sass b/app/assets/stylesheets/game.css.sass
index 49fea1bf..1a2aa69d 100644
--- a/app/assets/stylesheets/game.css.sass
+++ b/app/assets/stylesheets/game.css.sass
@@ -10,3 +10,105 @@
display: inline-block
width: 40%
+//// New Game#new
+
+.simple_form
+ background: green
+ padding: 5vmin
+ outline: 2px solid black
+ label
+ font-size: 4vmin
+ display: block
+ input.string
+ font-size: 6vmin
+ margin-bottom: 2vmin
+ input.btn
+ font-size: 4vmin
+
+//// Show Game#show
+
+button
+ font-size: 4vmin
+
+#game-component-container-container
+ display: flex
+ flex-direction: column
+ flex: 1 1 auto
+ align-self: stretch
+ #game-component-container
+ flex: 1 1 auto
+ display: flex
+
+#game-component
+ flex: 1 1 auto
+ flex-direction: column
+ align-self: stretch
+ display: flex
+ h1
+ font-size: 4vmin
+ #game-controls
+ display: flex
+ flex-direction: row
+ margin-bottom: 5vh
+ align-self: stretch
+ align-items: flex-start
+ div
+ flex: 1 1 auto
+ #start
+ align-self: flex-end
+ text-align: right
+ .player-list
+ display: flex
+
+ .player
+ background: green
+ padding: 2vmin
+ outline: 2px solid black
+ position: relative
+ &.has-control
+ background: lightgreen
+
+#playerList
+ display: flex
+ flex-direction: row
+ flex-wrap: wrap
+ align-items: flex-start
+ text-align: center
+ #top
+ flex: 0 0 100%
+ display: flex
+ .player
+ flex: 1 1 auto
+ #mid
+ flex: 0 0 100%
+ align-self: center
+ align-items: flex-start
+ display: flex
+ .player
+ flex: 1 1 auto
+ .email
+ //position: absolute
+ //background: green
+ &:first-of-type
+ .email
+ //left: -18.5vmin
+ //transform: rotate(-90deg)
+ &:last-of-type
+ .email
+ //transform: rotate(90deg)
+ //right: -17vmin
+ #play-to-beat
+ flex: 1 1 auto
+ #bot
+ flex: 0 0 100%
+ align-self: flex-end
+
+////// Inventory
+
+.player form
+ ul
+ display: flex
+ flex-wrap: wrap
+ text-align: left
+ li
+ flex: 1 1 auto
diff --git a/app/assets/stylesheets/games.css.sass b/app/assets/stylesheets/games.css.sass
index c8cab7da..01907cc6 100644
--- a/app/assets/stylesheets/games.css.sass
+++ b/app/assets/stylesheets/games.css.sass
@@ -2,10 +2,6 @@
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
-#content
- h1
- flex: 1 1 auto
-
.games-container
flex: 1 1 auto
display: flex
@@ -20,9 +16,8 @@
padding: 2vmin
.button
- flex: 1 1 auto
text-align: center
font-size: 4vmin
padding: 2vmin 4vmin
background: black
- margin-bottom: 2vmin
+ margin-bottom: 5vmin
diff --git a/app/views/games/_form.html.haml b/app/views/games/_form.html.haml
index fa6aa96e..63b8f210 100644
--- a/app/views/games/_form.html.haml
+++ b/app/views/games/_form.html.haml
@@ -3,7 +3,7 @@
.form-inputs
= f.input :title
- = f.association :players, as: :select, collection: User.all.map {|u| u.id}, include_blank: false, include_hidden: false
+ -#= f.association :players, as: :select, collection: User.all.map {|u| u.id}, include_blank: false, include_hidden: false
.form-actions
= f.button :submit
diff --git a/app/views/games/new.html.haml b/app/views/games/new.html.haml
index c47db8ac..262e1224 100644
--- a/app/views/games/new.html.haml
+++ b/app/views/games/new.html.haml
@@ -1,5 +1,3 @@
%h1 New game
= render 'form'
-
-= link_to 'Back', games_path
diff --git a/app/views/games/show.html.haml b/app/views/games/show.html.haml
index 4a6af384..08a511fb 100644
--- a/app/views/games/show.html.haml
+++ b/app/views/games/show.html.haml
@@ -1,4 +1,4 @@
-#game-component= react_component 'Game', url: "#{game_path @game}"
+#game-component-container-container= react_component 'Game', props = {url: "#{game_path @game}"}, html_options = {id: "game-component-container"}
-# TODO: Remove deprecated commented out code
-#%p
diff --git a/app/views/layouts/_navigation_links.html.erb b/app/views/layouts/_navigation_links.html.erb
index fcea7cc6..1b652b28 100644
--- a/app/views/layouts/_navigation_links.html.erb
+++ b/app/views/layouts/_navigation_links.html.erb
@@ -1,7 +1,7 @@
<%= link_to 'Main Menu', root_path %>
- <%= link_to 'Browse', games_path %>
+ <%= link_to 'Games', games_path %>
<% if user_signed_in? %>
<%= link_to 'Edit account', edit_user_registration_path %>
<%= link_to 'Sign out', destroy_user_session_path, :method=>'delete' %>
diff --git a/spec/features/plays_spec.rb b/spec/features/plays_spec.rb
index 01e3f195..958389be 100644
--- a/spec/features/plays_spec.rb
+++ b/spec/features/plays_spec.rb
@@ -120,7 +120,7 @@ feature 'Play a hand', type: :feature, js: true do
# next player is now the active player
#expect(@game.controlling_player_id).to_not eq(@controlling_player_id)
#expect(@game.controlling_player_id).to eq(@next_player_id)
- expect(page).to have_content("Current Player: #{@next_player_id}")
+ expect(page).to have_selector("#player-#{@next_player_id}.has-control")
end
# Scenario: Player can not play an invalid hand on their turn