Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allows for a small amount of dynamism: * sencha app scripts are loaded automatically from public/app directories * XTemplates are stored as individual files in templates/ * App.domain is set based on environment
- Loading branch information
Showing
6 changed files
with
96 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'rubygems' | ||
require 'sinatra' | ||
|
||
helpers do | ||
def templates | ||
Dir.glob("templates/**").map do |template| | ||
name = File.basename(template, ".html") | ||
content = open(template).read | ||
"<textarea id='#{name}' class='x-hidden-display'>#{content}</textarea>" | ||
end.join("\n") | ||
end | ||
|
||
def sencha_app_scripts | ||
sources = ["public/app/routes.js", "public/app/app.js"] | ||
|
||
sources << "public/config/#{Sinatra::Application.environment}.js" | ||
|
||
%w{models stores views controllers}.each do |layer| | ||
sources += Dir.glob("public/app/#{layer}/**") | ||
end | ||
|
||
sources.map do |file| | ||
source = file.sub('public/', '') | ||
"<script src='#{source}' type='text/javascript' charset='utf-8'></script>" | ||
end.join("\n") | ||
end | ||
end | ||
|
||
get '/' do | ||
erb :index | ||
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,2 @@ | ||
App.environment = "development" | ||
App.domain = "http://localhost:4567"; |
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,2 @@ | ||
App.environment = "production" | ||
App.domain = "http://all-sorts.org"; |
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,12 @@ | ||
<ul class="phrases"> | ||
<tpl for="."> | ||
<li> | ||
<span class="text"> | ||
{article} | ||
<a href="#collectors/{collector_slug}" class="collector">{collector}</a> | ||
of | ||
<a href="#nouns/{noun_slug}" class="noun">{noun}</a> | ||
</span> | ||
</li> | ||
</tpl> | ||
</ul> |
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,34 @@ | ||
<ol class="league"> | ||
<tpl for="."> | ||
<li> | ||
|
||
<p class="noun_phrase"> | ||
{article} | ||
<a href="#collectors/{collector_slug}" class="collector">{collector}</a> | ||
of | ||
<a href="#nouns/{noun_slug}" class="noun">{noun}</a> | ||
|
||
<span class="seed"> | ||
seeded by <a href="http://twitter.com/{seed.user_name}/status/{seed.tweet_id}" class="status_link">{seed.user_name}</a> | ||
</span> | ||
|
||
<tpl if="vote_count &gt; 1"> | ||
<span class="votes"> | ||
#{vote_count} votes | ||
</span> | ||
</tpl> | ||
</p> | ||
|
||
<tpl if="vote_count &gt; 1"> | ||
<ol> | ||
<tpl for="votes"> | ||
<li> | ||
<a href="http://twitter.com/{user_name}/status/{tweet_id}" class="status_link">{user_name}</a> | ||
</li> | ||
</tpl> | ||
</ol> | ||
</tpl> | ||
|
||
</li> | ||
</tpl> | ||
</ol> |
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,14 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>All Sorts</title> | ||
<link href="stylesheets/all-sorts-touch.css" rel="stylesheet" type="text/css" media="screen"/> | ||
<script src="javascripts/sencha-touch.js" type="text/javascript" charset="utf-8"></script> | ||
<%= sencha_app_scripts %> | ||
</head> | ||
<body> | ||
|
||
<%= templates %> | ||
|
||
</body> | ||
</html> |