diff --git a/app/controllers/birthdays_controller.rb b/app/controllers/birthdays_controller.rb index 6f94739..35e6551 100644 --- a/app/controllers/birthdays_controller.rb +++ b/app/controllers/birthdays_controller.rb @@ -31,7 +31,7 @@ class BirthdaysController < ApplicationController unless birthdays.nil? birthdays_by_email = group_birthdays_by_email(birthdays) birthdays_by_email.each do |email, bdays| - UserMailer.next_weeks_birthday_notification(email, bdays, num_days).deliver + UserMailer.upcoming_birthdays_notification(email, bdays, num_days).deliver end end end diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index f0dec74..8fabcfb 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -1,22 +1,18 @@ -# -*- coding: iso-8859-1 -*- +# -*- coding: utf-8 -*- class UserMailer < ActionMailer::Base default :from => "info@contact-o-rama.com" + # obsolete def next_weeks_birthday_notification(email, birthdays) @birthday_contacts = birthdays - mail(:to => email, :subject => "Contact-o-Rama: Geburtstage in den nächsten 7 Tagen.") + mail(:to => email, :subject => "Contact-o-Rama: Geburtstage in den nächsten 7 Tagen.") end - def upcoming_birthdays_notification(email, birthdays_2days, birthdays_7days) - @birthday_contacts_2days = birthdays_2days - @birthday_contacts_2days = birthdays_7days + def upcoming_birthdays_notification(email, birthdays, num_days) + return if birthdays.blank? + + @birthday_contacts = birthdays + @num_days = num_days mail(:to => email, :subject => "Contact-o-Rama: anstehende Geburtstage") end - - # obsolete - # def next_weeks_birthday_notification(birthdays) - # logger.debug "----------------< we don't send no email, yet >----------------------" - # @birthday_contacts = birthdays - # mail(:to => "contact-o-rama@gasbottle-county.eu", :subject => "Contact-o-Rama: Geburtstage in den nächsten 7 Tagen.") - # end end diff --git a/app/views/user_mailer/upcoming_birthdays_notification.html.erb b/app/views/user_mailer/upcoming_birthdays_notification.html.erb index 1e0c8ed..b4d2bb0 100644 --- a/app/views/user_mailer/upcoming_birthdays_notification.html.erb +++ b/app/views/user_mailer/upcoming_birthdays_notification.html.erb @@ -1,32 +1,25 @@ -<% unless (@birthday_contacts_2days.blank? && @birthday_contacts_7days.blank?) %> -
| - Contact-o-Rama: anstehende Geburtstage - - |
|---|
| + Contact-o-Rama: anstehende Geburtstage + | +
|---|
+ <% if @num_days == 2 %>
+ Übermorgen (<%= (Date.today + @num_days).strftime("%-d.%m.") %>):+ <% else %> +In einer Woche (am <%= (Date.today + @num_days).strftime("%-d.%m.") %>):<% end %> - -<% end %> -<% unless @birthday_contacts_7days.blank? %> -In einer Woche, also am <%= (Date.today + 7).to_s %>:
- |
Passende Kontaktdaten gibt's vielleicht bei Contact-o-Rama.
+ + +