-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpneumatique.rb
76 lines (59 loc) · 1.14 KB
/
pneumatique.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
require 'rubygems'
require 'active_record'
require 'sinatra'
require 'rack-flash'
set :root, File.dirname(__FILE__)
set :public, File.dirname(__FILE__)+"/public"
use Rack::Session::Cookie
use Rack::Flash
ActiveRecord::Base.establish_connection(
:adapter => 'sqlite3',
:database => 'pneumatique.sqlite3.db'
)
class Email < ActiveRecord::Base
end
get '/' do
@rand = rand(16)
erb :index
end
get '/en' do
@rand = rand(16)
erb :en_index
end
get '/download' do
erb :download_index
end
get '/club-event' do
erb :club_event
end
get '/laserdisko-event' do
erb :laserdisko_event
end
get '/alternight-event' do
erb :alternight_event
end
get '/adrenalin-event' do
erb :adrenalin_event
end
get '/adrenalin-club' do
erb :adrenalin_club
end
get '/alternight-club' do
erb :alternight_club
end
get '/laserdisko-club' do
erb :laserdisko_club
end
get '/pe-club' do
erb :pe_club
end
post '/email' do
puts params.inspect
email = Email.new(:email => params["email"])
if email.save && email.errors.empty?
flash[:notice] = "Email added. Thanks!"
else
flash[:error] = "Could not add your email? Try again!"
end
redirect '/'
end