mirror of
https://github.com/danbee/chess
synced 2025-03-04 08:39:06 +00:00
Bunch of fixes
This commit is contained in:
parent
f5c35de8d8
commit
1ea842d0ab
@ -37,5 +37,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="game-state game-state--null"></div>
|
<div class="game-state game-state--<%= @game.state %>">
|
||||||
|
<%= states[@game.state] %>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<div class="form">
|
<div class="form">
|
||||||
<h2><%= gettext "Password" %></h2>
|
<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 %>
|
<%= if @changeset.action do %>
|
||||||
<div class="alert alert-danger">
|
<div class="alert alert-danger">
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<div class="form">
|
<div class="form">
|
||||||
<h2><%= gettext "Profile" %></h2>
|
<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 %>
|
<%= if @changeset.action do %>
|
||||||
<div class="alert alert-danger">
|
<div class="alert alert-danger">
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@ -37,7 +37,9 @@ defmodule ChessWeb.GameView do
|
|||||||
end
|
end
|
||||||
|
|
||||||
def your_turn?(conn, game) do
|
def your_turn?(conn, game) do
|
||||||
player_colour(conn, game) == game.turn
|
conn
|
||||||
|
|> current_user()
|
||||||
|
|> player_colour(game) == game.turn
|
||||||
end
|
end
|
||||||
|
|
||||||
def player_colour(conn, game) do
|
def player_colour(conn, game) do
|
||||||
|
|||||||
@ -60,7 +60,7 @@ defmodule ChessWeb.GameControllerTest do
|
|||||||
|> login(user)
|
|> login(user)
|
||||||
|> get(game_path(conn, :show, game))
|
|> 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
|
end
|
||||||
|
|
||||||
test "does not show a game if the user is not a player", %{conn: conn} do
|
test "does not show a game if the user is not a player", %{conn: conn} do
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user