summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornfoy <nfoy@purdue.edu>2014-04-28 00:07:57 -0400
committernfoy <nfoy@purdue.edu>2014-04-28 00:07:57 -0400
commit952387be24043e76dfd9b7a461ee31d1246fa58e (patch)
tree1f7c2453783b307bb6d2490df01716a348ad6fee
parent7a4832621f1a0bb2e4b86ee9f879a73df0188a3e (diff)
Messages and alerts play together more nicely now.
-rw-r--r--app/views/pms/index.html.erb69
-rw-r--r--app/views/pms/show.html.erb1
2 files changed, 60 insertions, 10 deletions
diff --git a/app/views/pms/index.html.erb b/app/views/pms/index.html.erb
index 056b371..fec6db2 100644
--- a/app/views/pms/index.html.erb
+++ b/app/views/pms/index.html.erb
@@ -23,6 +23,9 @@
<% if conversation.is_unread?(current_user) && receipts.last.message.sender != current_user %>
<% message = receipts.last.message %>
<tr>
+ <% if conversation.subject == "Pay Attention!" %>
+ <% conversation.mark_as_read(current_user) %>
+ <% end %>
<td>
<% people = conversation.participants %>
<% people.each do |person| %>
@@ -65,17 +68,63 @@
<% if conversation.is_read?(current_user) || receipts.last.message.sender == current_user %>
<% message = receipts.last.message %>
<tr>
- <td>
- <% people = conversation.participants %>
- <% people.each do |person| %>
- <% unless person == current_user %>
- <%= truncate(person.user_name, length: 20) %>
+ <% if conversation.subject != "Pay Attention!" %>
+ <td>
+ <% people = conversation.participants %>
+ <% people.each do |person| %>
+ <% unless person == current_user %>
+ <%= truncate(person.user_name, length: 20) %>
+ <% end %>
<% 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>
+ </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>
+ <% end %>
+ </tr>
+ <% end %>
+ <% end %>
+ </tr>
+ <% #else %>
+
+ <% #end %>
+ </tbody>
+</table>
+
+<br>
+<h3>Alerts</h3>
+<% conversations = current_user.mailbox.conversations %>
+
+<table>
+ <col width="150">
+ <col width="250">
+ <col width="300">
+ <tbody>
+ <%# if conversations.reject { |c| c.is_read?(current_user) || (c.receipts_for current_user).last.message.sender == current_user }.empty? %>
+ <tr>
+ <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 %>
+ <% if conversation.is_read?(current_user) || receipts.last.message.sender == current_user %>
+ <% message = receipts.last.message %>
+ <tr>
+ <% if conversation.subject == "Pay Attention!" %>
+ <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>
+ <% end %>
</tr>
<% end %>
<% end %>
diff --git a/app/views/pms/show.html.erb b/app/views/pms/show.html.erb
index ca8d9bf..2c93102 100644
--- a/app/views/pms/show.html.erb
+++ b/app/views/pms/show.html.erb
@@ -31,6 +31,7 @@
<p> ________________________________________________ </p>
<p>
+ <% @pm.message = "" %>
<%= form_for(@pm) do |f| %>
<div class="field">
<%= f.text_area :message %>