From 353e0b387b8e76d407f9451c236efbb4bd3a19ef Mon Sep 17 00:00:00 2001 From: nfoy Date: Sun, 27 Apr 2014 00:05:51 -0400 Subject: Even better index page for messages. --- app/views/pms/index.html.erb | 100 +++++++++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 46 deletions(-) (limited to 'app/views/pms') diff --git a/app/views/pms/index.html.erb b/app/views/pms/index.html.erb index 560cf38..a1feb42 100644 --- a/app/views/pms/index.html.erb +++ b/app/views/pms/index.html.erb @@ -11,32 +11,36 @@ - + <% if conversations.reject { |c| c.is_unread?(current_user) && (c.receipts_for current_user).last.message.sender != current_user }.empty? %> - With - Subject - Body - - <% conversations.each do |conversation| %> - <% receipts = conversation.receipts_for current_user %> - <% if conversation.is_unread?(current_user) && receipts.last.message.sender != current_user %> - <% message = receipts.last.message %> - - - <% people = conversation.participants %> - <% people.each do |person| %> - <% unless person == current_user %> - <%= truncate(person.user_name, length: 20) %> + + With + Subject + Body + + <% conversations.each do |conversation| %> + <% receipts = conversation.receipts_for current_user %> + <% if conversation.is_unread?(current_user) && receipts.last.message.sender != current_user %> + <% message = receipts.last.message %> + + + <% people = conversation.participants %> + <% people.each do |person| %> + <% unless person == current_user %> + <%= truncate(person.user_name, length: 20) %> + <% end %> <% end %> - <% end %> - - <%= truncate(conversation.subject, length: 30) %> - <%= truncate(message.body, length: 42) %> - <%= link_to 'View', @pms.find_by(conversation: conversation) %> - + + <%= truncate(conversation.subject, length: 30) %> + <%= truncate(message.body, length: 42) %> + <%= link_to 'View', @pms.find_by(conversation: conversation) %> + + <% end %> <% end %> - <% end %> - + + <% else %> +

No unread conversations

+ <% end %> @@ -49,31 +53,35 @@ - + <% if conversations.reject { |c| c.is_read?(current_user) || (c.receipts_for current_user).last.message.sender == current_user }.empty? %> - With - Subject - Body - - <% 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 %> - - - <% people = conversation.participants %> - <% people.each do |person| %> - <% unless person == current_user %> - <%= truncate(person.user_name, length: 20) %> + + With + Subject + Body + + <% 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 %> + + + <% people = conversation.participants %> + <% people.each do |person| %> + <% unless person == current_user %> + <%= truncate(person.user_name, length: 20) %> + <% end %> <% end %> - <% end %> - - <%= truncate(conversation.subject, length: 30) %> - <%= truncate(message.body, length: 42) %> - <%= link_to 'View', @pms.find_by(conversation: conversation) %> - + + <%= truncate(conversation.subject, length: 30) %> + <%= truncate(message.body, length: 42) %> + <%= link_to 'View', @pms.find_by(conversation: conversation) %> + + <% end %> <% end %> - <% end %> - + + <% else %> +

No unread conversations

+ <% end %> \ No newline at end of file -- cgit v1.2.3-2-g168b