From 1ea842d0ab5900e6d315f65a31b767c2dd5b6a27 Mon Sep 17 00:00:00 2001 From: Dan Barber Date: Wed, 14 Jul 2021 18:12:16 -0500 Subject: [PATCH] Bunch of fixes --- lib/chess_web/templates/game/board.html.leex | 4 +++- lib/chess_web/templates/password/edit.html.eex | 2 +- lib/chess_web/templates/profile/edit.html.eex | 2 +- lib/chess_web/views/game_view.ex | 4 +++- test/chess_web/controllers/game_controller_test.exs | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/chess_web/templates/game/board.html.leex b/lib/chess_web/templates/game/board.html.leex index c5d3ede..caa9f78 100644 --- a/lib/chess_web/templates/game/board.html.leex +++ b/lib/chess_web/templates/game/board.html.leex @@ -37,5 +37,7 @@ <% end %> -
+
+ <%= states[@game.state] %> +
diff --git a/lib/chess_web/templates/password/edit.html.eex b/lib/chess_web/templates/password/edit.html.eex index 24e985b..35d1eb8 100644 --- a/lib/chess_web/templates/password/edit.html.eex +++ b/lib/chess_web/templates/password/edit.html.eex @@ -1,7 +1,7 @@

<%= gettext "Password" %>

- <%= form_for @changeset, password_path(@conn, :update), [class: "update-password"], fn f -> %> + <%= form_for @changeset, password_path(@conn, :update), [class: "update-password", novalidate: true], fn f -> %> <%= if @changeset.action do %>

diff --git a/lib/chess_web/templates/profile/edit.html.eex b/lib/chess_web/templates/profile/edit.html.eex index a8b335a..94cad6c 100644 --- a/lib/chess_web/templates/profile/edit.html.eex +++ b/lib/chess_web/templates/profile/edit.html.eex @@ -1,7 +1,7 @@

<%= gettext "Profile" %>

- <%= form_for @changeset, profile_path(@conn, :update), [class: "update-profile"], fn f -> %> + <%= form_for @changeset, profile_path(@conn, :update), [class: "update-profile", novalidate: true], fn f -> %> <%= if @changeset.action do %>

diff --git a/lib/chess_web/views/game_view.ex b/lib/chess_web/views/game_view.ex index 1d99066..f16e365 100644 --- a/lib/chess_web/views/game_view.ex +++ b/lib/chess_web/views/game_view.ex @@ -37,7 +37,9 @@ defmodule ChessWeb.GameView do end def your_turn?(conn, game) do - player_colour(conn, game) == game.turn + conn + |> current_user() + |> player_colour(game) == game.turn end def player_colour(conn, game) do diff --git a/test/chess_web/controllers/game_controller_test.exs b/test/chess_web/controllers/game_controller_test.exs index 4815394..59b290f 100644 --- a/test/chess_web/controllers/game_controller_test.exs +++ b/test/chess_web/controllers/game_controller_test.exs @@ -60,7 +60,7 @@ defmodule ChessWeb.GameControllerTest do |> login(user) |> get(game_path(conn, :show, game)) - assert html_response(conn, 200) =~ "

" + assert html_response(conn, 200) =~ "
" end test "does not show a game if the user is not a player", %{conn: conn} do