From 0d0dab23fb0ecf16a2abf54295746d7dbd87c2d7 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 10 Nov 2021 22:27:46 +0100 Subject: Massive SQL cleanup. --- views/change_about.ejs | 2 +- views/forum_reply.ejs | 13 +++----- views/forum_thread.ejs | 15 ++++----- views/forum_view.ejs | 25 ++++++-------- views/games.ejs | 37 ++++++++++----------- views/header.ejs | 6 ++-- views/info.ejs | 47 +++++++++++++------------- views/join.ejs | 3 +- views/message_inbox.ejs | 13 ++------ views/message_outbox.ejs | 13 ++------ views/message_read.ejs | 24 +++++--------- views/message_send.ejs | 11 ++++--- views/profile.ejs | 85 +++++++++++++++++++++++------------------------- views/stats.ejs | 2 +- views/user.ejs | 7 ++-- views/users.ejs | 6 ++-- 16 files changed, 134 insertions(+), 175 deletions(-) (limited to 'views') diff --git a/views/change_about.ejs b/views/change_about.ejs index 249f9be..c87fc55 100644 --- a/views/change_about.ejs +++ b/views/change_about.ejs @@ -1,4 +1,4 @@ -<%- include('header', { title: "Change Profile" }) %> +<%- include('header', { title: "Change profile text" }) %> diff --git a/views/forum_reply.ejs b/views/forum_reply.ejs index bf27492..85bafad 100644 --- a/views/forum_reply.ejs +++ b/views/forum_reply.ejs @@ -1,16 +1,13 @@ <%- include('header', { title: thread.subject }) %> - +
-
<%= post.author_name %> -<%= post.ctime %> -<%= post.edited ? "(edited " + post.mtime + ")" : "" %> +<%= post.author_name %> +<%= post.ctime %> <%= post.edited ? "(edited " + post.mtime + ")" : "" %>
<%- post.body %>
diff --git a/views/forum_thread.ejs b/views/forum_thread.ejs index 0041f20..7232bce 100644 --- a/views/forum_thread.ejs +++ b/views/forum_thread.ejs @@ -1,18 +1,15 @@ <%- include('header', { title: thread.subject }) %> <% posts.forEach((row) => { %>

- +
- diff --git a/views/forum_view.ejs b/views/forum_view.ejs index 5f04f3f..6838803 100644 --- a/views/forum_view.ejs +++ b/views/forum_view.ejs @@ -1,23 +1,18 @@ <%- include('header', { title: "Forum", refresh: 900 }) %> - -
<%= row.author_name %> -<%= row.ctime %> +<%= row.author_name %> +<%= row.ctime %> <%= row.edited ? "(edited " + row.mtime + ")" : "" %>
<%- row.body %>
+
- + <% threads.forEach((row) => { %> - diff --git a/views/games.ejs b/views/games.ejs index b74dbba..acb94b6 100644 --- a/views/games.ejs +++ b/views/games.ejs @@ -1,40 +1,37 @@ <%- include('header', { title: "All Public Games", refresh: (user ? 300 : 0) }) %> -

Open

-
SubjectAuthor -RepliesTime +
Subject +Author +Replies +Time
<%= row.subject %> -<%= row.author_name %> -<%= row.reply_count %> -<%= row.mtime %> +<%= row.subject %> +<%= row.author_name %> +<%= row.replies %> +<%= row.mtime %> <% }); %>
+
-
IDTitleScenarioPlayersDescriptionCreated <% if (open_games.length > 0) { %> <% open_games.forEach((row) => { %>
<%= row.game_id %> -<%= row.title_name %> -<%= row.scenario %> -<%- row.player_names || row.owner_name %> -<%= row.description %> -<%= row.ctime %> -Join +<%= row.game_id %> +<%= row.title_name %> +<%= row.scenario %> +<%- row.player_names || row.owner_name %> +<%= row.description %> +<%= row.ctime %> +Join <% }); } else { %>
No open games. <% } %>

Active

- +
-
IDTitleScenarioPlayersDescriptionChangedActive <% if (active_games.length > 0) { %> <% active_games.forEach((row) => { %>
<%= row.game_id %> -<%= row.title_name %> -<%= row.scenario %> -<%- row.player_names %> -<%= row.description %> -<%= row.mtime %> -"><%= row.active_role %> -Enter +<%= row.game_id %> +<%= row.title_name %> +<%= row.scenario %> +<%- row.player_names %> +<%= row.description %> +<%= row.mtime %> +"><%= row.active %> +Enter <% }); } else { %>
No active games. <% } %> diff --git a/views/header.ejs b/views/header.ejs index aed34d0..337290a 100644 --- a/views/header.ejs +++ b/views/header.ejs @@ -16,7 +16,7 @@ Forum <% if (user) { - let unread = user.unread(); + let unread = user.unread | 0; if (unread > 0) { %>Inbox (<%= unread %>)<% } else { @@ -33,7 +33,7 @@

<%= title %>

<% - if (typeof message !== 'undefined' && message.length > 0) { - %>

<%= Array.isArray(message) ? message.join("\n") : message %>

<% + if (typeof flash !== 'undefined' && flash.length > 0) { + %>

<%= Array.isArray(flash) ? flash.join("\n") : flash %>

<% } %> diff --git a/views/info.ejs b/views/info.ejs index 159e732..f97b04e 100644 --- a/views/info.ejs +++ b/views/info.ejs @@ -1,7 +1,4 @@ <%- include('header', { title: title.title_name, refresh: (user ? 300 : 0) }) %> - <%- include('../public/' + title.title_id + '/about.html') %>

@@ -11,17 +8,17 @@ Read more about the game on <% if (user) { %>

Open Games

- +
-
IDScenarioPlayersDescriptionCreated <% if (open_games.length > 0) { %> <% open_games.forEach((row) => { %>
<%= row.game_id %> +<%= row.game_id %> <%= row.scenario %> -<%- row.player_names || `${row.owner_name}` %> -<%= row.description %> -<%= row.ctime %> -Join +<%- row.player_names || `${row.owner_name}` %> +<%= row.description %> +<%= row.ctime %> +Join <% }); } else { %>
No open games. <% } %> @@ -32,34 +29,34 @@ Read more about the game on <% if (active_games.length > 0) { %>

Active Games

- +
-
IDScenarioPlayersDescriptionChangedTurn <% active_games.forEach((row) => { %>
<%= row.game_id %> -<%= row.scenario %> -<%- row.player_names %> -<%= row.description %> -<%= row.mtime %> -"><%= row.active_role %> -Enter +<%= row.game_id %> +<%= row.scenario %> +<%- row.player_names %> +<%= row.description %> +<%= row.mtime %> +"><%= row.active %> +Enter <% }); %>
<% } %> <% if (finished_games.length > 0) { %>

Finished Games

- +
-
IDScenarioPlayersDescriptionFinishedResult <% finished_games.forEach((row) => { %>
<%= row.game_id %> -<%= row.scenario %> -<%- row.player_names %> -<%= row.description %> -<%= row.mtime %> -<%= row.result %> -View +<%= row.game_id %> +<%= row.scenario %> +<%- row.player_names %> +<%= row.description %> +<%= row.mtime %> +<%= row.result %> +View <% }); %>
<% } %> diff --git a/views/join.ejs b/views/join.ejs index b9cf824..fa33d5c 100644 --- a/views/join.ejs +++ b/views/join.ejs @@ -12,6 +12,7 @@ function format_options(options) { - - +
"> - <% } %> diff --git a/views/message_read.ejs b/views/message_read.ejs index 28762cf..7b32eda 100644 --- a/views/message_read.ejs +++ b/views/message_read.ejs @@ -1,10 +1,4 @@ -<%- include('header', { title: mail.subject }) %> - +<%- include('header', { title: message.subject }) %> -
ToSubjectDate <% if (messages.length > 0) { messages.forEach((row) => { %>
<%= row.to_name %> +<%= row.to_name %> <%= row.subject %> -<%= row.time %> +<%= row.time %> <% }); } else { %>
No messages
- +
From: <%= mail.from_name %> -
To: <%= mail.to_name %> -
Date: <%= mail.time %> -
<%= mail.body %>
+
From: <%= message.from_name %> +
To: <%= message.to_name %> +
Date: <%= message.time %> +
<%- message.body %>

-<% if ( mail.from_id !== user.user_id ) { %> - +<% if ( 1 || message.from_id !== user.user_id ) { %> + <% } %> - + diff --git a/views/message_send.ejs b/views/message_send.ejs index 6f72d74..4dafa3a 100644 --- a/views/message_send.ejs +++ b/views/message_send.ejs @@ -1,6 +1,6 @@ <%- include('header', { title: "Send Message" }) %>

@@ -8,7 +8,7 @@ To:
+ <%= (to_name === "") ? "autofocus" : "" %> required>

@@ -17,14 +17,17 @@ Subject: 0 ? "autofocus" : "" %> + <%= (to_name !== "" && subject === "") ? "autofocus" : "" %> pattern=".*\S+.*" required>

Body:
- +

diff --git a/views/profile.ejs b/views/profile.ejs index 3c49014..1dbc1f5 100644 --- a/views/profile.ejs +++ b/views/profile.ejs @@ -1,10 +1,5 @@ <%- include('header', { title: "Rally the Troops!", refresh: (active_games.length > 0 ? 300 : 0) }) %> - - - +

Welcome, <%= user.name %>!

@@ -12,60 +7,62 @@ Your mail address is <%= user.mail %>.
-

+
» +Change +password, +mail address, +name, +or profile text. +
» +Logout <% if (open_games.length > 0) { %>

Open Games

- +
-
IDGameScenarioPlayersDescriptionCreated <% open_games.forEach((row) => { %>
<%= row.game_id %> -<%= row.title_name %> -<%= row.scenario %> -<%- row.player_names %> -<%= row.description %> -<%= row.ctime %> -Join +<%= row.game_id %> +<%= row.title_name %> +<%= row.scenario %> +<%- row.player_names %> +<%= row.description %> +<%= row.ctime %> +Join <% }); %>
<% } %> <% if (active_games.length > 0) { %>

Active Games

- +
-
IDGameScenarioPlayersDescriptionChangedTurn <% active_games.forEach((row) => { %>
<%= row.game_id %> -<%= row.title_name %> -<%= row.scenario %> -<%- row.player_names %> -<%= row.description %> -<%= row.mtime %> +<%= row.game_id %> +<%= row.title_name %> +<%= row.scenario %> +<%- row.player_names %> +<%= row.description %> +<%= row.mtime %> <% - if (row.is_your_turn) { - %><%= row.active_role %><% + if (row.is_active) { + %><%= row.active %><% } else { - %><%= row.active_role %><% + %><%= row.active %><% } if (row.is_shared) { - %>Enter<% + %>Enter<% } else { - %>Play<% + %>Play<% } %> <% }); %> @@ -74,18 +71,18 @@ Your mail address is <%= user.mail %>. <% if (finished_games.length > 0) { %>

Finished Games

- +
-
IDGameScenarioPlayersDescriptionFinishedResult <% finished_games.forEach((row) => { %>
<%= row.game_id %> -<%= row.title_name %> -<%= row.scenario %> -<%- row.player_names %> -<%= row.description %> -<%= row.mtime %> -<%= row.result %> -View +<%= row.game_id %> +<%= row.title_name %> +<%= row.scenario %> +<%- row.player_names %> +<%= row.description %> +<%= row.mtime %> +<%= row.result %> +View <% }); %>
<% } %> diff --git a/views/stats.ejs b/views/stats.ejs index 64a6303..9e07aaf 100644 --- a/views/stats.ejs +++ b/views/stats.ejs @@ -17,7 +17,7 @@ for (let title_id in title_name_map) { let scenarios = title_rule_map[title_id].scenarios; let roles = title_role_map[title_id].concat(['Draw']); - %>
<%= title_name_map[title_id] %><% + %>
<%= title_name_map[title_id].title_name %><% roles.forEach(role => { %><%= role %><% }); diff --git a/views/user.ejs b/views/user.ejs index 9da706c..8fd1d08 100644 --- a/views/user.ejs +++ b/views/user.ejs @@ -1,8 +1,5 @@ <%- include('header', { title: who.name }) %> - - + <% if (who.about) { %>

<%= who.about %>

<% } else { %> @@ -11,7 +8,7 @@

Member since <%= who.ctime %>.

-Was last seen <%= who.atime %>. +Last seen <%= who.atime %>. <% if (user) { %>

Send message diff --git a/views/users.ejs b/views/users.ejs index d6e4d4a..9255d04 100644 --- a/views/users.ejs +++ b/views/users.ejs @@ -3,14 +3,12 @@ td.avatar{padding:0;width:80px;} td.avatar img{display:block;width:80px;height:80px;} - - +
AvatarNameMember sinceLast seen - <% userList.forEach((row) => { %>
-<%= row.name %> +<%= row.name %> <%= row.ctime %> <%= row.atime %> <% }); %> -- cgit v1.2.3