diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-06-14 20:40:25 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-06-14 21:09:48 +0200 |
commit | 06f757c23d0d9f7a2b86f6c828f886ee8e642e03 (patch) | |
tree | 56771af9be14e393e2753a70c7080f5558e28014 /views/head.pug | |
parent | ae02f4cde98879b6fddc12c87c4fd3c5663d493e (diff) | |
download | server-06f757c23d0d9f7a2b86f6c828f886ee8e642e03.tar.gz |
Clean up game list logic.
Diffstat (limited to 'views/head.pug')
-rw-r--r-- | views/head.pug | 32 |
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> – | <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 |