message outbox

This commit is contained in:
Mikel Maron 2007-11-21 18:24:29 +00:00
parent cdfc163e5f
commit d736a158be
7 changed files with 74 additions and 4 deletions

View file

@ -0,0 +1,7 @@
<% this_colour = cycle('lightgrey', 'white') # can only call once for some dumb reason %>
<tr class="inbox-row<%= "-unread" if not sent_message_summary.message_read? %>">
<td class="inbox-sender" bgcolor='<%= this_colour %>'><%= link_to sent_message_summary.recipient.display_name , :controller => 'user', :action => sent_message_summary.recipient.display_name %></td>
<td class="inbox-subject" bgcolor='<%= this_colour %>'><%= link_to sent_message_summary.title , :controller => 'message', :action => 'read', :message_id => sent_message_summary.id %></td>
<td class="inbox-sent" bgcolor='<%= this_colour %>'><%= sent_message_summary.sent_on %></td>
</tr>

View file

@ -1,4 +1,4 @@
<h2>My inbox</h2>
<h2>My inbox/<%= link_to "outbox", url_for(:controller => "user", :action => "outbox", :id => @user.display_name) %></h2>
<p>You have <%= @user.new_messages.size %> new messages and <%= @user.messages.size - @user.new_messages.size %> old messages</p>
@ -17,4 +17,4 @@
</div>
<% else %>
<div id="messages">You have no messages yet. Why not get in touch with some of the <%= link_to 'people mapping nearby', :controller => 'user', :action => 'view', :display_name => @user.display_name %>?</div>
<% end %>
<% end %>

View file

@ -0,0 +1,18 @@
<h2>My <%= link_to "inbox", url_for(:controller => "user", :action => "inbox", :id => @user.display_name) %>/outbox</h2>
<p>You have <%= @user.sent_messages.size %> sent messages
<% if @user.sent_messages.size > 0 %>
<div id="messages">
<table class="messages">
<tr>
<th>To</th>
<th>Subject</th>
<th>Date</th>
</tr>
<%= render :partial => "sent_message_summary", :collection => @user.sent_messages %>
</table>
</div>
<% else %>
<div id="messages">You have no sent messages yet. Why not get in touch with some of the <%= link_to 'people mapping nearby', :controller => 'user', :action => 'view', :display_name => @user.display_name %>?</div>
<% end %>

View file

@ -1,3 +1,5 @@
<% if @user == @message.recipient %>
<h2>Reading your messages</h2>
<table>
@ -28,3 +30,36 @@
<td><%= link_to 'Back to inbox', :controller => 'message', :action => 'inbox', :display_name => @user.display_name %></td>
</tr>
</table>
<% else %>
<h2>Reading your sent messages</h2>
<table>
<tr>
<th align="right">To</th>
<td><%= link_to @message.recipient.display_name, :controller => 'user', :action => 'view', :display_name => @message.recipient.display_name %></td>
</tr>
<tr>
<th align="right">Subject</th>
<td><%= @message.title %></td>
</tr>
<tr>
<th align="right">Date</th>
<td><%= @message.sent_on %></td>
</tr>
<tr>
<th></th>
<td><%= @message.body %></td>
</tr>
</table>
<br />
<table>
<tr>
<td><%= link_to 'Back to outbox', :controller => 'message', :action => 'outbox', :display_name => @user.display_name %></td>
</tr>
</table>
<% end %>