From 7777850fd868b6b24f64dcd6b5942cc6c4423c95 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 7 Nov 2021 18:47:37 +0100 Subject: Add options to game setup. --- views/join.ejs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'views/join.ejs') diff --git a/views/join.ejs b/views/join.ejs index 1d9347d..b9cf824 100644 --- a/views/join.ejs +++ b/views/join.ejs @@ -1,4 +1,14 @@ <%- include('header', { title: game.title_name }) -%> +<% +function to_english(k) { + if (k === true) return 'yes'; + if (k === false) return 'no'; + return k.replace(/_/g, " ").replace(/^\w/, c => c.toUpperCase()); +} +function format_options(options) { + return Object.entries(options||{}).map(([k,v]) => v === true ? to_english(k) : `${to_english(k)}=${to_english(v)}`).join(", "); +} +-%>