diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-11-20 19:47:08 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2021-11-21 12:48:15 +0100 |
commit | a1fe768c6d40c7c885db1c9843c61527cbe583e3 (patch) | |
tree | c397e7d6796049607d6348c538621d1e8809a847 /views/head.pug | |
parent | d1318d147297161691f5048e1f2cb4e516159144 (diff) | |
download | server-a1fe768c6d40c7c885db1c9843c61527cbe583e3.tar.gz |
Rewrite view templates to use Pug engine.
Diffstat (limited to 'views/head.pug')
-rw-r--r-- | views/head.pug | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/views/head.pug b/views/head.pug new file mode 100644 index 0000000..ae6bf30 --- /dev/null +++ b/views/head.pug @@ -0,0 +1,67 @@ +//- vim:ts=4:sw=4: + +meta(name="viewport" content="width=device-width,height=device-height,initial-scale=1") +link(rel="icon" href="/favicon.svg") +link(rel="stylesheet" href="/fonts/fonts.css") +link(rel="stylesheet" href="/style.css") + +mixin gametable(status,table,hide_title=0) + table + tr + th ID + unless hide_title + th Title + th Scenario + th Players + th Description + case status + when 0 + th Created + when 1 + th Changed + th Turn + when 2 + th Finished + th Result + th + each row in table + tr + td= row.game_id + unless hide_title + td.w: a(href="/info/"+row.title_id)= row.title_name + td.w= row.scenario + td!= row.player_names + td= row.description + case status + when 0 + td.w= row.ctime + when 1 + td.w= row.mtime + if (row.is_active) + td.is_active= row.active + else + td= row.active + when 2 + td.w= row.mtime + td= row.result + td.command + if status === 0 + a(href="/join/"+row.game_id) Join + else + - let cmd = status === 1 ? "Play" : "View" + if row.is_yours + if row.is_shared + a(href="/join/"+row.game_id)= cmd + else + a(href=`/${row.title_id}/play:${row.game_id}:${row.your_role}`)= cmd + else + a(href=`/${row.title_id}/play:${row.game_id}`) View + else + tr + case status + when 0 + td(colspan=7-hide_title) No open games. + when 1 + td(colspan=8-hide_title) No active games. + when 2 + td(colspan=8-hide_title) No finished games. |