Clean up people/person
This commit is contained in:
parent
93bbfd19d2
commit
f44b02e22c
4 changed files with 18 additions and 6 deletions
|
|
@ -12,6 +12,7 @@ class PeopleController < ApplicationController
|
||||||
@aspect = :search
|
@aspect = :search
|
||||||
|
|
||||||
@people = Person.search(params[:q]).paginate :page => params[:page], :per_page => 25, :order => 'created_at DESC'
|
@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
|
#only do it if it is an email address
|
||||||
if params[:q].try(:match, Devise.email_regexp)
|
if params[:q].try(:match, Devise.email_regexp)
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,14 @@ module SocketsHelper
|
||||||
}
|
}
|
||||||
v = render_to_string(:partial => 'shared/stream_element', :locals => post_hash)
|
v = render_to_string(:partial => 'shared/stream_element', :locals => post_hash)
|
||||||
elsif object.is_a? Person
|
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
|
elsif object.is_a? Comment
|
||||||
v = render_to_string(:partial => 'comments/comment', :locals => {:hash => {:comment => object, :person => object.person}})
|
v = render_to_string(:partial => 'comments/comment', :locals => {:hash => {:comment => object, :person => object.person}})
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -8,14 +8,14 @@
|
||||||
|
|
||||||
.content
|
.content
|
||||||
%span.from
|
%span.from
|
||||||
= link_to person.real_name, person_path(person)
|
=person_link(person)
|
||||||
|
|
||||||
.right{:style=>"display:inline;"}
|
.right{:style=>"display:inline;"}
|
||||||
- if person.id == current_user.person.id
|
- if person.owner_id == current_user.id
|
||||||
= t('.thats_you')
|
= t('.thats_you')
|
||||||
- elsif current_user.person_objects.include?(person)
|
- elsif contact
|
||||||
= t('.already_connected')
|
= t('.already_connected')
|
||||||
- elsif current_user.request_for(person)
|
- elsif request
|
||||||
= link_to t('.pending_request'), aspects_manage_path
|
= link_to t('.pending_request'), aspects_manage_path
|
||||||
- else
|
- else
|
||||||
- single_aspect_form ||= nil
|
- single_aspect_form ||= nil
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@
|
||||||
|
|
||||||
%ul{:class => 'stream people', :id => 'people_stream'}
|
%ul{:class => 'stream people', :id => 'people_stream'}
|
||||||
- for person in @people
|
- 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
|
= will_paginate @people
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue