diff options
Diffstat (limited to 'views')
-rw-r--r-- | views/create.ejs | 12 | ||||
-rw-r--r-- | views/join.ejs | 12 |
2 files changed, 18 insertions, 6 deletions
diff --git a/views/create.ejs b/views/create.ejs index b995639..74f9276 100644 --- a/views/create.ejs +++ b/views/create.ejs @@ -4,7 +4,7 @@ <form action="/create/<%= title.title_id %>" method="post"> <p> Scenario:<br> -<select id="scenario" name="scenario"> +<select name="scenario"> <% scenarios.forEach((scenario) => { %> <option value="<%= scenario %>"><%= scenario %></option> <% }); %> @@ -12,16 +12,16 @@ Scenario:<br> <%- include('../public/' + title.title_id + '/create.html') %> <p> Description:<br> -<input type="text" autocomplete="off" id="description" name="description" size="50"> +<input type="text" autocomplete="off" name="description" size="50"> <p> <label> -<input type="checkbox" id="random" name="random" value="random"> -<span>Random player roles</span> +<input type="checkbox" name="random" value="true"> +Random player roles </label> <p> <label> -<input type="checkbox" id="private" name="private" value="private"> -<span>Private</span> +<input type="checkbox" name="private" value="true"> +Private </label> <p> <button type="submit">Create</button> 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> |