diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb
index db15835f2..428bb58c7 100644
--- a/app/controllers/people_controller.rb
+++ b/app/controllers/people_controller.rb
@@ -12,6 +12,7 @@ class PeopleController < ApplicationController
@aspect = :search
@people = Person.search(params[:q]).paginate :page => params[:page], :per_page => 25, :order => 'created_at DESC'
+ @requests = Request.all(:to_id.in => @people.map{|p| p.id})
#only do it if it is an email address
if params[:q].try(:match, Devise.email_regexp)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index ae952d178..b5192caee 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -96,7 +96,13 @@ module ApplicationHelper
end
def person_image_tag(person)
- image_tag image_or_default(person), :class => "avatar", :alt => person.name, :title => person.name, "data-person_id" => person.id
+ "
".html_safe
+ end
+
+ def person_link(person)
+"
+ #{person.name}
+".html_safe
end
def image_or_default(person)
@@ -114,7 +120,9 @@ module ApplicationHelper
if opts[:to] == :photos
link_to person_image_tag(person), person_photos_path(person)
else
- link_to person_image_tag(person), person_path(person)
+"
+ #{person_image_tag(person)}
+".html_safe
end
end
diff --git a/app/helpers/sockets_helper.rb b/app/helpers/sockets_helper.rb
index 4f6bfaef6..0c61f4bf6 100644
--- a/app/helpers/sockets_helper.rb
+++ b/app/helpers/sockets_helper.rb
@@ -26,7 +26,14 @@ module SocketsHelper
}
v = render_to_string(:partial => 'shared/stream_element', :locals => post_hash)
elsif object.is_a? Person
- v = render_to_string(:partial => type_partial(object), :locals => {:single_aspect_form => opts[:single_aspect_form], :person => object, :aspects => user.aspects, :current_user => user})
+ person_hash = {
+ :single_aspect_form => opts[:single_aspect_form],
+ :person => object,
+ :aspects => user.aspects,
+ :contact => user.contact_for(object),
+ :request => user.request_for(object),
+ :current_user => user}
+ v = render_to_string(:partial => 'people/person', :locals => person_hash)
elsif object.is_a? Comment
v = render_to_string(:partial => 'comments/comment', :locals => {:hash => {:comment => object, :person => object.person}})
else
diff --git a/app/views/comments/_comment.html.haml b/app/views/comments/_comment.html.haml
index b59df96a4..4ebf4d455 100644
--- a/app/views/comments/_comment.html.haml
+++ b/app/views/comments/_comment.html.haml
@@ -4,11 +4,10 @@
- comment = hash[:comment]
- person = hash[:person]
%li.comment{:data=>{:guid=>comment.id}}
- %a{:href => "/people/#{person.id}"}
- %img{:src => image_or_default(person), :class => "avatar", :alt => person.name, :title => person.name, "data-person_id" => person.id}
+ =person_image_link(person)
.content
.from
- %a{:href => "/people/#{person.id}"}=person.name
+ =person_link(person)
= markdownify(comment.text, :youtube_maps => comment[:youtube_titles])
%div.time
= comment.created_at ? "#{time_ago_in_words(comment.created_at)} #{t('ago')}" : time_ago_in_words(Time.now)
diff --git a/app/views/people/_person.html.haml b/app/views/people/_person.html.haml
index 7c455a3bb..87bcdf756 100644
--- a/app/views/people/_person.html.haml
+++ b/app/views/people/_person.html.haml
@@ -8,14 +8,14 @@
.content
%span.from
- = link_to person.name, person_path(person)
+ =person_link(person)
.right{:style=>"display:inline;"}
- - if person.id == current_user.person.id
+ - if person.owner_id == current_user.id
= t('.thats_you')
- - elsif current_user.person_objects.include?(person)
+ - elsif contact
= t('.already_connected')
- - elsif current_user.request_for(person)
+ - elsif request
= link_to t('.pending_request'), aspects_manage_path
- else
- single_aspect_form ||= nil
diff --git a/app/views/people/index.html.haml b/app/views/people/index.html.haml
index a61655391..98f43fe40 100644
--- a/app/views/people/index.html.haml
+++ b/app/views/people/index.html.haml
@@ -9,6 +9,10 @@
%ul{:class => 'stream people', :id => 'people_stream'}
- for person in @people
- = render 'people/person', :person => person, :aspects => @aspects
+ = render 'people/person',
+ :person => person,
+ :aspects => @aspects,
+ :contact => @contacts.detect{|contact| contact.person_id == person.id},
+ :request => @requests.detect{|request| request.to_id == person.id}
= will_paginate @people
diff --git a/app/views/shared/_stream_element.html.haml b/app/views/shared/_stream_element.html.haml
index b7849c999..f5bf3afc6 100644
--- a/app/views/shared/_stream_element.html.haml
+++ b/app/views/shared/_stream_element.html.haml
@@ -3,12 +3,10 @@
-# the COPYRIGHT file.
%li.message{:data=>{:guid=>post.id}}
- %a{:href => "/people/#{person.id}"}
- %img{:src => image_or_default(person), :class => "avatar", :alt => person.name, :title => person.name, "data-person_id" => person.id}
-
+ =person_image_link(person)
.content
.from
- %a{:href => "/people/#{person.id}"}=person.name
+ =person_link(person)
- if person.owner_id == current_user.id
.aspect
@@ -22,7 +20,7 @@
.right
- reshare_aspects = aspects_without_post(aspects, post)
- unless reshare_aspects.empty?
- = render 'shared/reshare', :current_user => current_user, :aspects => reshare_aspects, :post => post
+ = render 'shared/reshare', :aspects => reshare_aspects, :post => post
= link_to t('delete'), status_message_path(post), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :class => "delete"
= render 'status_messages/status_message', :post => post, :photos => photos