forked from defunkt/mustache-sinatra-example
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require 'sinatra/base' | ||
require 'mustache/sinatra' | ||
|
||
class App < Sinatra::Base | ||
register Mustache::Sinatra | ||
|
||
set :views, 'templates/' | ||
set :mustaches, 'views/' | ||
|
||
get '/' do | ||
mustache :index | ||
end | ||
|
||
get '/other' do | ||
mustache :other | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require 'app' | ||
|
||
use Rack::ShowExceptions | ||
|
||
run App.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<h1>{{title}}</h1> | ||
|
||
<p>{{content}}</p> | ||
|
||
<a href="/other">The Other Page</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title> | ||
Trust the Stache | ||
</title> | ||
<link href='http://ajax.googleapis.com/ajax/libs/yui/2.7.0/build/reset-fonts-grids/reset-fonts-grids.css' media='screen' rel='stylesheet'/> | ||
<link href='http://ajax.googleapis.com/ajax/libs/yui/2.7.0/build/base/base-min.css' media='screen' rel='stylesheet'/> | ||
<link href='/styles.css' media='screen' rel='stylesheet'/> | ||
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'></script> | ||
<script src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js'></script> | ||
</head> | ||
<body> | ||
<div id="main"> | ||
{{{yield}}} | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<style> | ||
pre { text-align: left } | ||
</style> | ||
|
||
<pre>{{ascii_art}}</pre> | ||
|
||
<a href="/">Home</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class App | ||
module Views | ||
class Index < Mustache | ||
def title | ||
"The Index" | ||
end | ||
|
||
def content | ||
"Welcome! Mustache lives." | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
class App | ||
module Views | ||
class Other < Mustache | ||
def ascii_art | ||
<<-end_art | ||
.................... | ||
.................... | ||
.............:~I7777777777+. .,I7777777777I:. | ||
.............778OOOOOOOOO88= ..IOOOOOOOOOOOO++ | ||
.............77OOOOOOOOOOOOO,, ~=8OOOOOOOOOOO8++ | ||
.............778OOOOOOOOOOOOII.. .ZZOOOOOOOOOOOOO++ | ||
.............77OOOOOOOOOOOOOO8$. .:O8OOOOOOOOOOOOO8++ | ||
.77OOOOOOOOOOOOO88O+. ..788OOOOOOOOOOOOO8++....... | ||
.778OOOOOOOOOOOOOO8O, .=OOOOOOOOOOOOOOOO8++....... | ||
.77OOOOOOOOOOOOOOOOO7. .,ZOOOOOOOOOOOOOOOOO++....... | ||
.77OOOOOOOOOOOOOOOOOOZ$.. :OZOOOOOOOOOOOOOOOOOO++....... | ||
.778OOOOOOOOOOOOOOOOOOO?.... .$OOOOOOOOOOOOOOOOOOOO++....... | ||
.77OOOOOOOOOOOOOOOOOOOOO: ...=O8OOOOOOOOOOOOOOOOOO8++....... | ||
.77OOOOOOOO8OOOOOOOOOOOO$...,OOOOOOOOOOO8OOOOOOOOO8++....... | ||
.778OOOOOOO8OO:OOOOOOOOOOO==OOOOOOOOOOZ:OOOOOOOOOO8++....... | ||
.778OOOOOOOOO8.IOOOOOOOO8O8OOOOOOOOOOO=:O8OOOOOOOO8++....... | ||
.778OOOOOOOOO8.:OOOOOOOOOOOOOOOOOOOO$$.:OOOOOOOOOOO++....... | ||
.77OOOOOOOOOO8..??OOOOOOOOOOOOOOOOOO~:.:OOOOOOOOOO8++....... | ||
.77OOOOOOOOOO8....+OOOOOOOOOOOOOOOO:...:OOOOOOOOOO8++....... | ||
.77OOOOOOOOOO8.....OOOOOOOOOOOOOOOI....:O8OOOOOOOOO++....... | ||
.778OOOOOOOOO8.....=OOOOOOOOOOOOOO:. :OOOOOOOOOO8++ | ||
.77OOOOOOOOOO8......$88OOOOOOOOO8I :O8OOOOOOOO8++ | ||
.778OOOOOOOOO8.......$$OOOOOOOO??. :OOOOOOOOOOO++ | ||
.77OOOOOOOOOO8...... ~:OOOOOOOO,, :OOOOOOOOOOO++ | ||
.77O8OOOOOOOO8.........7O8OOOO+. :OOOOOOOOOO8++ | ||
.~~7777777777+.........,77777I. .... .?7777777777:, | ||
. . ......=$OOOOOOO$=....~?7$$$$77+, .. . | ||
....,7OOOOOOOOO8O=..=OOO88O88OOZ:... | ||
..:ZZOOOOOOOOOOOOZ,,OOOOOOOOOOO8O=+. | ||
...=8OOOOOOOOOOOOOOO++OOOOOOOOOOOOOOOI,.. | ||
.,$$8OOOOOOOOOOOOOOOOO$$OOOOOOOOOOOOOOOO8O== | ||
..~O8OOOOOOOOOOOOOOOOO8O$$OOOOOOOOOOOOOOOOOOOO?.. | ||
...?OOOOOOOOOOOOOOOOOOOOOO++OOOOOOOOOOOOOOOOOOOOO$,.. | ||
...,$$OOOOOOOOOOOOOOOOOOOO887:,OOOOOOOOOOOOOOOOOOOOOOO~=.. | ||
:77III7$O8O8OOOOOOOOOOOOOOOOOOOO87,....+8OOOOOOOOOOOOOOOOOOOOOO8OI======+. | ||
.$$8OOOOOOOOOOOOOOOOOOOOOOOO8OO++..... .~ZZOOOOOOOOOOOOOOOOOOOOOOOOOOOO$7. | ||
,,$8OOOOOOOOOOOOOOOOOO8O888O$: ...... ,,I8888OOOOOOOOOOOOOOOOOO88O8$,, | ||
.=$OOOOOOOOO8OOOO8O88OZ7I~......... ..~IOZOO8OOOOOOOOO8O88O8O8O?. | ||
...,,,,,.................... ..,~======~~,. | ||
.................... | ||
end_art | ||
end | ||
end | ||
end | ||
end |