diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-06-12 16:42:33 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-06-13 20:20:01 +0200 |
commit | 072766b71f9441fdd2796b8dd1137b90acd5a561 (patch) | |
tree | 27dce1ed3f835a964b8dcf1d5f976d2ac1b507e2 /views | |
parent | 8175df9f9af2393964f053af5a98851c376e1675 (diff) | |
download | server-072766b71f9441fdd2796b8dd1137b90acd5a561.tar.gz |
List playing and recently finished games on user pages.
Diffstat (limited to 'views')
-rw-r--r-- | views/games_active.pug | 11 | ||||
-rw-r--r-- | views/games_finished.pug | 7 | ||||
-rw-r--r-- | views/games_public.pug | 8 | ||||
-rw-r--r-- | views/head.pug | 15 | ||||
-rw-r--r-- | views/info.pug | 10 | ||||
-rw-r--r-- | views/user.pug | 10 |
6 files changed, 41 insertions, 20 deletions
diff --git a/views/games_active.pug b/views/games_active.pug index 16d8ceb..a72a203 100644 --- a/views/games_active.pug +++ b/views/games_active.pug @@ -13,24 +13,23 @@ html if ready_games.length > 0 h2 Ready to start - +gamelist(ready_games, "ready") + +gamelist(ready_games) if open_games.length > 0 h2 Open - +gamelist(open_games, "open") + +gamelist(open_games) if replacement_games.length > 0 h2 Need replacement - +gamelist(replacement_games, "replacement") + +gamelist(replacement_games) if active_games.length > 0 h2 Active - +gamelist(active_games, "active") - + +gamelist(active_games) if finished_games.length > 0 h2 Recently finished - +gamelist(finished_games, "finished") + +gamelist(finished_games) p <a href="/games/finished">All your finished games</a> diff --git a/views/games_finished.pug b/views/games_finished.pug index c6fa66d..df7f038 100644 --- a/views/games_finished.pug +++ b/views/games_finished.pug @@ -7,9 +7,12 @@ html body include header article - h1 Your finished games + if user && user.user_id === who.user_id + h1 Your finished games + else + h1 #{who.name}’s finished games if finished_games.length > 0 - +gamelist(finished_games, "finished") + +gamelist(finished_games) else p Nothing here. diff --git a/views/games_public.pug b/views/games_public.pug index a681419..9c56402 100644 --- a/views/games_public.pug +++ b/views/games_public.pug @@ -13,20 +13,20 @@ html h2 Open if open_games.length > 0 - +gamelist(open_games, "open") + +gamelist(open_games) else p No open games. if replacement_games.length > 0 h2 Need replacement - +gamelist(replacement_games, "replacement") + +gamelist(replacement_games) if ready_games.length > 0 h2 Ready to start - +gamelist(ready_games, "ready") + +gamelist(ready_games) h2 Active if active_games.length > 0 - +gamelist(active_games, "active") + +gamelist(active_games) else p No open games. diff --git a/views/head.pug b/views/head.pug index 911def4..748d417 100644 --- a/views/head.pug +++ b/views/head.pug @@ -34,11 +34,20 @@ mixin forumpost(row,show_buttons) | | #[a(href="/forum/reply/"+row.post_id) Reply] -mixin gamelist(list,status,hide_title=0) - div.game_list(class=status) +mixin gamelist(list,hide_title=0) + div.game_list each item in list div - div.game_item(class=item.your_turn ? "your_turn" : "") + - + let className = "game_item" + if (item.your_turn) className += " your_turn" + if (item.status === 0 && !item.is_ready) className += " open" + else if (item.status === 0 && item.is_ready) className += " ready" + else if (item.status === 1 && !item.is_ready) className += " replacement" + else if (item.status === 1 && item.is_ready) className += " active" + else if (item.status === 2) className += " finished" + + div(class=className) div.game_head if item.scenario.length <= 2 div diff --git a/views/info.pug b/views/info.pug index c7083ef..24425e5 100644 --- a/views/info.pug +++ b/views/info.pug @@ -21,25 +21,25 @@ html h2 Open if open_games.length > 0 - +gamelist(open_games, "open", true) + +gamelist(open_games, true) else p No open games. if replacement_games.length > 0 h2 Need replacement - +gamelist(replacement_games, "replacement", true) + +gamelist(replacement_games, true) p a(href="/create/"+title.title_id) Create a new game if ready_games.length > 0 h2 Ready to start - +gamelist(ready_games, "ready", true) + +gamelist(ready_games, true) if active_games.length > 0 h2 Active - +gamelist(active_games, "active", true) + +gamelist(active_games, true) if finished_games.length > 0 h2 Recently finished - +gamelist(finished_games, "finished", true) + +gamelist(finished_games, true) diff --git a/views/user.pug b/views/user.pug index 99420cc..73c2e2d 100644 --- a/views/user.pug +++ b/views/user.pug @@ -21,3 +21,13 @@ html if user p a(href="/message/send/"+who.name) Send message + + if active_games.length > 0 + h2 Playing + +gamelist(active_games) + + if finished_games.length > 0 + h2 Recently finished + +gamelist(finished_games) + + p <a href="/games/finished/#{who.name}">All #{who.name}'s finished games</a> |