From 1a71184bcbf714d266e80d186fd666d393ed5981 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 19 Nov 2021 02:45:51 +0100 Subject: Clean up stylesheets. Don't show options in game lists. --- public/join.js | 4 +- public/style.css | 112 +++++++++++++++++++++++--------------- views/change_about.ejs | 6 ++- views/chat.ejs | 2 +- views/create.ejs | 4 ++ views/forum_edit.ejs | 5 +- views/forum_post.ejs | 2 +- views/forum_reply.ejs | 6 ++- views/forum_thread.ejs | 17 +++--- views/forum_view.ejs | 61 ++++++++++----------- views/games.ejs | 83 +++++++++++++++-------------- views/header.ejs | 61 ++++++++++----------- views/info.ejs | 120 ++++++++++++++++++++--------------------- views/join.ejs | 25 +++++---- views/message_inbox.ejs | 17 ++++-- views/message_outbox.ejs | 17 ++++-- views/message_read.ejs | 11 ++-- views/message_send.ejs | 2 +- views/profile.ejs | 136 +++++++++++++++++++++++------------------------ 19 files changed, 369 insertions(+), 322 deletions(-) diff --git a/public/join.js b/public/join.js index 898113b..f79eabc 100644 --- a/public/join.js +++ b/public/join.js @@ -96,9 +96,9 @@ function update() { if (player) { if (game.status > 0) { if (is_active(player, role)) - element.className = "is_active"; + element.classList.add("is_active"); else - element.className = ""; + element.classList.remove("is_active"); if (player.user_id === user_id) element.innerHTML = `Play`; else diff --git a/public/style.css b/public/style.css index 76d6ff2..89ba3b2 100644 --- a/public/style.css +++ b/public/style.css @@ -1,48 +1,76 @@ -html, input, textarea { font-family: "Source Serif", "Georgia", "Dingbats", "Noto Emoji", serif; font-size: 16px; } -button, select { font-family: "Source Sans", "Verdana", "Dingbats", "Noto Emoji", sans-serif; font-size: 16px; } +html, input, textarea { + font-family: "Source Serif", "Georgia", "Dingbats", "Noto Emoji", serif; + font-size: 16px; +} +button, select { + font-family: "Source Sans", "Verdana", "Dingbats", "Noto Emoji", sans-serif; + font-size: 16px; +} + html, body { margin: 0; } h1 { margin-left: -2px; } h2 { margin-left: -1px; } -.header { display: flex; align-items: center; justify-content: space-between; border-bottom: 2px solid brown; padding-right: 1em; } -.header img { display: block; margin: 4px 0 -2px 2px; } -.header span { margin: 0 1em; } -.header a { color: black; } -.main { margin: 2em; } -.main p, .main dl { max-width: 50rem; } -.main hr { max-width: 50rem; margin-right: auto; margin-left: 0; } -.main hr { border: none; border-top: 2px dotted brown; } -.main hr + p { font-style: italic; } -img.logo { float: left; margin: 0 20px 5px 0; box-shadow: 2px 2px 4px 0px rgba(0,0,0,0.5); height: 200px; } -img.avatar { float: left; margin: 0 20px 5px 0; box-shadow: 2px 2px 4px 0px rgba(0,0,0,.5); width: 80px; height: 80px; } -.is_active { background-color: lemonchiffon; } -.error { color: brown; font-style: italic; white-space: pre-wrap; } -.warning { color: brown; } -.warning::before { content: "\26a0"; } -form { display: inline; } -label { user-select: none; } -input[type="text"], input[type="password"], textarea { padding: 5px; } -select { padding-right: 20px; } -button, input, select { font-size: 1rem; margin: 5px 0; } -button, select { margin: 5px 10px 5px 0; padding: 1px 10px; background-color: gainsboro; vertical-align: top; } -button:disabled { color: gray; border: 2px solid gainsboro; outline: 1px solid gray; } -button:enabled, select { border: 2px outset white; outline: 1px solid black; } -button:enabled:active:hover, select:active { border: 2px inset white; padding: 2px 9px 0px 11px; } +a { color: blue; } +.w { white-space: nowrap; } +.r { text-align: right; } + +header { + display: flex; + align-items: center; + justify-content: space-between; + border-bottom: 2px solid brown; + padding-right: 1em; +} +header img { + display: block; + margin: 4px 0 -2px 2px; +} +header nav a { margin: 0 1em; color: black; } +article { margin: 2em; } +article p, article dl, article ul { max-width: 50rem; } + +img.avatar { + float: left; margin: 0 20px 5px 0; + box-shadow: 2px 2px 4px 0px rgba(0,0,0,.5); + width: 80px; + height: 80px; +} + +img.logo { + float: left; + margin: 0 20px 5px 0; + box-shadow: 2px 2px 4px 0px rgba(0,0,0,0.5); + height: 200px; +} + +table { min-width: min(50rem,100%); } table { border-collapse: collapse; } -tfoot { background-color: gainsboro; } th { text-align: left; background-color: gainsboro; } th, td { border: 1px solid black; padding: 3px 1ex; } -table.game { min-width: min(50rem,100%); } -table.game .title { white-space: nowrap; } -table.game .scenario { white-space: nowrap; } -table.game .role { white-space: nowrap; } -table.game .time { white-space: nowrap; } -table.game td a { text-decoration: none; color: black; } -table.game td.command a { text-decoration: underline; color: blue; } -table.post { min-width: min(50rem,100%); } -table.post .author { white-space: nowrap; width: 10rem; } -table.post .time { white-space: nowrap; text-align: right; width: 5rem; } -table.post .replies { width: 0; } -table.post .unread { background-color: lightyellow; } -table.post .body { white-space: pre-wrap; padding: 10px 10px; } -table.post th a { text-decoration: none; color: black; } -table.post td:not(.body):not(.edit) a { text-decoration: none; color: black; } +th a, td:not(.command) a { text-decoration: none; color: black; } +td.body { white-space: pre-wrap; padding: 10px 10px; } + +input[type="text"], input[type="password"], textarea { + padding: 5px; +} +button, input, select { + margin: 5px 0; +} +button, select { + margin: 5px 10px 5px 0; + padding: 1px 10px; + background-color: gainsboro; + vertical-align: top; +} +button:disabled { color: gray; border: 2px solid gainsboro; outline: 1px solid gray; } +button:enabled, select { border: 2px outset white; outline: 1px solid black; } +button:enabled:active:hover, select:active { border: 2px inset white; padding: 2px 9px 0px 11px; } + +td.is_active { background-color: lemonchiffon; } +p.error { color: brown; font-style: italic; white-space: pre-wrap; } +p.warning { color: brown; } +p.warning::before { content: "\26a0"; } + +article hr { max-width: 50rem; margin-right: auto; margin-left: 0; } +article hr { border: none; border-top: 2px dotted brown; } +article hr + p { font-style: italic; } diff --git a/views/change_about.ejs b/views/change_about.ejs index c87fc55..cbea0c5 100644 --- a/views/change_about.ejs +++ b/views/change_about.ejs @@ -1,9 +1,11 @@ -<%- include('header', { title: "Change profile text" }) %> +<%- include('header', { title: "Change profile text" }) -%>
- +

