2011-06-24 13:28:19 +02:00
|
|
|
class Blog < Sinatra::Base
|
2011-06-24 14:29:59 +02:00
|
|
|
set $settings
|
2011-06-26 08:45:33 +02:00
|
|
|
register Sinatra::CompassSupport
|
2011-06-24 14:29:59 +02:00
|
|
|
|
2011-06-24 13:28:19 +02:00
|
|
|
get '/' do
|
2011-06-24 15:40:37 +02:00
|
|
|
@posts = Post.all(:released => true, :order => [:written.desc])
|
|
|
|
haml :index
|
|
|
|
end
|
|
|
|
|
|
|
|
get '/stylesheet.css' do
|
|
|
|
scss :stylesheet
|
2011-06-24 13:28:19 +02:00
|
|
|
end
|
2011-06-24 14:21:02 +02:00
|
|
|
|
|
|
|
get '/404' do
|
|
|
|
404
|
|
|
|
end
|
|
|
|
|
|
|
|
error 404 do
|
|
|
|
'where am i? is somebody here? hello?'
|
|
|
|
end
|
|
|
|
|
|
|
|
get '/502' do
|
|
|
|
502
|
|
|
|
end
|
|
|
|
|
|
|
|
error 502 do
|
|
|
|
'oh no, i think i wet myself'
|
|
|
|
end
|
2011-06-24 15:40:37 +02:00
|
|
|
|
|
|
|
def link_to display, link
|
|
|
|
"<a href=\"${link}\">#{display}</a>"
|
|
|
|
end
|
2011-06-30 21:16:10 +02:00
|
|
|
|
|
|
|
def markup content, markup
|
|
|
|
markup= markup.to_sym
|
|
|
|
if respond_to? markup
|
|
|
|
send markup, content
|
|
|
|
else
|
|
|
|
content
|
|
|
|
end
|
|
|
|
end
|
2011-06-24 13:28:19 +02:00
|
|
|
end
|