Add a base layout.

This commit is contained in:
Danila Fedorin 2018-05-25 15:35:55 -07:00
parent 75a386539e
commit e7b1144301
3 changed files with 24 additions and 34 deletions

View File

@ -50,7 +50,7 @@ get "/game/:id" do |env|
black = false
end
black.try { |black| render "src/Go/views/game.ecr"} || render_404
black.try { |black| render "src/Go/views/game.ecr", "src/Go/views/base.ecr"} || render_404
else
render_404
end

12
src/Go/views/base.ecr Normal file
View File

@ -0,0 +1,12 @@
<html>
<head>
<link rel="stylesheet" href="/css/main.css">
<link href="https://fonts.googleapis.com/css?family=Indie+Flower|Raleway" rel="stylesheet">
</head>
<body>
<div class="content-wrapper">
<h1>Go</h1>
<%= content %>
</div>
</body>
</html>

View File

@ -1,33 +1,11 @@
<html>
<head>
<style>
.board-cell {
display: inline-block;
background-color: #eaeaea;
padding: 20px;
}
.black-cell {
background-color: black;
}
.white-cell {
background-color: white;
}
.board {
max-width: 360px;
}
</style>
</head>
<body>
<div id="elm-root"></div>
<script src="/js/Go.js"></script>
<script>
var node = document.getElementById('elm-root')
var app = Elm.Main.embed(node, {
'black' : <%= black %>,
'url' : "<%= "ws://" + URL + ":" + Kemal.config.port.to_s %>",
'id' : "<%= id %>",
'size' : <%= size %>
})
</script>
</body>
</html>
<div id="elm-root"></div>
<script src="/js/Go.js"></script>
<script>
var node = document.getElementById('elm-root')
var app = Elm.Main.embed(node, {
'black' : <%= black %>,
'url' : "<%= "ws://" + URL + ":" + Kemal.config.port.to_s %>",
'id' : "<%= id %>",
'size' : <%= size %>
})
</script>