From 8758685a86c3032a412183a53399e3e77dae75a1 Mon Sep 17 00:00:00 2001 From: Richard Fairhurst Date: Fri, 4 May 2007 17:07:27 +0000 Subject: [PATCH 1/1] started work on /diary --- app/controllers/diary_entry_controller.rb | 4 ++++ app/views/diary_entry/_diary_entry.rhtml | 2 ++ app/views/diary_entry/list.rhtml | 3 +++ app/views/layouts/site.rhtml | 1 + config/routes.rb | 1 + 5 files changed, 11 insertions(+) create mode 100644 app/views/diary_entry/list.rhtml diff --git a/app/controllers/diary_entry_controller.rb b/app/controllers/diary_entry_controller.rb index c25c8718d..a67ad575a 100644 --- a/app/controllers/diary_entry_controller.rb +++ b/app/controllers/diary_entry_controller.rb @@ -13,4 +13,8 @@ class DiaryEntryController < ApplicationController end end end + + def list + @entries=DiaryEntry.find(:all, :order => 'created_at DESC', :limit=>20) + end end diff --git a/app/views/diary_entry/_diary_entry.rhtml b/app/views/diary_entry/_diary_entry.rhtml index cf9115f6c..8808aab03 100644 --- a/app/views/diary_entry/_diary_entry.rhtml +++ b/app/views/diary_entry/_diary_entry.rhtml @@ -1,3 +1,5 @@ <%= diary_entry.title %>
<%= simple_format(diary_entry.body) %> +Posted by user <%= link_to diary_entry.user_id,"spong" %> at <%= diary_entry.created_at %>

+
diff --git a/app/views/diary_entry/list.rhtml b/app/views/diary_entry/list.rhtml new file mode 100644 index 000000000..0b2c59076 --- /dev/null +++ b/app/views/diary_entry/list.rhtml @@ -0,0 +1,3 @@ +

most recent posts:

+FIXME: geoRSS needed. Also proper user names and permalinks.

+<%= render :partial => 'diary_entry/diary_entry', :collection => @entries %> diff --git a/app/views/layouts/site.rhtml b/app/views/layouts/site.rhtml index f2cc5b4fe..c2e4c9bfc 100644 --- a/app/views/layouts/site.rhtml +++ b/app/views/layouts/site.rhtml @@ -68,6 +68,7 @@
Help & Wiki
+ <%= link_to "Users' diaries", {:controller => 'diary_entry', :action => 'list'} %>
News blog
Shop
diff --git a/config/routes.rb b/config/routes.rb index c739fac8e..407e102d6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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' -- 2.43.2