summaryrefslogtreecommitdiff
path: root/app/views/pms/index.html.erb
blob: b5f4884ebc71003a5a31c4f6ae03aced1125affc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<h1>Conversations</h1>

<table>
  <tbody>
    <tr>
      <td><h3>Inbox<h3></td>
    </tr>
    <tr>
      <% conversations = current_user.mailbox.inbox %>
      <% if !conversations.empty? %>
      <%# require 'pp' %>
      <%= conversations.class %>
        <tr>
          <td><b>From</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><%= conversation.last_sender.user_name %></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>

     <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>

<br>

<%= link_to 'New Pm', new_pm_path %>