blob: ceb1a407f1db9c9d938c5168a390cdaae73db98a (
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
|
<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 '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>
<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 %>
</tbody>
</table>
<br>
<%= link_to 'New Pm', new_pm_path %>
|