Guest User

Untitled

a guest
May 23rd, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. module ContactsHelper
  2. def show_email_status(contact, email)
  3.  
  4. @contact_email = ContactEmail.find(:first, :conditions => {:contact_id => contact.id, :email_id => email.id })
  5.  
  6. if ! @contact_email.nil?
  7. return @contact_email.status.to_s + " (" + @contact_email.date_sent.to_s(:long) + ")"
  8. else
  9. return "no status"
  10. end
  11. end
  12.  
  13. def show_call_status(contact, call)
  14.  
  15. @contact_call = ContactCall.find(:first, :conditions => {:contact_id => contact.id,
  16. :call_id => call.id })
  17. if ! @contact_call.nil?
  18. return "sent " + @contact_call.date_sent.to_s(:long)
  19. else
  20. return "no status"
  21. end
  22. end
  23.  
  24. def show_letter_status(contact, letter)
  25.  
  26. @contact_letter = ContactLetter.find(:first, :conditions => {:contact_id => contact.id,
  27. :letter_id => letter.id })
  28. if ! @contact_letter.nil?
  29. return "sent " + @contact_letter.date_sent.to_s(:long)
  30. else
  31. return "no status"
  32. end
  33. end
  34.  
  35. def show_status(contact, call_or_email_or_letter_or_voicemail)
  36.  
  37. model_name = call_or_email_or_letter_or_voicemail.class.name.tableize.singularize
  38. send "show_#{model_name}_status", contact, call_or_email_or_letter
  39. end
  40. end
Add Comment
Please, Sign In to add comment