added messaging and friend stuff that wasn't checked in

This commit is contained in:
Nick Black 2007-05-06 10:36:06 +00:00
parent 7a36f26a19
commit 7d52305640
4 changed files with 42 additions and 0 deletions

View file

@ -0,0 +1,2 @@
class FriendController < ApplicationController
end

4
app/models/friend.rb Normal file
View file

@ -0,0 +1,4 @@
class Friend < ActiveRecord::Base
belongs_to :user
end

View file

@ -0,0 +1,20 @@
<% display_name = (User.find_by_id(params[:user_id])).display_name %>
<h2>Send a new message to <%= display_name %></h2>
<% if params[:display_name] %>
<p>Writing a new message to <%= params[:display_name] %></p>
<p>TODO: drop down box of your friends</p>
<%end%>
<%= error_messages_for 'message' %>
<%= start_form_tag :controller => 'message', :action => 'new' %>
subject: <%= text_field 'message', 'title' %><br>
body: <%= text_area 'message', 'body' %><br>
<%= submit_tag 'Send' %>
<% end_form_tag %>
<br />
<%= link_to 'Back to my account', :controller => 'user', :action => 'account' %>

View file

@ -0,0 +1,16 @@
<h2>Reading your messages</h2>
<table>
<th>from</th>
<th>message</th>
<th>date</th>
<th>reply</th>
<tr><td><%= (User.find_by_id(@message.from_user_id)).display_name %></td>
<td><%= @message.body %></td>
<td><%= @message.sent_on %></td>
<td><%= link_to 'reply', :controller => 'message', :action => 'new', :user_id => @message.from_user_id %></td>
</table>
<%= start_form_tag :controller => 'message', :action => 'mark', :message_id => @message.id %>
<%= submit_tag 'Mark as read' %>