summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/registration.rb4
-rw-r--r--registration.rb5
-rw-r--r--views/registration_email.erb7
3 files changed, 12 insertions, 4 deletions
diff --git a/lib/registration.rb b/lib/registration.rb
index e576cb0..9053ade 100644
--- a/lib/registration.rb
+++ b/lib/registration.rb
@@ -2,13 +2,13 @@ require_relative 'band'
require_relative 'pdf_form'
require 'mail'
-def send_registration_emails_for(band)
+def send_registration_emails_for(band, pdf_url)
mail = Mail.new
mail.charset = 'UTF-8'
mail.to = 'haraldei@anduin.net'
mail.from = @band.contact.email
mail.subject = "Registrering av band #{@band.name} til Norsk Urskog"
- mail.body = 'NeijassÄdu!'
+ mail.body = erb :registration_email, :layout => false, :locals => { :pdf_url => pdf_url }
if settings.environment != :test && settings.smtp
mail.delivery_method :smtp, :address => settings.smtp['address'], :port => settings.smtp['port']
diff --git a/registration.rb b/registration.rb
index ac1a362..fe0ce40 100644
--- a/registration.rb
+++ b/registration.rb
@@ -21,8 +21,9 @@ class RegistrationApp < Sinatra::Base
if request.form_data?
@band = Band.new(request['band'])
if @band.valid?
- generate_pdf_for(@band, File.join(settings.public_folder, "uploads", create_pdf_file_name(@band)))
- send_registration_emails_for @band
+ pdf_file = File.join("uploads", create_pdf_file_name(@band))
+ generate_pdf_for(@band, File.join(settings.public_folder, pdf_file))
+ send_registration_emails_for(@band, url_for(pdf_file))
erb :submitted
else
erb :index
diff --git a/views/registration_email.erb b/views/registration_email.erb
new file mode 100644
index 0000000..ecab388
--- /dev/null
+++ b/views/registration_email.erb
@@ -0,0 +1,7 @@
+PĂ„melding til Norsk Urskog 2016 for <%= @band.name %>
+
+Registreringsskjema: <%= pdf_url %>
+
+Vennlig hilsen,
+Harald Eilertsen
+Norsk Urskog