Add Slim layout for views

master
Guillaume Dott 2014-12-05 17:27:23 +01:00
parent 6822f56f74
commit 5a399a106c
6 changed files with 38 additions and 22 deletions

View File

@ -1,6 +1,8 @@
source 'https://rubygems.org' source 'https://rubygems.org'
gem 'sinatra', '~> 1.4' gem 'sinatra', '~> 1.4'
gem 'sinatra-contrib'
gem 'slim' gem 'slim'
gem 'coffee-script' gem 'coffee-script'
gem 'therubyracer' gem 'therubyracer'

View File

@ -1,21 +1,32 @@
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
backports (3.6.4)
coffee-script (2.3.0) coffee-script (2.3.0)
coffee-script-source coffee-script-source
execjs execjs
coffee-script-source (1.8.0) coffee-script-source (1.8.0)
execjs (2.2.2) execjs (2.2.2)
libv8 (3.16.14.7) libv8 (3.16.14.7)
multi_json (1.10.1)
rack (1.5.2) rack (1.5.2)
rack-protection (1.5.3) rack-protection (1.5.3)
rack rack
rack-test (0.6.2)
rack (>= 1.0)
ref (1.0.5) ref (1.0.5)
sass (3.2.19) sass (3.2.19)
sinatra (1.4.5) sinatra (1.4.5)
rack (~> 1.4) rack (~> 1.4)
rack-protection (~> 1.4) rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4) tilt (~> 1.3, >= 1.3.4)
sinatra-contrib (1.4.2)
backports (>= 2.0)
multi_json
rack-protection
rack-test
sinatra (~> 1.4.0)
tilt (~> 1.3)
slim (2.1.0) slim (2.1.0)
temple (~> 0.6.9) temple (~> 0.6.9)
tilt (>= 1.3.3, < 2.1) tilt (>= 1.3.3, < 2.1)
@ -32,5 +43,6 @@ DEPENDENCIES
coffee-script coffee-script
sass sass
sinatra (~> 1.4) sinatra (~> 1.4)
sinatra-contrib
slim slim
therubyracer therubyracer

View File

@ -1,6 +1,8 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
require 'sinatra' require 'sinatra'
require 'sinatra/content_for'
require 'coffee-script' require 'coffee-script'
require 'slim' require 'slim'
require 'sass' require 'sass'

View File

@ -1,5 +1 @@
doctype html
html
head
body
h1 Hello world! h1 Hello world!

10
views/layout.slim 100644
View File

@ -0,0 +1,10 @@
doctype html
html
head
title = yield_content :title
meta charset="utf-8"
meta name="viewport" content="initial-scale=1.0, user-scalable=yes"
link rel="stylesheet" media="all" href="/application.css"
body
== yield

View File

@ -1,15 +1,9 @@
doctype html - content_for(:title) { 'Nurikabe' }
html
head
title Nurikabe
meta charset="utf-8"
meta name="viewport" content="initial-scale=1.0, user-scalable=yes"
link rel="stylesheet" media="all" href="/application.css"
script type="text/javascript" src="/nurikabe.js"
body
h1 Nurikabe h1 Nurikabe
#board #board
script type="text/javascript" src="/nurikabe.js"
javascript: javascript:
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
var game = JSON.parse("[[4,-1,-1,0,2],[0,-1,2,-1,-1],[0,-1,0,-1,3],[0,-1,-1,-1,0],[-1,-1,1,-1,0]]"); var game = JSON.parse("[[4,-1,-1,0,2],[0,-1,2,-1,-1],[0,-1,0,-1,3],[0,-1,-1,-1,0],[-1,-1,1,-1,0]]");