1
0
mirror of https://github.com/danbee/chess synced 2025-03-04 08:39:06 +00:00
chess/lib/chess_web/views/game_view.ex

14 lines
250 B
Elixir

defmodule ChessWeb.GameView do
use ChessWeb, :view
import ChessWeb.LayoutView, only: [current_user: 1]
def opponent(conn, game) do
if current_user(conn).id == game.user_id do
game.opponent
else
game.user
end
end
end