diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-06-28 12:38:42 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2021-06-28 22:10:44 +0200 |
commit | 401a13ff9e7792f0e060ccfb15afdbd3bc5fc557 (patch) | |
tree | b96febaeaa3cc78bb5872be58c10bccc7a04d622 /views/info.ejs | |
parent | dd165d03e95f252150a94fc27d0280551d7e041b (diff) | |
download | server-401a13ff9e7792f0e060ccfb15afdbd3bc5fc557.tar.gz |
Clean up SQL and use table views.
Diffstat (limited to 'views/info.ejs')
-rw-r--r-- | views/info.ejs | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/views/info.ejs b/views/info.ejs index 55b8faa..02ce2dd 100644 --- a/views/info.ejs +++ b/views/info.ejs @@ -9,13 +9,13 @@ Read more about the game on <h2>Open Games</h2> <table class="wide"> -<tr><th>ID<th>Scenario<th>Owner<th>Description<th>Created<th> +<tr><th>ID<th>Scenario<th>Players<th>Description<th>Created<th> <% if (open_games.length > 0) { %> <% open_games.forEach((row) => { %> <tr> <td><%= row.game_id %> <td><%= row.scenario %> -<td><%= row.owner_name %> +<td><%= row.player_names || row.owner_name %> <td><%= row.description %> <td class="nowrap"><%= row.ctime %> <td><a href="/join/<%= row.game_id %>">Join</a> @@ -35,23 +35,16 @@ Read more about the game on <tr> <td><%= row.game_id %> <td><%= row.scenario %> -<td><%= row.players.join(", ") %> +<td><%= row.player_names %> <td><%= row.description %> <td class="nowrap"><%= row.mtime %> <% - if (row.your_turn) { - %><td class="your_turn"><%= row.active %><% + if (row.is_your_turn) { + %><td class="is_your_turn"><%= row.active_role %><% } else { - %><td><%= row.active %><% - } - let me = row.players.reduce((n,p) => n + (p === user.name ? 1 : 0), 0); - if (me == 1) { - %><td><a href="/play/<%= row.game_id %>">Play</a><% - } else if (me > 1) { - %><td><a href="/join/<%= row.game_id %>">Play</a><% - } else { - %><td><a href="/join/<%= row.game_id %>">View</a><% + %><td><%= row.active_role %><% } + %><td><a href="/join/<%= row.game_id %>">Enter</a><% %> <% }); %> </table> @@ -65,7 +58,7 @@ Read more about the game on <tr> <td><%= row.game_id %> <td><%= row.scenario %> -<td><%= row.players.join(", ") %> +<td><%= row.player_names %> <td><%= row.description %> <td class="nowrap"><%= row.mtime %> <td><%= row.result %> |