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
84 additions
and
3 deletions.
There are no files selected for viewing
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
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,21 @@ | ||
$:.unshift File.expand_path('../../../lib', __FILE__) | ||
|
||
require 'sinatra/base' | ||
require 'sequel' | ||
require 'sinatra/backbone' | ||
|
||
class App < Sinatra::Base | ||
enable :raise_errors, :logging | ||
enable :show_exceptions if development? | ||
|
||
register Sinatra::JstPages | ||
serve_jst '/jst.js' | ||
|
||
set :root, File.expand_path('../', __FILE__) | ||
set :views, File.expand_path('../views', __FILE__) | ||
set :public, File.expand_path('../public', __FILE__) | ||
|
||
get '/' do | ||
erb :home | ||
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,3 @@ | ||
require './app' | ||
App.set :run, false | ||
run App |
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,20 @@ | ||
// Here is our Backbone model! | ||
$(function() { | ||
do_test(); | ||
}); | ||
|
||
function do_test() { | ||
echo("<h3>Rendering from template:</h3>"); | ||
echo(JST['hello']({name: "Julie Kitzinger", age: "33"})); | ||
echo("<h3>Success!</h3>"); | ||
} | ||
|
||
// Helper functions | ||
function echo(html) { | ||
$("#messages").append(html); | ||
}; | ||
|
||
function onerror() { | ||
echo("<p class='error'>Oops... an error occured.</p>"); | ||
}; | ||
|
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,6 @@ | ||
<p>Hello, this is me:</p> | ||
|
||
<dl> | ||
<dt>Name:</dt><dd><%= name %></dd> | ||
<dt>Age:</dt><dd><%= age %></dd> | ||
</dl> |
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,25 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<title></title> | ||
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/1.6.2/jquery.min.js'></script> | ||
<script src='http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.1.7/underscore-min.js'></script> | ||
<script src='http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.5.3/backbone-min.js'></script> | ||
<style> | ||
body { font-family: sans-serif; font-size: 13px; line-height: 1.5; background: #d0d0da; } | ||
#messages { width: 400px; margin: 20px auto; background: white; padding: 20px; border: solid 10px #c0c0ca; } | ||
h3 { border-top: dotted 1px #ccc; padding: 20px 20px 0 20px; margin: 20px -20px 0 -20px; color: #46a; } | ||
h3:first-child { border-top: 0; margin-top: 0; padding-top: 0; } | ||
dl { overflow: hidden; } | ||
dt { float: left; width: 120px; margin-right: 10px; text-align: right; color: #aaa; } | ||
h3 { font-family: palatino; font-size: 1.3em; } | ||
</style> | ||
</head> | ||
<body> | ||
<div id="messages"> | ||
</div> | ||
<script src='jst.js'></script> | ||
<script src='app.js'></script> | ||
</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
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