summaryrefslogtreecommitdiff
path: root/app/views/pms
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2014-04-26 21:12:06 -0400
committerLuke Shumaker <shumakl@purdue.edu>2014-04-26 21:12:06 -0400
commit2c1e5ab5e7b20dabec9ddb9b34e0cf534afc6d06 (patch)
treec47e8dbc1f4c80ef9bd4531fd7f0de3f0e30c9ca /app/views/pms
parentedb9e6a59459b42acb8dc751044d51c70e81429c (diff)
parentf156d56096e08254a249304b68ae0cb433ef9db3 (diff)
Merge branch 'master' of https://github.com/LukeShu/leaguer
Diffstat (limited to 'app/views/pms')
-rw-r--r--app/views/pms/_form.html.erb8
-rw-r--r--app/views/pms/index.html.erb60
-rw-r--r--app/views/pms/show.html.erb51
3 files changed, 55 insertions, 64 deletions
diff --git a/app/views/pms/_form.html.erb b/app/views/pms/_form.html.erb
index a885e27..b329e24 100644
--- a/app/views/pms/_form.html.erb
+++ b/app/views/pms/_form.html.erb
@@ -23,14 +23,6 @@
<%= f.label :message %><br>
<%= f.text_area :message %>
</div>
- <div class="field">
- <%= f.label :subject %><br>
- <%= f.text_area :subject %>
- </div>
- <div class="field">
- <%= f.label :conversation_id %><br>
- <%= f.text_field :conversation_id %>
- </div>
<div class="actions">
<%= f.submit %>
</div>
diff --git a/app/views/pms/index.html.erb b/app/views/pms/index.html.erb
index b5f4884..a13705a 100644
--- a/app/views/pms/index.html.erb
+++ b/app/views/pms/index.html.erb
@@ -1,31 +1,38 @@
<h1>Conversations</h1>
<table>
+ <col width="150">
+ <col width="250">
+ <col width="300">
<tbody>
<tr>
- <td><h3>Inbox<h3></td>
- </tr>
- <tr>
- <% conversations = current_user.mailbox.inbox %>
+ <% conversations = current_user.mailbox.conversations %>
<% if !conversations.empty? %>
<%# require 'pp' %>
<%= conversations.class %>
<tr>
- <td><b>From</b></td>
+ <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 = receipt.message %>
+ <%# receipts.each do |receipt| %>
+ <% message = receipts.last.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>
+ <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 %>
<% end %>
<% else %>
@@ -33,35 +40,6 @@
<% 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>
diff --git a/app/views/pms/show.html.erb b/app/views/pms/show.html.erb
index 6f81d1b..64dd66e 100644
--- a/app/views/pms/show.html.erb
+++ b/app/views/pms/show.html.erb
@@ -1,26 +1,47 @@
<p>
- <strong>Author:</strong>
- <%# @conversation.last_sender.user_name %>
+ <strong>Participants:</strong>
+ <% receps = @pm.conversation.participants %>
+ <% receps.each do |recep| %>
+ <% #unless recep == @pm.conversation.last_sender %>
+ <%= recep.user_name %>
+ <%= "and" %>
+ <% #end %>
+ <% end %>
+ <%= "the NSA" %>
</p>
<p>
- <strong>Recipient:</strong>
- <%#@pm.recipient.user_name %>
+ <strong>Subject:</strong>
+ <%= @pm.conversation.subject %>
</p>
-<p>
- <strong>Message:</strong>
- <%# @pm.message %>
-</p>
+<% receipts = @pm.conversation.receipts_for current_user %>
+<% receipts.each do |receipt| %>
+ <% message = receipt.message %>
-<p>
- <strong>Subject:</strong>
- <%= @pm.subject %>
-</p>
+ <p> ________________________________________________ </p>
-<p>
- <strong>Conversation:</strong>
- <%= @pm.conversation %>
+ <p>
+ <%= message.sender.user_name %>
+ <%= ":" %>
+ <%= message.body %>
+ </p>
+
+<% end %>
+
+<p> ________________________________________________ </p>
+<p>
+ <%= form_for(@pm) do |f| %>
+ <div class="field">
+ <%= f.text_area :message %>
+ </div>
+
+ <div class="actions">
+ <%= submit_tag("Reply", :class => "signup") %>
+ </div>
+
+ <% end %>
</p>
+
<%= link_to 'Back', pms_path %>