Skip to content
Extraits de code Groupes Projets
Valider 2409fd3f rédigé par danielvincent's avatar danielvincent
Parcourir les fichiers

user page doesn't give an error anymore. fixed visible_person_by_id to return...

user page doesn't give an error anymore.  fixed visible_person_by_id to return self.person instead of self
parent 539316a2
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -12,12 +12,11 @@ class PeopleController < ApplicationController
end
def show
@person= current_user.visible_person_by_id(params[:id])
@person_profile = @person.profile
@person_posts = Post.where(:person_id => @person.id).paginate :page => params[:page], :order => 'created_at DESC'
@person = current_user.visible_person_by_id(params[:id])
@profile = @person.profile
@posts = Post.find_all_by_person_id(@person.id).paginate :page => params[:page], :order => 'created_at DESC'
@latest_status_message = StatusMessage.newest_for(@person)
@post_count = @person_posts.count
@post_count = @posts.count
end
def destroy
......
......@@ -281,7 +281,7 @@ class User
end
def visible_person_by_id( id )
return self if id == self.id
return self.person if ensure_bson(id) == self.person.id
friends.detect{|x| x.id == ensure_bson( id ) }
end
......
......@@ -6,13 +6,13 @@
%h1
= @person.real_name
- unless @person.id == current_user.id
.button.right
= link_to 'remove friend', @person, :confirm => 'Are you sure?', :method => :delete
.right
= link_to 'remove friend', @person, :confirm => 'Are you sure?', :method => :delete, :class => "button"
%ul
-unless @person_posts.first.nil?
-unless @posts.first.nil?
%li
%i= "last seen: #{how_long_ago(@person_posts.first)}"
%i= "last seen: #{how_long_ago(@posts.first)}"
%li
%i= "friends since: #{how_long_ago(@person)}"
%li
......@@ -26,11 +26,11 @@
%span="posted: #{how_long_ago(@latest_status_message)}"
.span-20.last
- if @person.posts
- if @posts
%h3= "stream - #{@post_count} item(s)"
%ul#stream
- for post in @person_posts
- for post in @posts
= render type_partial(post), :post => post
= will_paginate @person_posts
= will_paginate @posts
- else
%h3 no posts to display!
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter