summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
Diffstat (limited to 'views')
-rw-r--r--views/games_active.pug20
-rw-r--r--views/games_finished.pug4
-rw-r--r--views/games_public.pug6
-rw-r--r--views/head.pug32
-rw-r--r--views/info.pug5
-rw-r--r--views/user.pug9
6 files changed, 49 insertions, 27 deletions
diff --git a/views/games_active.pug b/views/games_active.pug
index a72a203..66ee86c 100644
--- a/views/games_active.pug
+++ b/views/games_active.pug
@@ -1,28 +1,23 @@
//- vim:ts=4:sw=4:
+- let open_games = games.filter(game => game.status === 0)
+- let active_games = games.filter(game => game.status === 1)
+- let finished_games = games.filter(game => game.status === 2)
doctype html
html
head
include head
title= SITE_NAME
if active_games.length > 0
- meta(http-equiv="refresh" content=300)
+ meta(http-equiv="refresh" content=600)
body
include header
article
h1 Your games
- if ready_games.length > 0
- h2 Ready to start
- +gamelist(ready_games)
-
if open_games.length > 0
h2 Open
+gamelist(open_games)
- if replacement_games.length > 0
- h2 Need replacement
- +gamelist(replacement_games)
-
if active_games.length > 0
h2 Active
+gamelist(active_games)
@@ -31,7 +26,8 @@ html
h2 Recently finished
+gamelist(finished_games)
- p <a href="/games/finished">All your finished games</a>
-
- if open_games.length === 0 && ready_games.length === 0 && active_games.length === 0 && finished_games.length === 0
+ if open_games.length === 0 && active_games.length === 0 && finished_games.length === 0
p Nothing here.
+
+ p
+ a(href="/games/finished") All your finished games
diff --git a/views/games_finished.pug b/views/games_finished.pug
index df7f038..26d0378 100644
--- a/views/games_finished.pug
+++ b/views/games_finished.pug
@@ -12,7 +12,7 @@ html
else
h1 #{who.name}&rsquo;s finished games
- if finished_games.length > 0
- +gamelist(finished_games)
+ if games.length > 0
+ +gamelist(games)
else
p Nothing here.
diff --git a/views/games_public.pug b/views/games_public.pug
index 44b250d..a3b1407 100644
--- a/views/games_public.pug
+++ b/views/games_public.pug
@@ -1,11 +1,15 @@
//- vim:ts=4:sw=4:
+- let open_games = games.filter(game => game.status === 0 && !game.is_ready)
+- let ready_games = games.filter(game => game.status === 0 && game.is_ready)
+- let replacement_games = games.filter(game => game.status === 1 && !game.is_ready)
+- let active_games = games.filter(game => game.status === 1 && game.is_ready)
doctype html
html
head
include head
title= SITE_NAME
if user
- meta(http-equiv="refresh" content=600)
+ meta(http-equiv="refresh" content=900)
body
include header
article
diff --git a/views/head.pug b/views/head.pug
index 748d417..005a4b2 100644
--- a/views/head.pug
+++ b/views/head.pug
@@ -59,18 +59,28 @@ mixin gamelist(list,hide_title=0)
| <a href="/join/#{item.game_id}">#{item.game_id}</a> &#x2013;
| <a href="/#{item.title_id}">#{item.title_name}</a>
- if item.status === 0 || !item.is_ready
- a(class="command" href=`/join/${item.game_id}`) Join
- else
- if item.is_yours
- - let verb = (item.status > 1) ? "Review" : "Play"
- if item.your_role
- a(class="command" href=`/${item.title_id}/play:${item.game_id}:${item.your_role}`)= verb
+ case item.status
+ when 0
+ if item.is_yours && item.is_ready
+ a(class="command" href=`/join/${item.game_id}`) Start
else
- a(class="command" href="/join/"+item.game_id)= verb
- else
- - let verb = (item.status > 1) ? "Review" : "View"
- a(class="command" href=`/${item.title_id}/play:${item.game_id}`)= verb
+ a(class="command" href=`/join/${item.game_id}`) Join
+ when 1
+ if item.is_yours
+ if item.your_role
+ a(class="command" href=`/${item.title_id}/play:${item.game_id}:${item.your_role}`) Play
+ else
+ a(class="command" href="/join/"+item.game_id) Play
+ else
+ a(class="command" href=`/${item.title_id}/play:${item.game_id}`) View
+ when 2
+ if item.is_yours
+ if item.your_role
+ a(class="command" href=`/${item.title_id}/play:${item.game_id}:${item.your_role}`) Review
+ else
+ a(class="command" href="/join/"+item.game_id) Review
+ else
+ a(class="command" href=`/${item.title_id}/play:${item.game_id}`) Review
div.game_main
div.game_info
diff --git a/views/info.pug b/views/info.pug
index 24425e5..62698c9 100644
--- a/views/info.pug
+++ b/views/info.pug
@@ -1,4 +1,9 @@
//- vim:ts=4:sw=4:
+- let open_games = games.filter(game => game.status === 0 && !game.is_ready)
+- let ready_games = games.filter(game => game.status === 0 && game.is_ready)
+- let replacement_games = games.filter(game => game.status === 1 && !game.is_ready)
+- let active_games = games.filter(game => game.status === 1 && game.is_ready)
+- let finished_games = games.filter(game => game.status === 2)
doctype html
html
head
diff --git a/views/user.pug b/views/user.pug
index 73c2e2d..fb98da7 100644
--- a/views/user.pug
+++ b/views/user.pug
@@ -1,4 +1,7 @@
//- vim:ts=4:sw=4:
+- let open_games = games.filter(game => game.status === 0)
+- let active_games = games.filter(game => game.status === 1)
+- let finished_games = games.filter(game => game.status === 2)
doctype html
html
head
@@ -22,8 +25,12 @@ html
p
a(href="/message/send/"+who.name) Send message
+ if open_games.length > 0
+ h2 Open
+ +gamelist(open_games)
+
if active_games.length > 0
- h2 Playing
+ h2 Active
+gamelist(active_games)
if finished_games.length > 0