added messaging and friend stuff that wasn't checked in
authorNick Black <nickb@svn.openstreetmap.org>
Sun, 6 May 2007 10:36:06 +0000 (10:36 +0000)
committerNick Black <nickb@svn.openstreetmap.org>
Sun, 6 May 2007 10:36:06 +0000 (10:36 +0000)
app/controllers/friend_controller.rb [new file with mode: 0644]
app/models/friend.rb [new file with mode: 0644]
app/views/message/new.rhtml [new file with mode: 0644]
app/views/message/read.rhtml [new file with mode: 0644]

diff --git a/app/controllers/friend_controller.rb b/app/controllers/friend_controller.rb
new file mode 100644 (file)
index 0000000..292f5c9
--- /dev/null
@@ -0,0 +1,2 @@
+class FriendController < ApplicationController
+end
diff --git a/app/models/friend.rb b/app/models/friend.rb
new file mode 100644 (file)
index 0000000..242b742
--- /dev/null
@@ -0,0 +1,4 @@
+class Friend < ActiveRecord::Base
+  belongs_to :user
+  
+end
diff --git a/app/views/message/new.rhtml b/app/views/message/new.rhtml
new file mode 100644 (file)
index 0000000..4075d54
--- /dev/null
@@ -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' %>
diff --git a/app/views/message/read.rhtml b/app/views/message/read.rhtml
new file mode 100644 (file)
index 0000000..1e2a3bf
--- /dev/null
@@ -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' %>
+