Add game list on index

master
Guillaume Dott 2014-12-08 12:32:01 +01:00
parent c94e19577f
commit e27e7a7caa
3 changed files with 41 additions and 3 deletions

View File

@ -7,11 +7,13 @@ require 'coffee-script'
require 'slim' require 'slim'
require 'sass' require 'sass'
GAMES = %i{nurikabe sudoku}
get('/application.css') { scss :application } get('/application.css') { scss :application }
get('/') { slim :index } get('/') { slim :index, locals: {games: GAMES} }
%i{nurikabe}.each do |game| GAMES.each do |game|
get("/#{game}") { slim game } get("/#{game}") { slim game }
get("/#{game}.js") { coffee game } get("/#{game}.js") { coffee game }
end end

View File

@ -4,12 +4,41 @@ body {
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
ul {
list-style-type: none;
padding: 0;
margin: 0;
li {
margin: 5px 0;
a {
background-color: #eee;
color: #000;
font-size: 1.2em;
border-radius: 3px;
padding: 15px 0;
text-decoration: none;
display: block;
width: 100%;
height: 100%;
&:hover {
background-color: #ccc;
}
}
}
}
#main { #main {
width: 500px; width: 500px;
margin: 0 auto; margin: 0 auto;
padding: 20px; padding: 20px;
text-align: center; text-align: center;
} }
.game-container { .game-container {
cursor: default; cursor: default;
font-weight: bold; font-weight: bold;

View File

@ -1 +1,8 @@
h1 Hello world! - content_for(:title) { 'Nikoli games' }
h1 Nikoli
ul
- games.each do |game|
li
a href="#{url("/#{game}")}" #{game.capitalize}