Permalink
Browse files

rendering basics working

  • Loading branch information...
1 parent f3ef0a2 commit 493bfd6528135eff89b70dd1f4f2341a5a4c2899 @ratbeard committed May 5, 2009
Showing with 20 additions and 5 deletions.
  1. +3 −0 config.ru
  2. +17 −5 lib/login_app.rb
View
@@ -1,11 +1,14 @@
pwd = File.dirname(__FILE__)
+##
$:.unshift "#{pwd}/vendor/sinatra/lib"
require 'sinatra'
$:.unshift "#{pwd}/vendor/warden/lib"
require 'warden'
+##
+require 'haml'
##
$:.unshift "#{pwd}/lib"
View
@@ -1,15 +1,18 @@
-class LoginManager < Sinatra::Base
+class LoginManager < Sinatra::Default
+ use_in_file_templates!
+
get "/" do
- view :welcome
+ # render :welcome
+ "hi"
end
post '/unauthenticated/?' do
status 401
- view :login
+ haml :login
end
get '/login/?' do
- view :login
+ haml :login
end
post '/login/?' do
@@ -21,4 +24,13 @@ class LoginManager < Sinatra::Base
env['warden'].logout
redirect '/'
end
-end
+end
+
+
+__END__
+@@layout
+%h1 Title
+= yield
+
+@@login
+please login

0 comments on commit 493bfd6

Please sign in to comment.