Add a form for creating / joining sessions.

This commit is contained in:
2018-05-25 23:01:55 -07:00
parent 489fc61e55
commit 3ee9274f49
4 changed files with 176 additions and 5 deletions

View File

@@ -33,7 +33,7 @@ def handle_message(id, game, socket, message)
end
get "/" do |env|
"Hello!"
render "src/Go/views/index.ecr", "src/Go/views/base.ecr"
end
get "/game/:id" do |env|

29
src/Go/views/index.ecr Normal file
View File

@@ -0,0 +1,29 @@
<div class="split-wrapper">
<div class="split-item">
<h2>Create Game</h2>
<form autocomplete="off" id="create-form" action="/create">
<input required placeholder="Session Name" type="text" name="id"></input>
<input required placeholder="Your Password" type="text" name="your-password"></input>
<input required placeholder="Their Password" type="text" name="their-password"></input>
<div class="radio-parent">
<div class="radio-wrapper">
<input type="radio" name="color" id="radio-black" value="black" checked></input>
<label for="radio-black">Black</label>
</div>
<div class="radio-wrapper">
<input type="radio" name="color" id="radio-white" value="white"></input>
<label for="radio-white">White</label>
</div>
</div>
<input type="submit" value="Create Game"></input>
</form>
</div>
<div class="split-item">
<h2>Join Game</h2>
<form autocomplete="off" id="join-form" action="/game">
<input required placeholder="Session Name" type="text" name="id"></input>
<input required placeholder="Your Password" type="text" name="password"></input>
<input type="submit" value="Join Game"></input>
</form>
</div>
</div>