blob: 73c7a873a9f6f8deca52d0e8cf01305739c554dd (
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
<h1>Listing pms</h1>
<table>
<thead>
<tr>
<th>Author</th>
<th>Recipient</th>
<th>Message</th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<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 'Delete', pm, method: :delete, data: { confirm: 'Are you sure (also deletes the author\'s copy)?' } %></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>
<td><%= pm.message %></td>
<td><%= link_to 'Show', pm %></td>
<td><%# link_to 'Edit', edit_pm_path(pm) %></td>
<td><%= link_to 'Delete', pm, method: :delete, data: { confirm: 'Are you sure (also deletes the recipient\'s copy)?'} %></td>
</tr>
<% end %>
<% else %>
<td><h3>No New Messages</h3></td>
<% end %>
<tr>
<td><h2>Conversations<h2></td>
</tr>
<tr>
<td><h3>Inbox<h3></td>
</tr>
<tr>
<% conversation1 = current_user.mailbox.inbox.first %>
<% if !conversation1.nil? %>
<% receipts1 = conversation1.receipts_for current_user %>
<% receipts1.each do |receipt1| %>
<% message1 = receipt1.message %>
<td><%= message1.subject %></td>
<td><%= message1.body %></td>
<% end %>
<% else %>
<td><p> No Messages </p></td>
<% end %>
</tr>
<tr>
<td><h3>Outbox<h3></td>
</tr>
<tr>
<% conversation1 = current_user.mailbox.sentbox.first %>
<% if !conversation1.nil? %>
<tr>
<td><b>From</b></td>
<td><b>Subject</b></td>
<td><b>Body</b></td>
</tr>
<% receipts1 = conversation1.receipts_for current_user %>
<% receipts1.each do |receipt1| %>
<% message1 = receipt1.message %>
<td><%= message1.subject %></td>
<td><%= message1.body %></td>
<% end %>
<% else %>
<td><p> No Messages </p></td>
<% end %>
</tr>
</tbody>
</table>
<br>
<%= link_to 'New Pm', new_pm_path %>
|