From a629852f911928b92ae48ac9bd39eb496f3aa947 Mon Sep 17 00:00:00 2001 From: chrisbr Date: Wed, 17 Dec 2014 14:28:31 +0100 Subject: [PATCH] Fix email variables (close #569) --- app/models/email_settings.rb | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/app/models/email_settings.rb b/app/models/email_settings.rb index 58e3cbca..2bc444f1 100644 --- a/app/models/email_settings.rb +++ b/app/models/email_settings.rb @@ -19,18 +19,31 @@ class EmailSettings < ActiveRecord::Base 'conference' => conference.title, 'conference_start_date' => conference.start_date, 'conference_end_date' => conference.end_date, - 'venue' => conference.venue.name, - 'venue_address' => conference.venue.address, - 'registrationlink' => Rails.application.routes.url_helpers.new_conference_conference_registrations_url( + 'registrationlink' => Rails.application.routes.url_helpers.conference_conference_registrations_path( conference.short_title, host: CONFIG['url_for_emails']), 'conference_splash_link' => Rails.application.routes.url_helpers.conference_url( conference.short_title, host: CONFIG['url_for_emails']), - 'cfp_start_date' => conference.call_for_paper.start_date, - 'cfp_end_date' => conference.call_for_paper.end_date, + 'schedule_link' => Rails.application.routes.url_helpers.schedule_conference_url( conference.short_title, host: CONFIG['url_for_emails']) } + if conference.call_for_paper + h['cfp_start_date'] = conference.call_for_paper.start_date + h['cfp_end_date'] = conference.call_for_paper.end_date + else + h['cfp_start_date'] = 'Unknown' + h['cfp_end_date'] = 'Unknown' + end + + if conference.venue + h['venue'] = conference.venue.name + h['venue_address'] = conference.venue.address + else + h['venue'] = 'Unknown' + h['venue_address'] = 'Unknown' + end + if conference.registration_period h['registration_start_date'] = conference.registration_period.start_date h['registration_end_date'] = conference.registration_period.end_date