-
Notifications
You must be signed in to change notification settings - Fork 10
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
2 changed files
with
11 additions
and
26 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 |
---|---|---|
@@ -1,33 +1,20 @@ | ||
# based on http://docs.angularjs.org/tutorial | ||
|
||
require 'wunderbar/sinatra' | ||
require 'wunderbar/angular/route' | ||
require 'wunderbar/angular/resource' | ||
require 'wunderbar/angularjs/route' | ||
require 'wunderbar/angularjs/resource' | ||
|
||
set :views, File.dirname(__FILE__) | ||
|
||
get '/' do | ||
_html :index | ||
_html :'views/index' | ||
end | ||
|
||
# allow path to override 'views' | ||
helpers do | ||
def find_template(view, name, engine, &block) | ||
view = Sinatra::Application.root unless File.dirname(name.to_s) == '.' | ||
super(view, name, engine, &block) | ||
get '/partials/:_name.html' do | ||
_html :"partials/#{params[:_name]}" | ||
end | ||
end | ||
|
||
# define routes to everything in the partials directory | ||
Dir['partials/*'].each do |partial| | ||
partial = partial.chomp(File.extname(partial)) | ||
get "/#{partial}.html" do | ||
_html partial.to_sym | ||
end | ||
get '/js/:_name.js' do | ||
_js :"js/#{params[:_name]}" | ||
end | ||
|
||
# define routes to everything in the js directory | ||
Dir['js/*'].each do |js| | ||
js = js.chomp(File.extname(js)) | ||
get "/#{js}.js" do | ||
_js js.to_sym | ||
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