From 007b4d1ce6c868bb2ea631b00839c2a4dce7906e Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 24 Jul 2022 12:27:25 +0200 Subject: Add "create game" index page. --- server.js | 4 ++++ views/create-index.pug | 16 ++++++++++++++++ views/games_active.pug | 3 +++ views/games_public.pug | 3 +++ views/index.pug | 1 - 5 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 views/create-index.pug diff --git a/server.js b/server.js index e852a61..feb06ca 100644 --- a/server.js +++ b/server.js @@ -359,6 +359,10 @@ app.get('/', function (req, res) { res.render('index.pug', { user: req.user, titles: TITLES }) }) +app.get('/create', must_be_logged_in, function (req, res) { + res.render('create-index.pug', { user: req.user, titles: TITLES }) +}) + app.get('/about', function (req, res) { res.render('about.pug', { user: req.user }) }) diff --git a/views/create-index.pug b/views/create-index.pug new file mode 100644 index 0000000..6c45961 --- /dev/null +++ b/views/create-index.pug @@ -0,0 +1,16 @@ +//- vim:ts=4:sw=4: +doctype html +html + head + include head + title= SITE_NAME + body + include header + article + h1 Create a new game + + ul + each title in titles + unless title.is_hidden + li + a(href="/create/"+title.title_id)= title.title_name diff --git a/views/games_active.pug b/views/games_active.pug index 66ee86c..9e4b909 100644 --- a/views/games_active.pug +++ b/views/games_active.pug @@ -18,6 +18,9 @@ html h2 Open +gamelist(open_games) + p + a(href="/create") Create a new game + if active_games.length > 0 h2 Active +gamelist(active_games) diff --git a/views/games_public.pug b/views/games_public.pug index a3b1407..e1a5387 100644 --- a/views/games_public.pug +++ b/views/games_public.pug @@ -21,6 +21,9 @@ html else p No open games. + p + a(href="/create") Create a new game + if replacement_games.length > 0 h2 Need replacement +gamelist(replacement_games) diff --git a/views/index.pug b/views/index.pug index 1b9ef21..2be79e9 100644 --- a/views/index.pug +++ b/views/index.pug @@ -36,7 +36,6 @@ html div.list each title in titles unless title.is_hidden - - let cover = "/" + title.title_id + "/cover" div.item div +gamecover(title.title_id) -- cgit v1.2.3