summaryrefslogtreecommitdiff
path: root/views/profile.ejs
blob: 8d03234d884b8c6e8108eb47160aa6f0692dccb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<%- include('header', { title: "Rally the Troops!", refresh: (active_games.length > 0 ? 300 : 0) }) %>
<style>
td.nowrap a { color: black; text-decoration: none; }
.logo { width: 80px; height: 80px; }
</style>

<img class="logo" src="<%= avatar %>" width="80" height="80">
<p>
Welcome, <%= user.name %>!
<p>
Your mail address is <%= user.mail %>.

<br clear=left>

<ul style="list-style:'\bb  '">
<li><%
	if (user.notifications) {
		%><a href="/unsubscribe">Disable mail notifications</a><%
	} else {
		%><a href="/subscribe">Enable mail notifications</a><%
	}
%>
<li><a href="/change_password">Change password</a>
<li><a href="/change_mail">Change mail address</a>
<li><a href="/change_name">Change name</a>
<li><a href="/logout">Logout</a>
</ul>

<% if (open_games.length > 0) { %>
<h2>Open Games</h2>
<table class="wide">
<tr><th>ID<th>Game<th>Scenario<th>Players<th>Description<th>Created<th>
<% 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.player_names %>
<td><%= row.description %>
<td class="nowrap"><%= row.ctime %>
<td><a href="/join/<%= row.game_id %>">Join</a>
<% }); %>
</table>
<% } %>

<% if (active_games.length > 0) { %>
<h2>Active Games</h2>
<table class="wide">
<tr><th>ID<th>Game<th>Scenario<th>Players<th>Description<th>Changed<th>Turn<th>
<% 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 %>
<%
	if (row.is_your_turn) {
		%><td class="is_your_turn"><%= row.active_role %><%
	} else {
		%><td><%= row.active_role %><%
	}
	if (row.is_shared) {
		%><td><a href="/join/<%= row.game_id %>">Enter</a><%
	} else {
		%><td><a href="/play/<%= row.game_id %>">Play</a><%
	}
%>
<% }); %>
</table>
<% } %>

<% if (finished_games.length > 0) { %>
<h2>Finished Games</h2>
<table class="wide">
<tr><th>ID<th>Game<th>Scenario<th>Players<th>Description<th>Finished<th>Result<th>
<% finished_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.result %>
<td><a href="/join/<%= row.game_id %>">View</a>
<% }); %>
</table>
<% } %>

<% if (open_games.length === 0 && active_games.length === 0 && finished_games.length === 0) { %>
<p>
You don't have any current or finished games.
<% } %>