summaryrefslogtreecommitdiff
path: root/views/head.pug
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-06-14 20:40:25 +0200
committerTor Andersson <tor@ccxvii.net>2022-06-14 21:09:48 +0200
commit06f757c23d0d9f7a2b86f6c828f886ee8e642e03 (patch)
tree56771af9be14e393e2753a70c7080f5558e28014 /views/head.pug
parentae02f4cde98879b6fddc12c87c4fd3c5663d493e (diff)
downloadserver-06f757c23d0d9f7a2b86f6c828f886ee8e642e03.tar.gz
Clean up game list logic.
Diffstat (limited to 'views/head.pug')
-rw-r--r--views/head.pug32
1 files changed, 21 insertions, 11 deletions
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