<%= link "Game with #{opponent(@conn, game).name}", to: game_path(@conn, :show, game), class: "btn btn-default btn-xs" %>
diff --git a/lib/chess_web/views/game_view.ex b/lib/chess_web/views/game_view.ex
index eca501e..612fb9f 100644
--- a/lib/chess_web/views/game_view.ex
+++ b/lib/chess_web/views/game_view.ex
@@ -3,6 +3,12 @@ defmodule ChessWeb.GameView do
import Chess.Auth, only: [current_user: 1]
+ def turn_class(conn, game) do
+ if your_turn?(conn, game) do
+ "your-turn"
+ end
+ end
+
def your_turn?(conn, game) do
player_colour(conn, game) == game.turn
end
|