diff options
Diffstat (limited to 'views/games.ejs')
-rw-r--r-- | views/games.ejs | 28 |
1 files changed, 10 insertions, 18 deletions
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; } <h2>Open</h2> <table class="wide"> -<tr><th>ID<th>Title<th>Scenario<th>Owner<th>Description<th>Created<th>Players<th> +<tr><th>ID<th>Title<th>Scenario<th>Players<th>Description<th>Created<th> <% if (open_games.length > 0) { %> <% open_games.forEach((row) => { %> <tr> <td><%= row.game_id %> <td class="nowrap"><a href="/info/<%= row.title_id %>"><%= row.title_name %></a> <td><%= row.scenario %> -<td><%= row.owner_name %> +<td><%= row.player_names || row.owner_name %> <td><%= row.description %> <td class="nowrap"><%= row.ctime %> -<td><%= row.players.join(", ") %> <td><a href="/join/<%= row.game_id %>">Join</a> <% }); } else { %> -<tr><td colspan="6">No open games. +<tr><td colspan="7">No open games. <% } %> </table> <h2>Active</h2> <table class="wide"> -<tr><th>ID<th>Title<th>Scenario<th>Description<th>Changed<th>Players<th>Active<th> +<tr><th>ID<th>Title<th>Scenario<th>Players<th>Description<th>Changed<th>Active<th> <% if (active_games.length > 0) { %> <% active_games.forEach((row) => { %> <tr> <td><%= row.game_id %> <td class="nowrap"><a href="/info/<%= row.title_id %>"><%= row.title_name %></a> <td><%= row.scenario %> +<td><%= row.player_names %> <td><%= row.description %> <td class="nowrap"><%= row.mtime %> -<td><%= row.players.join(", ") %> <% - 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><% %> <% }); } else { %> -<tr><td colspan="6">No active games. +<tr><td colspan="8">No active games. <% } %> </table> |