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 black = false
end 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 else
render_404 render_404
end 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> <div id="elm-root"></div>
<head> <script src="/js/Go.js"></script>
<style> <script>
.board-cell { var node = document.getElementById('elm-root')
display: inline-block; var app = Elm.Main.embed(node, {
background-color: #eaeaea; 'black' : <%= black %>,
padding: 20px; 'url' : "<%= "ws://" + URL + ":" + Kemal.config.port.to_s %>",
} 'id' : "<%= id %>",
.black-cell { 'size' : <%= size %>
background-color: black; })
} </script>
.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>