diff --git a/app/models/email_settings.rb b/app/models/email_settings.rb index 82d57fd6..b32c1486 100644 --- a/app/models/email_settings.rb +++ b/app/models/email_settings.rb @@ -3,6 +3,46 @@ class EmailSettings < ActiveRecord::Base :registration_email_template, :accepted_email_template, :rejected_email_template, :confirmed_email_template, :registration_subject, :accepted_subject, :rejected_subject, :confirmed_without_registration_subject + before_save :set_default + + def set_default + self.registration_subject = "Your Registration for {conference}" unless self.registration_subject + self.registration_email_template = "Dear {name},\n\n" + + "Thank you for Registering for the conference {conference}.\n\n" + + "Please complete your registration by filling out your travel information. If you are unable to attend please unregister online.\n" + + "{registrationlink}\n\n" + + "Feel free to contact us with any questions or concerns.\n\n" + + "We look forward to seeing you there.\n\n" + + "Best wishes\n\nOSEM Team" unless self.registration_email_template + + self.accepted_subject = "Your submission {eventtitle} has been accepted" unless self.accepted_subject + self.accepted_email_template = "Dear {name},\n\n" + + "We are very pleased to inform you that your submission {eventtitle} has been accepted for the conference {conference}.\n\n" + + "The public page of your submission can be found at:\n" + + "{proposalslink}\n\n" + + "If you havent already registered for {conference}, please do as soon as possible:\n" + + "{registrationlink}\n\n" + + "Feel free to contact us with any questions or concerns.\n\n" + + "We look forward to seeing you there.\n\n" + + "Best wishes\n\nOSEM Team" unless self.accepted_email_template + + self.rejected_subject = "Your submission {eventtitle} has been rejected" unless self.rejected_subject + self.rejected_email_template = "Dear {name},\n\n" + + "Thank you for your submission {eventtitle} for the conference {conference}." + + "After careful consideration we are sorry to inform you that your submission has been rejected.\n\n" + + "Best wishes\n\nOSEM Team" unless self.rejected_email_template + + self.confirmed_without_registration_subject = "Your submission {eventtitle} has been confirmed" unless self.confirmed_without_registration_subject + self.confirmed_email_template = "Dear {name},\n\n" + + "Thank you for the confirmation of {eventtitle}. " + + "Unfortunately you are not registered for the conference {conference}. " + + "Please register as soon as possible:" + + "{registrationlink}\n\n" + + "Feel free to contact us with any questions or concerns.\n\n" + + "We look forward to seeing you there.\n\n" + + "Best wishes\n\nOSEM Team" unless self.confirmed_email_template + end + def get_values(conference, person, event = nil) h = { "email" => person.email,