blob: 009406a54bf90d92bc2677e95a98e77172e0ee16 (
plain) (
tree)
|
|
require 'sinatra/base'
require 'sinatra/url_for'
require 'tilt/erb'
require_relative 'lib/registration'
class RegistrationApp < Sinatra::Base
helpers Sinatra::UrlForHelper
include ERB::Util
enable :sessions
get '/' do
@band = Band.new
3.times { @band.songs << Song.new }
erb :index
end
get '/member/new/:num' do
erb :member, :layout => false, :locals => { :member_number => params['num'], :member => Member.new }
end
get '/song/new/:num' do
erb :song, :layout => false, :locals => { :song_number => params['num'], :song => Song.new }
end
post '/submit' do
if request.form_data?
@band = Band.new(request['band'])
if @band.valid?
generate_pdf_for @band
send_registration_emails_for @band
erb :submitted
else
erb :index
end
end
end
run! if app_file == $0
end
|