Module | MessagesHelper |
In: |
../../../app/helpers/emails_helper.rb
|
Helper for RESTful_Easy_Messages
Delete Button
# File ../../../app/helpers/emails_helper.rb, line 91 91: def rezm_button_to_delete(email) 92: button_to "Delete", profile_email_path(rezm_user, email), :confirm => "Are you sure?", :method => :delete 93: end
Reply Button
# File ../../../app/helpers/emails_helper.rb, line 86 86: def rezm_button_to_reply(email) 87: button_to "Reply", reply_profile_email_path(rezm_user, email), :method => :get 88: end
Checkbox for marking a email for deletion
# File ../../../app/helpers/emails_helper.rb, line 40 40: def rezm_delete_check_box(email) 41: check_box_tag 'to_delete[]', email.id 42: end
Link to compose a email
# File ../../../app/helpers/emails_helper.rb, line 15 15: def rezm_link_to_create_email 16: link_to "Write", new_profile_email_path 17: end
Link to view the inbox
# File ../../../app/helpers/emails_helper.rb, line 10 10: def rezm_link_to_inbox 11: link_to "Inbox", inbox_profile_emails_path 12: end
Link to view the email
# File ../../../app/helpers/emails_helper.rb, line 45 45: def rezm_link_to_email(email) 46: link_to "#{h(rezm_subject_and_status(email))}", profile_email_path(rezm_user, email) 47: end
Link to view the outbox
# File ../../../app/helpers/emails_helper.rb, line 20 20: def rezm_link_to_outbox 21: link_to "Outbox", outbox_profile_emails_path 22: end
Link to view the trash bin
# File ../../../app/helpers/emails_helper.rb, line 25 25: def rezm_link_to_trash_bin 26: link_to "Trash", trashbin_profile_emails_path 27: end
Generic menu
# File ../../../app/helpers/emails_helper.rb, line 5 5: def rezm_menu 6: rezm_link_to_inbox + "|" + rezm_link_to_create_email + "|" + rezm_link_to_outbox + "|" + rezm_link_to_trash_bin 7: end
Dynamic data for the sender/receiver column in the emails.rhtml view
# File ../../../app/helpers/emails_helper.rb, line 50 50: def rezm_sender_or_receiver(email) 51: if params[:action] == "outbox" 52: rezm_to_user_link(email) 53: # Used for both inbox and trashbin 54: else 55: rezm_from_user_link(email) 56: end 57: end
Dynamic label for the sender/receiver column in the emails.rhtml view
# File ../../../app/helpers/emails_helper.rb, line 30 30: def rezm_sender_or_receiver_label 31: if params[:action] == "outbox" 32: "Recipient" 33: # Used for both inbox and trashbin 34: else 35: "Sender" 36: end 37: end
Pretty format for email sent date/time
# File ../../../app/helpers/emails_helper.rb, line 60 60: def rezm_sent_at(email) 61: h(email.created_at.to_date.strftime('%m/%d/%Y') + " " + email.created_at.strftime('%I:%M %p').downcase) 62: end
Pretty format for email.subject which appeads the status (Deleted/Unread)
# File ../../../app/helpers/emails_helper.rb, line 65 65: def rezm_subject_and_status(email) 66: if email.receiver_deleted? 67: email.subject + " (Deleted)" 68: elsif email.read_at.nil? 69: email.subject + " (Unread)" 70: else 71: email.subject 72: end 73: end