+

diff --git a/views/chat.ejs b/views/chat.ejs index 81697ee..d217857 100644 --- a/views/chat.ejs +++ b/views/chat.ejs @@ -1,4 +1,4 @@ -<%- include('header', { title: "Chat Log" }) %> +<%- include('header', { title: "Chat Log" }) -%>

- +

diff --git a/views/forum_post.ejs b/views/forum_post.ejs index aa24455..98d667c 100644 --- a/views/forum_post.ejs +++ b/views/forum_post.ejs @@ -1,4 +1,4 @@ -<%- include('header', { title: "New Thread" }) %> +<%- include('header', { title: "New Thread" }) -%> diff --git a/views/forum_reply.ejs b/views/forum_reply.ejs index 3e87ddd..db777b6 100644 --- a/views/forum_reply.ejs +++ b/views/forum_reply.ejs @@ -1,13 +1,15 @@ -<%- include('header', { title: thread.subject }) %> +<%- include('header', { title: thread.subject }) -%>
<%= post.author_name %> -<%= post.ctime %> <%= post.edited ? "(edited " + post.mtime + ")" : "" %> +<%= post.ctime %> <%= post.edited ? "(edited " + post.mtime + ")" : "" %>
<%- post.body %>
diff --git a/views/forum_thread.ejs b/views/forum_thread.ejs index 7232bce..5c76704 100644 --- a/views/forum_thread.ejs +++ b/views/forum_thread.ejs @@ -1,21 +1,22 @@ -<%- include('header', { title: thread.subject }) %> +<%- include('header', { title: thread.subject }) -%> <% posts.forEach((row) => { %>

<% if (user) { %> -
<%= row.author_name %> -<%= row.ctime %> +<%= row.ctime %> <%= row.edited ? "(edited " + row.mtime + ")" : "" %>
<%- row.body %>
+ <% if (row.author_id === user.user_id) { %> Edit <% } %> @@ -23,8 +24,6 @@ table .edit { text-align: right; border: none; } <% } %>
<% }); %> -<% -if (user) { - %>

Reply<% -} -%> +<% if (user) { %> +

Reply +<% } %> diff --git a/views/forum_view.ejs b/views/forum_view.ejs index 6838803..d5ebd46 100644 --- a/views/forum_view.ejs +++ b/views/forum_view.ejs @@ -1,40 +1,37 @@ -<%- include('header', { title: "Forum", refresh: 900 }) %> - - +<%- include('header', { title: "Forum", refresh: 900 }) -%> + +
- -
Subject -Author -Replies -Time - +Subject +Author +Replies +Time <% threads.forEach((row) => { %>
<%= row.subject %> -<%= row.author_name %> -<%= row.replies %> -<%= row.mtime %> +<%= row.subject %> +<%= row.author_name %> +<%= row.replies %> +<%= row.mtime %> <% }); %>
-<% -if (current_page > 1) { - %> <% -} -for (let p = 1; p <= page_count && p <= 30; ++p) { - if (p === current_page) { - %>(<%= p %>) <% - } else { - %><%= p %> <% - } -} -if (current_page < page_count) { - %> <% -} -%> +<% if (current_page > 1) { %> + +<% } %> +<% for (let p = 1; p <= page_count && p <= 30; ++p) { %> +<% if (p === current_page) { %> +(<%- p %>) +<% } else { %> +<%- p %> +<% } %> +<% } %> +<% if (current_page < page_count) { %> + +<% } %>
-<% -if (user) { - %>

New thread<% -} -%> +<% if (user) { %> +

New thread +<% } %> diff --git a/views/games.ejs b/views/games.ejs index 86a2502..90b2f68 100644 --- a/views/games.ejs +++ b/views/games.ejs @@ -1,50 +1,51 @@ -<%- include('header', { title: "All Public Games", refresh: (user ? 300 : 0) }) %> +<%- include('header', { title: "All Public Games", refresh: (user ? 300 : 0) }) -%>

