started work on /diary
authorRichard Fairhurst <richard@systemed.net>
Fri, 4 May 2007 17:07:27 +0000 (17:07 +0000)
committerRichard Fairhurst <richard@systemed.net>
Fri, 4 May 2007 17:07:27 +0000 (17:07 +0000)
app/controllers/diary_entry_controller.rb
app/views/diary_entry/_diary_entry.rhtml
app/views/diary_entry/list.rhtml [new file with mode: 0644]
app/views/layouts/site.rhtml
config/routes.rb

index c25c8718dced4fab126fea2f8a3e8494146fd01d..a67ad575a99b52b1193e1965fe684f4bf69f9420 100644 (file)
@@ -13,4 +13,8 @@ class DiaryEntryController < ApplicationController
       end
     end
   end
+  
+  def list
+    @entries=DiaryEntry.find(:all, :order => 'created_at DESC', :limit=>20)
+  end
 end
index cf9115f6ce447ae26a17b8c4313746d90939e11b..8808aab03bb8a2b55621a98be12282349964aafa 100644 (file)
@@ -1,3 +1,5 @@
 <b><%= diary_entry.title %></b><br />
 <%= simple_format(diary_entry.body) %>
+Posted by user <b><%= link_to diary_entry.user_id,"spong" %></b> at <%= diary_entry.created_at %><br />
 <br />
+<hr />
diff --git a/app/views/diary_entry/list.rhtml b/app/views/diary_entry/list.rhtml
new file mode 100644 (file)
index 0000000..0b2c590
--- /dev/null
@@ -0,0 +1,3 @@
+<h3>most recent posts:</h3>
+FIXME: geoRSS needed. Also proper user names and permalinks.<br><br>
+<%= render :partial => 'diary_entry/diary_entry', :collection => @entries %>
index f2cc5b4fe1662cf9f423590ef4cc89be21008784..c2e4c9bfc3e4a5e4121d6474270c3d11f21c7e96 100644 (file)
@@ -68,6 +68,7 @@
 
       <div id="left_menu">
         <a href="http://wiki.openstreetmap.org">Help & Wiki</a><br />
+               <%= link_to "Users' diaries", {:controller => 'diary_entry', :action => 'list'} %><br />
         <a href="http://www.opengeodata.org/">News blog</a><br />
         <a href="http://wiki.openstreetmap.org/index.php/Merchandise">Shop</a><br />
       </div>
index c739fac8e653e1561fe5221f9d7e6c9a51ca19ca..407e102d60887058edc523ec2b5d8c175b74d57a 100644 (file)
@@ -69,6 +69,7 @@ ActionController::Routing::Routes.draw do |map|
   map.connect '/user/:display_name/edit', :controller => 'user', :action => 'edit'
   map.connect '/user/:display_name/account', :controller => 'user', :action => 'account'
   map.connect '/user/:display_name/set_home', :controller => 'user', :action => 'set_home'
+  map.connect '/diary', :controller => 'diary_entry', :action => 'list'
 
   # test pages
   map.connect '/test/populate/:table/:from/:count', :controller => 'test', :action => 'populate'