-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.rb
92 lines (73 loc) · 1.89 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
require 'sinatra'
require 'haml'
require 'sass'
require 'compass'
configure do
Compass.configuration do |config|
config.project_path = File.dirname(__FILE__)
config.sass_dir = 'stylesheets'
end
set :haml, { :format => :html5 }
set :sass, Compass.sass_engine_options
set :markdown, { :layout_engine => :haml }
end
helpers do
# This is the only way to get the sass helper to look in a directory
# other than `views` for the sass stylesheets
def sass(template, options={}, locals={})
options.merge! :views => "stylesheets"
super(template, options, locals)
end
end
get('/') { haml :index, :layout => :landing }
# About
get('/about/courses.?:format?') do
@title = "Courses"
markdown :'about/courses'
end
get('/about/admissions.?:format?') do
@title = "Admissions"
markdown :'about/admissions'
end
get('/about/calendar.?:format?') do
@title = "Calendar"
haml :'about/calendar'
end
get('/about/staff.?:format?') do
@title = "Staff"
markdown :'about/staff'
end
get('/about/history.?:format?') do
@title = "History"
markdown :'about/history'
end
get('/about/contact.?:format?') do
@title = "Contact Us"
markdown :'about/contact'
end
# Resources
get('/resources/learning_materials.?:format?') do
@title = "Learning Materials"
markdown :'resources/learning_materials'
end
get('/resources/core_projects.?:format?') do
@title = "Core Projects"
markdown :'resources/core_projects'
end
get('/resources/student_projects.?:format?') do
@title = "Student Projects"
markdown :'resources/student_projects'
end
get '/stylesheets/screen.css' do
content_type 'text/css', :charset => 'utf-8'
sass :screen
end
get '/stylesheets/landing.css' do
content_type 'text/css', :charset => 'utf-8'
sass :landing
end
get '/*' do
url = "http://school.mendicantuniversity.org"
url += "/#{params[:splat].first}" if params[:splat] && params[:splat].first
redirect url
end