diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-11-07 18:47:37 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2021-11-07 20:21:28 +0100 |
commit | 7777850fd868b6b24f64dcd6b5942cc6c4423c95 (patch) | |
tree | 726b848fff9226b9dbac4920046c6c8ccf72f355 /views/join.ejs | |
parent | 2fd3282e463f43b536facc5d6578acb5c3bbf95d (diff) | |
download | server-7777850fd868b6b24f64dcd6b5942cc6c4423c95.tar.gz |
Add options to game setup.
Diffstat (limited to 'views/join.ejs')
-rw-r--r-- | views/join.ejs | 12 |
1 files changed, 12 insertions, 0 deletions
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(", "); +} +-%> <style> th, td { min-width: 10em; font-size: 16px; } a.red { text-decoration: none; color: brown; font-size: 15px; } @@ -24,6 +34,8 @@ Private: <%= game.private ? "yes" : "no" %> <br> Scenario: <%= game.scenario %> <br> +Options: <%- format_options(JSON.parse(game.options)) %> +<br> Description: <%= game.description || "No description." %> <br> Status: <span id="game_status"></span> |