-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.rb
103 lines (82 loc) · 1.8 KB
/
app.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
require 'sinatra'
require 'haml'
require 'sass'
require 'yaml'
require 'sinatra/jsonp'
configure do
set :html, :format => 'html5'
set :sass, :views => 'sass'
end
configure :production do
set :sass, :style => :compressed
end
configure :development do
set :sass, :debug_info => true
end
helpers do
def partial(template, *args)
template_array = template.to_s.split('/')
template = template_array[0..-2].join('/') + "/_#{template_array[-1]}"
options = args.last.is_a?(Hash) ? args.pop : {}
options.merge!(:layout => false)
haml(:"#{template}", options)
end
def sponsors
YAML::load( File.open("sponsors.yml") ).shuffle
end
end
before do
if request.host.start_with? "www."
url = request.scheme + "://"
url << request.host.sub(/^www\./, "")
redirect to(url), 301
end
end
get '/' do
haml :index
end
get '/faq' do
haml :faq, :layout => true
end
get '/sponse' do
haml :sponse, :layout => true
end
get '/tema' do
haml :tema, :layout => true
end
get '/policy' do
haml :policy, :layout => true
end
get '/keynote/risk_and_decision' do
haml :"keynote/risk_and_decision", :layout => true
end
get '/keynote/lean_startup' do
haml :"/keynote/lean_startup", :layout => true
end
get '/open_space' do
haml :"open_space", :layout => true
end
get '/aarsmote' do
haml :"aarsmote", :layout => true
end
get '/sponsors' do
data = haml :sponsors, :layout => false
JSONP data
end
get '/stylesheet' do
sass :stylesheet
end
get '/profilering' do
haml :profilering, :layout => true
end
get '/*.css' do
content_type 'text/css', :charset => 'utf-8'
sass params[:splat].join.to_sym
end
#Redirects...
get '/program' do
redirect "http://participate.smidig2012.no/program"
end
get '/program/workshop' do
redirect "http://participate.smidig2012.no/program/workshop"
end