diff options
author | nfoy <nfoy@purdue.edu> | 2014-04-22 23:22:18 -0400 |
---|---|---|
committer | nfoy <nfoy@purdue.edu> | 2014-04-22 23:22:18 -0400 |
commit | 518526b717d3342c7d1bac9f67fc1734a22973c1 (patch) | |
tree | cfaa5470c4c89e844a46a2bd39592e62e5bf821f /app | |
parent | d53c2b7971388026be5c42cd833f7e16781f2c18 (diff) |
Made inbox and outbox for pms.
Diffstat (limited to 'app')
-rw-r--r-- | app/views/pms/index.html.erb | 30 |
1 files changed, 29 insertions, 1 deletions
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 @@ </thead> <tbody> - <% @pms.each do |pm| %> + + <tr> + <td><h2>Inbox<h2></td> + </tr> + + <% message = @pms.where(recipient: current_user) %> + <% unless message.empty? then message.each do |pm| %> + <tr> + <td><%= pm.author.user_name %></td> + <td><%= pm.recipient.user_name %></td> + <td><%= pm.message %></td> + <td><%= link_to 'Show', pm %></td> + <td><%= link_to 'Edit', edit_pm_path(pm) %></td> + <td><%= link_to 'Destroy', pm, method: :delete, data: { confirm: 'Are you sure?' } %></td> + </tr> + <% end %> + <% else %> + <td><h3>No New Messages</h3></td> + <% end %> + + <tr> + <td><h2>Outbox<h2></td> + </tr> + + <% message = @pms.where(author: current_user) %> + <% unless message.empty? then message.each do |pm| %> <tr> <td><%= pm.author.user_name %></td> <td><%= pm.recipient.user_name %></td> @@ -22,6 +47,9 @@ <td><%= link_to 'Edit', edit_pm_path(pm) %></td> <td><%= link_to 'Destroy', pm, method: :delete, data: { confirm: 'Are you sure?' } %></td> </tr> + <% end %> + <% else %> + <td><h3>No New Messages</h3></td> <% end %> </tbody> </table> |