diff options
author | nfoy <nfoy@purdue.edu> | 2014-04-26 20:57:21 -0400 |
---|---|---|
committer | nfoy <nfoy@purdue.edu> | 2014-04-26 20:57:21 -0400 |
commit | 00f3d70445d7cae0976ec9794e555c52a1765b24 (patch) | |
tree | 7a89dcf1466ad8b2fd3df587f1807ba9dfc08468 /app/views/pms/index.html.erb | |
parent | d5e4ac14fc51631f5cd77ba4226ba5911ffe7e37 (diff) |
Messages is working (besides default permissions)!
Diffstat (limited to 'app/views/pms/index.html.erb')
-rw-r--r-- | app/views/pms/index.html.erb | 60 |
1 files changed, 19 insertions, 41 deletions
diff --git a/app/views/pms/index.html.erb b/app/views/pms/index.html.erb index b5f4884..a13705a 100644 --- a/app/views/pms/index.html.erb +++ b/app/views/pms/index.html.erb @@ -1,31 +1,38 @@ <h1>Conversations</h1> <table> + <col width="150"> + <col width="250"> + <col width="300"> <tbody> <tr> - <td><h3>Inbox<h3></td> - </tr> - <tr> - <% conversations = current_user.mailbox.inbox %> + <% conversations = current_user.mailbox.conversations %> <% if !conversations.empty? %> <%# require 'pp' %> <%= conversations.class %> <tr> - <td><b>From</b></td> + <td><b>With</b></td> <td><b>Subject</b></td> <td><b>Body</b></td> </tr> <% conversations.each do |conversation| %> <% receipts = conversation.receipts_for current_user %> - <% receipts.each do |receipt| %> - <% message = receipt.message %> + <%# receipts.each do |receipt| %> + <% message = receipts.last.message %> <tr> - <td><%= conversation.last_sender.user_name %></td> - <td><%= message.subject %></td> - <td><%= message.body %></td> - <td><%# link_to 'Show', @pms.where(conversation: conversation) %></td> + <td> + <% people = conversation.participants %> + <% people.each do |person| %> + <% unless person == current_user %> + <%= truncate(person.user_name, length: 20) %> + <% end %> + <% end %> + </td> + <td><%= truncate(conversation.subject, length: 30) %></td> + <td><%= truncate(message.body, length: 42) %></td> + <td><%= link_to 'View', @pms.find_by(conversation: conversation) %></td> </tr> - <% end %> + <%# end %> <% end %> <% else %> @@ -33,35 +40,6 @@ <% end %> </tr> - <tr> - <td><h3>Outbox<h3></td> - </tr> - <tr> - <% conversations = current_user.mailbox.sentbox %> - <% if !conversations.empty? %> - <tr> - <td><b>To</b></td> - <td><b>Subject</b></td> - <td><b>Body</b></td> - </tr> - <% conversations.each do |conversation| %> - <% receipts = conversation.receipts_for current_user %> - <% receipts.each do |receipt| %> - <% message = receipt.message %> - <tr> - <td>Doesn't work</td> - <td><%= message.subject %></td> - <td><%= message.body %></td> - <td><%# link_to 'Show', @pms.where(conversation: conversation) %></td> - </tr> - <% end %> - <% end %> - - <% else %> - <td><p> No Messages </p></td> - <% end %> - </tr> - </tbody> </table> |