forked from picandocodigo/montevideo-bicis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.rb
66 lines (57 loc) · 1.18 KB
/
index.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
# coding: utf-8
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'sinatra'
require 'lib/dead_people'
YEARS = (2012..2019).to_a.reverse.freeze
get '/' do
haml :index, locals: {
current_page: 'home',
title: 'Inicio'
}
end
get '/accidentes' do
data = Hash[YEARS.collect { |year| [year, DeadPeople.new(year)] }]
haml :data, locals: {
data: data,
current_page: 'data',
title: 'Datos de accidentes de tránsito en bicicleta'
}
end
get '/leyes' do
haml :leyes, locals: {
current_page: 'leyes',
title: 'Leyes de tránsito y seguridad vial'
}
end
get '/leyes/:ley' do
ley = params[:ley]
haml :"leyes/#{ley}", layout: :layout, locals: {
current_page: 'leyes',
title: "Ley Nº #{params[:ley]}"
}
end
get '/enlaces' do
haml :enlaces, locals: {
current_page: 'enlaces',
title: 'Sitios de interés'
}
end
get '/acercade' do
haml :about, locals: {
current_page: 'about',
title: 'Acerca de'
}
end
get '/mapa' do
haml :map, locals: {
current_page: 'mapa',
title: 'Mapa de Montevideo'
}
end
not_found do
status 404
haml :error404, locals: {
current_page: '404',
title: 'Error 404 - Página no encontrada'
}
end