diff options
Diffstat (limited to 'views/info.ejs')
-rw-r--r-- | views/info.ejs | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/views/info.ejs b/views/info.ejs new file mode 100644 index 0000000..27cb543 --- /dev/null +++ b/views/info.ejs @@ -0,0 +1,83 @@ +<%- include('header', { title: title.title_name, refresh: (user ? 300 : 0) }) %> +<img class="logo" src="/<%= title.title_id %>/cover.jpg"> +<%- include('../public/' + title.title_id + '/about.html') %> +<br clear=left> +<p> +Read more about the game on +<a href="https://boardgamegeek.com/boardgame/<%= title.bgg %>">boardgamegeek.com</a>. + +<% if (user) { %> + +<h2>Open Games</h2> +<table class="wide"> +<tr><th>ID<th>Scenario<th>Owner<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.description %> +<td class="nowrap"><%= row.ctime %> +<td><a href="/join/<%= row.game_id %>">Join</a> +<% }); } else { %> +<tr><td colspan="6">No open games. +<% } %> +</table> + +<p> +<a href="/create/<%= title.title_id %>">Create a new game</a>. + +<% if (active_games.length > 0) { %> +<h2>Active Games</h2> +<table class="wide"> +<tr><th>ID<th>Scenario<th>Players<th>Description<th>Changed<th>Turn<th> +<% active_games.forEach((row) => { %> +<tr> +<td><%= row.game_id %> +<td><%= row.scenario %> +<td><%= row.players.join(", ") %> +<td><%= row.description %> +<td class="nowrap"><%= row.mtime %> +<% + if (row.your_turn) { + %><td class="your_turn"><%= row.active %><% + } 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><% + } +%> +<% }); %> +</table> +<% } %> + +<% if (finished_games.length > 0) { %> +<h2>Finished Games</h2> +<table class="wide"> +<tr><th>ID<th>Scenario<th>Players<th>Description<th>Finished<th>Result<th> +<% finished_games.forEach((row) => { %> +<tr> +<td><%= row.game_id %> +<td><%= row.scenario %> +<td><%= row.players.join(", ") %> +<td><%= row.description %> +<td class="nowrap"><%= row.mtime %> +<td><%= row.result %> +<td><a href="/join/<%= row.game_id %>">View</a> +<% }); %> +</table> +<% } %> + +<% } else { %> + +<p> +Login to create or join a game. + +<% } %> |