+ if params[:display_name]
+ @this_user = User.find_by_display_name(params[:display_name], :conditions => { :status => ["active", "confirmed"] })
+
+ if @this_user
+ @title = t 'diary_entry.list.user_title', :user => @this_user.display_name
+ @entry_pages, @entries = paginate(:diary_entries,
+ :conditions => {
+ :user_id => @this_user.id,
+ :visible => true
+ },
+ :order => 'created_at DESC',
+ :per_page => 20)
+ else
+ @title = t'diary_entry.no_such_user.title'
+ @not_found_user = params[:display_name]
+
+ render :action => 'no_such_user', :status => :not_found
+ end
+ elsif params[:language]
+ @title = t 'diary_entry.list.in_language_title', :language => Language.find(params[:language]).english_name
+ @entry_pages, @entries = paginate(:diary_entries, :include => :user,
+ :conditions => {
+ :users => { :status => ["active", "confirmed"] },
+ :visible => true,
+ :language_code => params[:language]
+ },
+ :order => 'created_at DESC',
+ :per_page => 20)
+ else
+ @title = t 'diary_entry.list.title'
+ @entry_pages, @entries = paginate(:diary_entries, :include => :user,
+ :conditions => {
+ :users => { :status => ["active", "confirmed"] },
+ :visible => true
+ },
+ :order => 'created_at DESC',
+ :per_page => 20)
+ end