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 ...@@ -12,12 +12,11 @@ class PeopleController < ApplicationController
end end
def show def show
@person= current_user.visible_person_by_id(params[:id]) @person = current_user.visible_person_by_id(params[:id])
@profile = @person.profile
@person_profile = @person.profile @posts = Post.find_all_by_person_id(@person.id).paginate :page => params[:page], :order => 'created_at DESC'
@person_posts = Post.where(:person_id => @person.id).paginate :page => params[:page], :order => 'created_at DESC'
@latest_status_message = StatusMessage.newest_for(@person) @latest_status_message = StatusMessage.newest_for(@person)
@post_count = @person_posts.count @post_count = @posts.count
end end
def destroy def destroy
......
...@@ -281,7 +281,7 @@ class User ...@@ -281,7 +281,7 @@ class User
end end
def visible_person_by_id( id ) 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 ) } friends.detect{|x| x.id == ensure_bson( id ) }
end end
......
...@@ -6,13 +6,13 @@ ...@@ -6,13 +6,13 @@
%h1 %h1
= @person.real_name = @person.real_name
- unless @person.id == current_user.id - unless @person.id == current_user.id
.button.right .right
= link_to 'remove friend', @person, :confirm => 'Are you sure?', :method => :delete = link_to 'remove friend', @person, :confirm => 'Are you sure?', :method => :delete, :class => "button"
%ul %ul
-unless @person_posts.first.nil? -unless @posts.first.nil?
%li %li
%i= "last seen: #{how_long_ago(@person_posts.first)}" %i= "last seen: #{how_long_ago(@posts.first)}"
%li %li
%i= "friends since: #{how_long_ago(@person)}" %i= "friends since: #{how_long_ago(@person)}"
%li %li
...@@ -26,11 +26,11 @@ ...@@ -26,11 +26,11 @@
%span="posted: #{how_long_ago(@latest_status_message)}" %span="posted: #{how_long_ago(@latest_status_message)}"
.span-20.last .span-20.last
- if @person.posts - if @posts
%h3= "stream - #{@post_count} item(s)" %h3= "stream - #{@post_count} item(s)"
%ul#stream %ul#stream
- for post in @person_posts - for post in @posts
= render type_partial(post), :post => post = render type_partial(post), :post => post
= will_paginate @person_posts = will_paginate @posts
- else - else
%h3 no posts to display! %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