summaryrefslogtreecommitdiff
path: root/app/views/pms/index.html.erb
diff options
context:
space:
mode:
authorguntasgrewal <guntasgrewal@gmail.com>2014-04-24 19:22:33 -0400
committerguntasgrewal <guntasgrewal@gmail.com>2014-04-24 19:22:33 -0400
commitf14410d0e7ea249971265f3466ec246c62e6f3f5 (patch)
treee459190532683018c1bd24070fe01ad474c2ec08 /app/views/pms/index.html.erb
parentb5cc531c9c5d2f7ab9066bbe732dad730cc063d9 (diff)
parent379cf06b33c672e01845c9c826ce58f8517059bd (diff)
Merge branch 'master' of https://github.com/LukeShu/leaguer
Diffstat (limited to 'app/views/pms/index.html.erb')
-rw-r--r--app/views/pms/index.html.erb65
1 files changed, 7 insertions, 58 deletions
diff --git a/app/views/pms/index.html.erb b/app/views/pms/index.html.erb
index 1175cb2..b5f4884 100644
--- a/app/views/pms/index.html.erb
+++ b/app/views/pms/index.html.erb
@@ -1,66 +1,15 @@
-<h1>Listing pms</h1>
+<h1>Conversations</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>
<% conversations = current_user.mailbox.inbox %>
- <% if !conversations.nil? %>
+ <% if !conversations.empty? %>
+ <%# require 'pp' %>
+ <%= conversations.class %>
<tr>
<td><b>From</b></td>
<td><b>Subject</b></td>
@@ -74,7 +23,7 @@
<td><%= conversation.last_sender.user_name %></td>
<td><%= message.subject %></td>
<td><%= message.body %></td>
- <td><%# link_to 'Show', pm %></td>
+ <td><%# link_to 'Show', @pms.where(conversation: conversation) %></td>
</tr>
<% end %>
<% end %>
@@ -89,7 +38,7 @@
</tr>
<tr>
<% conversations = current_user.mailbox.sentbox %>
- <% if !conversations.nil? %>
+ <% if !conversations.empty? %>
<tr>
<td><b>To</b></td>
<td><b>Subject</b></td>
@@ -103,7 +52,7 @@
<td>Doesn't work</td>
<td><%= message.subject %></td>
<td><%= message.body %></td>
- <td><%# link_to 'Show', conversation %></td>
+ <td><%# link_to 'Show', @pms.where(conversation: conversation) %></td>
</tr>
<% end %>
<% end %>