blob: 34baf84bf3b681b3cad2ae5a819b1016c2fc157e (
plain) (
tree)
|
|
require 'sinatra/base'
require 'sinatra/url_for'
require 'tilt/erb'
require_relative 'lib/registration'
require_relative 'lib/config'
class RegistrationApp < Sinatra::Base
helpers Sinatra::UrlForHelper
include ERB::Util
enable :sessions
get '/' do
@config = Config.load
@band = Band.new
3.times { @band.songs << Song.new }
erb :index
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
|