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

Bunch of fixes

This commit is contained in:
Daniel Barber 2021-07-14 18:12:16 -05:00
parent f5c35de8d8
commit 1ea842d0ab
5 changed files with 9 additions and 5 deletions

View File

@ -37,5 +37,7 @@
<% end %>
</div>
<div class="game-state game-state--null"></div>
<div class="game-state game-state--<%= @game.state %>">
<%= states[@game.state] %>
</div>
</div>

View File

@ -1,7 +1,7 @@
<div class="form">
<h2><%= gettext "Password" %></h2>
<%= 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 %>
<div class="alert alert-danger">
<p>

View File

@ -1,7 +1,7 @@
<div class="form">
<h2><%= gettext "Profile" %></h2>
<%= 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 %>
<div class="alert alert-danger">
<p>

View File

@ -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

View File

@ -60,7 +60,7 @@ defmodule ChessWeb.GameControllerTest do
|> login(user)
|> get(game_path(conn, :show, game))
assert html_response(conn, 200) =~ "<div id=\"game\" data-game-id=\"#{game.id}\">"
assert html_response(conn, 200) =~ "<div data-game-id=\"#{game.id}\">"
end
test "does not show a game if the user is not a player", %{conn: conn} do