diff options
Diffstat (limited to 'views/profile.ejs')
-rw-r--r-- | views/profile.ejs | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/views/profile.ejs b/views/profile.ejs index 4d97486..a001e21 100644 --- a/views/profile.ejs +++ b/views/profile.ejs @@ -1,4 +1,4 @@ -<%- include('header', { title: "Rally the Troops!", refresh: (active_games.length > 0 ? 300 : 0) }) %> +<%- include('header', { title: "Rally the Troops!", refresh: (active_games.length > 0 ? 300 : 0) }) _%> <img class="logo avatar" src="<%= avatar %>" width="80" height="80"> <p> Welcome, <%= user.name %>! @@ -26,70 +26,79 @@ or <a href="/change_about">profile text</a>. <br>» <a href="/logout">Logout</a> -<% if (open_games.length > 0) { %> +<%_ if (open_games.length > 0) { _%> <h2>Open Games</h2> <table class="game"> -<tr><th>ID<th>Game<th>Scenario<th>Players<th>Description<th>Created<th> -<% open_games.forEach((row) => { %> +<tr><th>ID<th>Game<th>Scenario<th>Options<th>Players<th>Description<th>Created<th> +<%_ open_games.forEach((row) => { _%> <tr> <td class="id"><%= row.game_id %> <td class="name"><a href="/info/<%= row.title_id %>"><%= row.title_name %></a> <td class="scenario"><%= row.scenario %> +<td class="options"><%- row.options %> <td class="players"><%- row.player_names %> <td class="description"><%= row.description %> <td class="time"><%= row.ctime %> <td class="command"><a href="/join/<%= row.game_id %>">Join</a> -<% }); %> +<%_ }); _%> </table> -<% } %> +<%_ } _%> -<% if (active_games.length > 0) { %> +<%_ if (active_games.length > 0) { _%> <h2>Active Games</h2> <table class="game"> -<tr><th>ID<th>Game<th>Scenario<th>Players<th>Description<th>Changed<th>Turn<th> -<% active_games.forEach((row) => { %> +<tr><th>ID<th>Game<th>Scenario<th>Options<th>Players<th>Description<th>Changed<th>Turn<th> +<%_ active_games.forEach((row) => { _%> <tr> <td class="id"><%= row.game_id %> <td class="title"><a href="/info/<%= row.title_id %>"><%= row.title_name %></a> <td class="scenario"><%= row.scenario %> +<td class="options"><%- row.options %> <td class="players"><%- row.player_names %> <td class="description"><%= row.description %> <td class="time"><%= row.mtime %> -<% +<%_ if (row.is_active) { %><td class="role is_active"><%= row.active %><% } else { %><td class="role"><%= row.active %><% } if (row.is_shared) { - %><td class="command"><a href="/join/<%= row.game_id %>">Enter</a><% + %><td class="command"><a href="/join/<%= row.game_id %>">Play</a><% } else { - %><td class="command"><a href="/play/<%= row.game_id %>">Play</a><% + %><td class="command"><a href="/<%- row.title_id %>/play:<%- row.game_id %>:<%- row.your_role %>">Play</a><% } -%> -<% }); %> +_%> +<%_ }); _%> </table> -<% } %> +<%_ } _%> -<% if (finished_games.length > 0) { %> +<%_ if (finished_games.length > 0) { _%> <h2>Finished Games</h2> <table class="game"> -<tr><th>ID<th>Game<th>Scenario<th>Players<th>Description<th>Finished<th>Result<th> -<% finished_games.forEach((row) => { %> +<tr><th>ID<th>Game<th>Scenario<th>Options<th>Players<th>Description<th>Finished<th>Result<th> +<%_ finished_games.forEach((row) => { _%> <tr> <td class="id"><%= row.game_id %> <td class="title"><a href="/info/<%= row.title_id %>"><%= row.title_name %></a> <td class="scenario"><%= row.scenario %> +<td class="options"><%- row.options %> <td class="players"><%- row.player_names %> <td class="description"><%= row.description %> <td class="time"><%= row.mtime %> <td class="result"><%= row.result %> -<td class="command"><a href="/join/<%= row.game_id %>">View</a> -<% }); %> +<%_ + if (row.is_shared) { + %><td class="command"><a href="/join/<%= row.game_id %>">View</a><% + } else { + %><td class="command"><a href="/<%- row.title_id %>/play:<%- row.game_id %>:<%- row.your_role %>">View</a><% + } +_%> +<%_ }); _%> </table> -<% } %> +<%_ } _%> -<% if (open_games.length === 0 && active_games.length === 0 && finished_games.length === 0) { %> +<%_ if (open_games.length === 0 && active_games.length === 0 && finished_games.length === 0) { _%> <p> You don't have any current or finished games. -<% } %> +<%_ } _%> |