From a1fe768c6d40c7c885db1c9843c61527cbe583e3 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 20 Nov 2021 19:47:08 +0100 Subject: Rewrite view templates to use Pug engine. --- views/head.pug | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 views/head.pug (limited to 'views/head.pug') 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. -- cgit v1.2.3