From 401a13ff9e7792f0e060ccfb15afdbd3bc5fc557 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 28 Jun 2021 12:38:42 +0200 Subject: Clean up SQL and use table views. --- views/games.ejs | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'views/games.ejs') diff --git a/views/games.ejs b/views/games.ejs index fb58be8..4e6f2a4 100644 --- a/views/games.ejs +++ b/views/games.ejs @@ -5,52 +5,44 @@ td.nowrap a { color: black; text-decoration: none; }

Open

-
IDTitleScenarioOwnerDescriptionCreatedPlayers +
IDTitleScenarioPlayersDescriptionCreated <% if (open_games.length > 0) { %> <% open_games.forEach((row) => { %>
<%= row.game_id %> <%= row.title_name %> <%= row.scenario %> -<%= row.owner_name %> +<%= row.player_names || row.owner_name %> <%= row.description %> <%= row.ctime %> -<%= row.players.join(", ") %> Join <% }); } else { %> -
No open games. +
No open games. <% } %>

Active

-
IDTitleScenarioDescriptionChangedPlayersActive +
IDTitleScenarioPlayersDescriptionChangedActive <% if (active_games.length > 0) { %> <% active_games.forEach((row) => { %>
<%= row.game_id %> <%= row.title_name %> <%= row.scenario %> +<%= row.player_names %> <%= row.description %> <%= row.mtime %> -<%= row.players.join(", ") %> <% - if (row.your_turn) { - %><%= row.active %><% + if (row.is_your_turn) { + %><%= row.active_role %><% } else { - %><%= row.active %><% - } - let me = row.players.reduce((n,p) => n + (p === user.name ? 1 : 0), 0); - if (me == 1) { - %>Play<% - } else if (me > 1) { - %>Play<% - } else { - %>View<% + %><%= row.active_role %><% } + %>Enter<% %> <% }); } else { %> -
No active games. +
No active games. <% } %>
-- cgit v1.2.3