Skip to content

Instantly share code, notes, and snippets.

Created July 11, 2010 02:44
Show Gist options
  • Save anonymous/471225 to your computer and use it in GitHub Desktop.
Save anonymous/471225 to your computer and use it in GitHub Desktop.
module ContactsHelper
def show_email_status(contact, email)
@contact_email = ContactEmail.find(:first, :conditions => {:contact_id => contact.id, :email_id => email.id })
if ! @contact_email.nil?
return @contact_email.status.to_s + " (" + @contact_email.date_sent.to_s(:long) + ")"
else
return "no status"
end
end
def show_call_status(contact, call)
@contact_call = ContactCall.find(:first, :conditions => {:contact_id => contact.id,
:call_id => call.id })
if ! @contact_call.nil?
return "sent " + @contact_call.date_sent.to_s(:long)
else
return "no status"
end
end
def show_letter_status(contact, letter)
@contact_letter = ContactLetter.find(:first, :conditions => {:contact_id => contact.id,
:letter_id => letter.id })
if ! @contact_letter.nil?
return "sent " + @contact_letter.date_sent.to_s(:long)
else
return "no status"
end
end
def show_status(contact, call_or_email_or_letter_or_voicemail)
model_name = call_or_email_or_letter_or_voicemail.class.name.tableize.singularize
send "show_#{model_name}_status", contact, call_or_email_or_letter
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment