diff options
Diffstat (limited to 'views')
-rw-r--r-- | views/games.ejs | 28 | ||||
-rw-r--r-- | views/info.ejs | 23 | ||||
-rw-r--r-- | views/join.ejs | 1 | ||||
-rw-r--r-- | views/login.ejs | 2 | ||||
-rw-r--r-- | views/profile.ejs | 18 |
5 files changed, 28 insertions, 44 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> 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 %> diff --git a/views/join.ejs b/views/join.ejs index 46c1e56..1d9347d 100644 --- a/views/join.ejs +++ b/views/join.ejs @@ -9,7 +9,6 @@ let game = <%- JSON.stringify(game) %>; let roles = <%- JSON.stringify(roles) %>; let players = <%- JSON.stringify(players) %>; let user_id = <%- user.user_id %>; -let solo = <%- solo %>; let ready = <%- ready %>; </script> <script src="/join.js"></script> diff --git a/views/login.ejs b/views/login.ejs index b4089fc..3e1dd43 100644 --- a/views/login.ejs +++ b/views/login.ejs @@ -4,7 +4,7 @@ <% } else { %> <form action="/login" method="post"> <p> -<label for="username">Name: </label><br> +<label for="username">Name or mail: </label><br> <input type="text" id="username" name="username" required> <p> <label for="password">Password: </label><br> diff --git a/views/profile.ejs b/views/profile.ejs index 02f6e72..7829870 100644 --- a/views/profile.ejs +++ b/views/profile.ejs @@ -36,7 +36,7 @@ Your mail address is <%= user.mail %>. <td><%= row.game_id %> <td class="nowrap"><a href="/info/<%= row.title_id %>"><%= row.title_name %></a> <td><%= row.scenario %> -<td><%= row.players.join(", ") %> +<td><%= row.player_names %> <td><%= row.description %> <td class="nowrap"><%= row.ctime %> <td><a href="/join/<%= row.game_id %>">Join</a> @@ -53,19 +53,19 @@ Your mail address is <%= user.mail %>. <td><%= row.game_id %> <td class="nowrap"><a href="/info/<%= row.title_id %>"><%= row.title_name %></a> <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 %><% + %><td><%= row.active_role %><% } - if (row.players.reduce((n,p) => n + (p === user.name ? 1 : 0), 0) == 1) { - %><td><a href="/play/<%= row.game_id %>">Play</a><% + if (row.is_shared) { + %><td><a href="/join/<%= row.game_id %>">Enter</a><% } else { - %><td><a href="/join/<%= row.game_id %>">Play</a><% + %><td><a href="/play/<%= row.game_id %>">Play</a><% } %> <% }); %> @@ -81,7 +81,7 @@ Your mail address is <%= user.mail %>. <td><%= row.game_id %> <td class="nowrap"><a href="/info/<%= row.title_id %>"><%= row.title_name %></a> <td><%= row.scenario %> -<td><%= row.players.join(", ") %> +<td><%= row.player_names %> <td><%= row.description %> <td class="nowrap"><%= row.mtime %> <td><%= row.result %> |