From 518526b717d3342c7d1bac9f67fc1734a22973c1 Mon Sep 17 00:00:00 2001 From: nfoy Date: Tue, 22 Apr 2014 23:22:18 -0400 Subject: Made inbox and outbox for pms. --- app/views/pms/index.html.erb | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'app/views/pms') diff --git a/app/views/pms/index.html.erb b/app/views/pms/index.html.erb index f5dfe02..ceb1a40 100644 --- a/app/views/pms/index.html.erb +++ b/app/views/pms/index.html.erb @@ -13,7 +13,32 @@ - <% @pms.each do |pm| %> + + +

Inbox

+ + + <% message = @pms.where(recipient: current_user) %> + <% unless message.empty? then message.each do |pm| %> + + <%= pm.author.user_name %> + <%= pm.recipient.user_name %> + <%= pm.message %> + <%= link_to 'Show', pm %> + <%= link_to 'Edit', edit_pm_path(pm) %> + <%= link_to 'Destroy', pm, method: :delete, data: { confirm: 'Are you sure?' } %> + + <% end %> + <% else %> +

No New Messages

+ <% end %> + + +

Outbox

+ + + <% message = @pms.where(author: current_user) %> + <% unless message.empty? then message.each do |pm| %> <%= pm.author.user_name %> <%= pm.recipient.user_name %> @@ -22,6 +47,9 @@ <%= link_to 'Edit', edit_pm_path(pm) %> <%= link_to 'Destroy', pm, method: :delete, data: { confirm: 'Are you sure?' } %> + <% end %> + <% else %> +

No New Messages

<% end %> -- cgit v1.2.3-2-g168b