1 class DiaryEntryController < ApplicationController
2 layout 'site', :except => :rss
4 before_filter :authorize_web
5 before_filter :require_user, :only => [:new]
8 @title = 'new diary entry'
9 if params[:diary_entry]
10 @diary_entry = DiaryEntry.new(params[:diary_entry])
11 @diary_entry.user = @user
13 redirect_to :controller => 'diary_entry', :action => 'list', :display_name => @user.display_name
19 if params[:display_name]
20 @this_user = User.find_by_display_name(params[:display_name])
21 @title = @this_user.display_name + "'s diary"
23 @entries=DiaryEntry.find(:all, :conditions => ['user_id = ? AND id = ?', @this_user.id, params[:id]])
25 @entries=DiaryEntry.find(:all, :conditions => ['user_id = ?', @this_user.id], :order => 'created_at DESC')
28 @title = 'recent diary entries'
29 @entries=DiaryEntry.find(:all, :order => 'created_at DESC', :limit => 20)
34 if params[:display_name]
35 user = User.find_by_display_name(params[:display_name])
36 @entries = DiaryEntry.find(:all, :conditions => ['user_id = ?', user.id], :order => 'created_at DESC', :limit => 20)
37 @title = "OpenStreetMap diary entries for #{user.display_name}"
38 @description = "Recent OpenStreetmap diary entries from #{user.display_name}"
39 @link = "http://www.openstreetmap.org/user/#{user.display_name}/diary"
41 @entries = DiaryEntry.find(:all, :order => 'created_at DESC', :limit => 20)
42 @title = "OpenStreetMap diary entries"
43 @description = "Recent diary entries from users of OpenStreetMap"
44 @link = "http://www.openstreetmap.org/diary"