Open

- -
IDTitleScenarioOptionsPlayersDescriptionCreated -<%_ if (open_games.length > 0) { _%> -<%_ open_games.forEach((row) => { _%> + + -
IDTitleScenarioPlayersDescriptionCreated +<% if (open_games.length > 0) { %> +<% open_games.forEach((row) => { %>
<%= row.game_id %> -<%= row.title_name %> -<%= row.scenario %> -<%- row.options %> -<%- row.player_names %> -<%= row.description %> -<%= row.ctime %> +<%= row.game_id %> +<%= row.title_name %> +<%= row.scenario %> +<%- row.player_names %> +<%= row.description %> +<%= row.ctime %> Join -<%_ }); } else { _%> -
No open games. -<%_ } _%> +<% }); } else { %> +
No open games. +<% } %>

Active

- -
IDTitleScenarioOptionsPlayersDescriptionChangedActive -<%_ if (active_games.length > 0) { _%> -<%_ active_games.forEach((row) => { _%> + + -
IDTitleScenarioPlayersDescriptionChangedActive +<% if (active_games.length > 0) { %> +<% active_games.forEach((row) => { %>
<%= row.game_id %> -<%= row.title_name %> -<%= row.scenario %> -<%- row.options %> -<%- row.player_names %> -<%= row.description %> -<%= row.mtime %> -"><%= row.active %> -<%_ - if (row.is_yours) { - if (row.is_shared) { - %>View<% - } else { - %>View<% - } - } else { - %>View<% - } -_%> -<%_ }); } else { _%> -
No active games. -<%_ } _%> +<%= row.game_id %> +<%= row.title_name %> +<%= row.scenario %> +<%- row.player_names %> +<%= row.description %> +<%= row.mtime %> +<% if (row.is_active) { %> +<%= row.active %> +<% } else { %> +<%= row.active %> +<% } %> +<% if (row.is_yours) { %> +<% if (row.is_shared) { %> +View +<% } else { %> +View +<% } %> +<% } else { %> +View +<% } %> +<% }); %> +<% } else { %> +
No active games. +<% } %>
diff --git a/views/header.ejs b/views/header.ejs index c8337fc..2628f8d 100644 --- a/views/header.ejs +++ b/views/header.ejs @@ -2,40 +2,35 @@ -<% if (typeof refresh !== 'undefined' && refresh > 0) { %><% } %> - +<% if (typeof refresh !== 'undefined' && refresh > 0) { _%> + +<% } _%> <%= title %> - + + + -
-
-
-About -Forum -<% - if (user) { - let unread = user.unread | 0; - if (unread > 0) { - %>Inbox (<%= unread %>)<% - } else { - %>Inbox<% - } - %>Profile (<%= user.name %>)<% - } else { - %>Signup<% - %>Login<% - } -%> -
-
-
+
+ + +
+

<%= title %>

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

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

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

<%= flash %>

+<%_ } _%> diff --git a/views/info.ejs b/views/info.ejs index 4a515ff..49625ed 100644 --- a/views/info.ejs +++ b/views/info.ejs @@ -1,84 +1,80 @@ -<%- include('header', { title: title.title_name, refresh: (user ? 300 : 0) }) _%> +<%- include('header', { title: title.title_name, refresh: (user ? 300 : 0) }) -%> -<%- include('../public/' + title.title_id + '/about.html') %> +<%- include('../public/' + title.title_id + '/about.html') -%>

Read more about the game on boardgamegeek.com.

Open Games

- -
IDScenarioOptionsPlayersDescriptionCreated -<%_ if (open_games.length > 0) { _%> -<%_ open_games.forEach((row) => { _%> + + -
IDScenarioPlayersDescriptionCreated +<% if (open_games.length > 0) { -%> +<% open_games.forEach((row) => { %>
<%= row.game_id %> -<%= row.scenario %> -<%- row.options %> -<%- row.player_names %> -<%= row.description %> -<%= row.ctime %> +<%= row.game_id %> +<%= row.scenario %> +<%- row.player_names %> +<%= row.description %> +<%= row.ctime %> Join -<%_ }); } else { _%> -
No open games. -<%_ } _%> +<% }); } else { %> +
No open games. +<% } %>

Create a new game. -<%_ if (active_games.length > 0) { _%> +<% if (active_games.length > 0) { %>

Active Games

- -
IDScenarioOptionsPlayersDescriptionChangedTurn -<%_ active_games.forEach((row) => { _%> +
IDScenarioPlayersDescriptionChangedTurn +<% active_games.forEach((row) => { %>
<%= row.game_id %> -<%= row.scenario %> -<%- row.options %> -<%- row.player_names %> -<%= row.description %> -<%= row.mtime %> -"><%= row.active %> -<%_ - if (row.is_yours) { - if (row.is_shared) { - %>Play<% - } else { - %>Play<% - } - } else { - %>View<% - - } -_%> -<%_ }); _%> +<%= row.game_id %> +<%= row.scenario %> +<%- row.player_names %> +<%= row.description %> +<%= row.mtime %> +<% if (row.is_active) { %> +<%= row.active %> +<% } else { %> +<%= row.active %> +<% } %> +<% if (row.is_yours) { %> +<% if (row.is_shared) { %> +Play +<% } else { %> +Play +<% } %> +<% } else { %> +View +<% } %> +<% }); %>
-<%_ } _%> +<% } %> -<%_ if (finished_games.length > 0) { _%> +<% if (finished_games.length > 0) { %>

Finished Games

- -
IDScenarioOptionsPlayersDescriptionFinishedResult -<%_ finished_games.forEach((row) => { _%> +
IDScenarioPlayersDescriptionFinishedResult +<% finished_games.forEach((row) => { %>
<%= row.game_id %> -<%= row.scenario %> -<%- row.options %> -<%- row.player_names %> -<%= row.description %> -<%= row.mtime %> -<%= row.result %> -<%_ - if (row.is_yours) { - if (row.is_shared) { - %>View<% - } else { - %>View<% - } - } else { - %>View<% - } -_%> -<%_ }); _%> +<%= row.game_id %> +<%= row.scenario %> +<%- row.player_names %> +<%= row.description %> +<%= row.mtime %> +<%= row.result %> +<% if (row.is_yours) { %> +<% if (row.is_shared) { %> +View +<% } else { %> +View +<% } %> +<% } else { %> +View +<% } %> +<% }); %>
-<%_ } _%> +<% } %> diff --git a/views/join.ejs b/views/join.ejs index 6558745..b4e4718 100644 --- a/views/join.ejs +++ b/views/join.ejs @@ -1,7 +1,8 @@ <%- include('header', { title: game.title_name }) -%> @@ -20,24 +21,30 @@ let ready = <%- ready %>;

Owner: <%= game.owner_name %> -
-Private: <%= game.private ? "yes" : "no" %> +<% if (game.private) { %> +(private) +<% } %>
Scenario: <%= game.scenario %>
Options: <%= game.options %> -
-Description: <%= game.description || "No description." %> + +

+<%= game.description || "No description." %>
-<% roles.forEach((role) => { %><% }); %> +<% roles.forEach((role) => { %> + +<% }); %> -<% roles.forEach((role) => { %><% }); %> +<% roles.forEach((role) => { %> + +<% }); %> - +
<%= role %><%= role %>
--
--

diff --git a/views/message_inbox.ejs b/views/message_inbox.ejs index e70e156..626662d 100644 --- a/views/message_inbox.ejs +++ b/views/message_inbox.ejs @@ -1,12 +1,19 @@ -<%- include('header', { title: "Inbox" }) %> +<%- include('header', { title: "Inbox" }) -%> +

Send message "> - +<% } else {%> + +<% } %> + <% } %> diff --git a/views/message_outbox.ejs b/views/message_outbox.ejs index c7ff379..a5d1abd 100644 --- a/views/message_outbox.ejs +++ b/views/message_outbox.ejs @@ -1,4 +1,7 @@ -<%- include('header', { title: "Outbox" }) %> +<%- include('header', { title: "Outbox" }) -%> + -
FromSubjectDate <% if (messages.length > 0) { messages.forEach((row) => { %> -
<%= row.from_name %> -<%= row.subject %> -<%= row.time %> +<% if (row.read) { %> +
<%= row.from_name %> +<%= row.subject %> +<%= row.time %> <% }); } else { %>
No messages
-
From: <%= message.from_name %> -
To: <%= message.to_name %> -
Date: <%= message.time %> + +
From:<%= message.from_name %> +
To:<%= message.to_name %> +
Date:<%= message.time %>
<%- message.body %>

diff --git a/views/message_send.ejs b/views/message_send.ejs index 4dafa3a..cea21e3 100644 --- a/views/message_send.ejs +++ b/views/message_send.ejs @@ -1,4 +1,4 @@ -<%- include('header', { title: "Send Message" }) %> +<%- include('header', { title: "Send Message" }) -%> diff --git a/views/profile.ejs b/views/profile.ejs index a001e21..a4a23fc 100644 --- a/views/profile.ejs +++ b/views/profile.ejs @@ -1,5 +1,5 @@ -<%- 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) }) -%> +

Welcome, <%= user.name %>!

@@ -8,13 +8,11 @@ Your mail address is <%= user.mail %>.

» -<% - if (user.notify) { - %>Disable mail notifications<% - } else { - %>Enable mail notifications<% - } -%> +<% if (user.notify) { %> +Disable mail notifications +<% } else { %> +Enable mail notifications +<% } %>
» Change password, @@ -26,79 +24,79 @@ or profile text.
» Logout -<%_ if (open_games.length > 0) { _%> +<% if (open_games.length > 0) { %>

Open Games

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

Active Games

- + +<% active_games.forEach((row) => { %> -
IDGameScenarioOptionsPlayersDescriptionChangedTurn -<%_ active_games.forEach((row) => { _%> +
IDGameScenarioPlayersDescriptionChangedTurn +
<%= row.game_id %> -<%= row.title_name %> -<%= row.scenario %> -<%- row.options %> -<%- row.player_names %> -<%= row.description %> -<%= row.mtime %> -<%_ - if (row.is_active) { - %><%= row.active %><% - } else { - %><%= row.active %><% - } - if (row.is_shared) { - %>Play<% - } else { - %>Play<% - } -_%> -<%_ }); _%> +<%= row.game_id %> +<%= row.title_name %> +<%= row.scenario %> +<%- row.player_names %> +<%= row.description %> +<%= row.mtime %> +<% if (row.is_active) { %> +<%= row.active %> +<% } else { %> +<%= row.active %> +<% } %> +<% if (row.is_shared) { %> +Play +<% } else { %> +Play +<% } %> +<% }); %>
-<%_ } _%> +<% } %> -<%_ if (finished_games.length > 0) { _%> +<% if (finished_games.length > 0) { %>

Finished Games

- -
IDGameScenarioOptionsPlayersDescriptionFinishedResult -<%_ finished_games.forEach((row) => { _%> + + + +<% finished_games.forEach((row) => { %> -
IDGameScenarioPlayersDescriptionFinishedResult +
<%= row.game_id %> -<%= row.title_name %> -<%= row.scenario %> -<%- row.options %> -<%- row.player_names %> -<%= row.description %> -<%= row.mtime %> -<%= row.result %> -<%_ - if (row.is_shared) { - %>View<% - } else { - %>View<% - } -_%> -<%_ }); _%> +<%= row.game_id %> +<%= row.title_name %> +<%= row.scenario %> +<%- row.player_names %> +<%= row.description %> +<%= row.mtime %> +<%= row.result %> +<% if (row.is_shared) { %> +View +<% } else { %> +View +<% } %> +<% }); %>
-<%_ } _%> +<% } %> -<%_ 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) { %>

You don't have any current or finished games. -<%_ } _%> +<% } %> -- cgit v1.2.3