summaryrefslogtreecommitdiff
path: root/app/views/pms/index.html.erb
blob: a13705ad70ef0a46fb0737e483051d12613318ec (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
<h1>Conversations</h1>

<table>
  <col width="150">
  <col width="250">
  <col width="300">
  <tbody>
    <tr>
      <% conversations = current_user.mailbox.conversations %>
      <% if !conversations.empty? %>
      <%# require 'pp' %>
      <%= conversations.class %>
        <tr>
          <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 = receipts.last.message %>
            <tr>
            <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 %>

      <% else %>
          <td><p> No Messages </p></td>
      <% end %>
     </tr>

  </tbody>
</table>

<br>

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