From 80e3204596f9ab48a350a322e91d78b2a095cf33 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 7 Dec 2023 14:01:50 +0100 Subject: Add support for random scenario selection and scenario groupings. --- views/create.pug | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'views') diff --git a/views/create.pug b/views/create.pug index 717c4f0..7a8a6b8 100644 --- a/views/create.pug +++ b/views/create.pug @@ -14,14 +14,27 @@ html +gamecover(title.title_id) form(method="post" action="/create/"+title.title_id) - if scenarios.length > 1 + if Array.isArray(scenarios) + if scenarios.length > 1 + p Scenario: + br + select(name="scenario") + each scenario in scenarios + option(value=scenario)= scenario + else + input(type="hidden" name="scenario" value=scenarios[0]) + else p Scenario: br select(name="scenario") - each scenario in scenarios - option(value=scenario)= scenario - else - input(type="hidden" name="scenario" value=scenarios[0]) + each list, name in scenarios + if name === "" + each scenario in list + option(value=scenario)= scenario + else + optgroup(label=name) + each scenario in list + option(value=scenario)= scenario | !{ title.create_html } -- cgit v1.2.3