Initial contacts_of_contact page
This commit is contained in:
parent
ec8aed12bb
commit
555a774668
7 changed files with 98 additions and 4 deletions
|
|
@ -109,6 +109,22 @@ class PeopleController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def contacts
|
||||||
|
@person = Person.find(params[:id])
|
||||||
|
if @person
|
||||||
|
@contact = current_user.contact_for(@person)
|
||||||
|
@aspect = :profile
|
||||||
|
@contacts_of_contact = @contact.contacts.paginate(:page => params[:page], :per_page => (params[:limit] || 15))
|
||||||
|
@hashes = hashes_for_people @contacts_of_contact, @aspects
|
||||||
|
@incoming_request = current_user.request_from(@person)
|
||||||
|
@contact = current_user.contact_for(@person)
|
||||||
|
@aspects_with_person = @contact.aspects
|
||||||
|
@aspect_ids = @aspects_with_person.map(&:id)
|
||||||
|
else
|
||||||
|
flash[:error] = I18n.t 'people.show.does_not_exist'
|
||||||
|
redirect_to people_path
|
||||||
|
end
|
||||||
|
end
|
||||||
private
|
private
|
||||||
def webfinger(account, opts = {})
|
def webfinger(account, opts = {})
|
||||||
Resque.enqueue(Job::SocketWebfinger, current_user.id, account, opts)
|
Resque.enqueue(Job::SocketWebfinger, current_user.id, account, opts)
|
||||||
|
|
|
||||||
59
app/views/people/contacts.haml
Normal file
59
app/views/people/contacts.haml
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
-# Copyright (c) 2010, Diaspora Inc. This file is
|
||||||
|
-# licensed under the Affero General Public License version 3 or later. See
|
||||||
|
-# the COPYRIGHT file.
|
||||||
|
|
||||||
|
|
||||||
|
- content_for :head do
|
||||||
|
= include_javascripts :people
|
||||||
|
|
||||||
|
- content_for :page_title do
|
||||||
|
= @person.name
|
||||||
|
|
||||||
|
.span-8.append-1.last
|
||||||
|
= render :partial => 'people/profile_sidebar', :locals => {:person => @person, :contact => @contact }
|
||||||
|
|
||||||
|
.span-15.last
|
||||||
|
#author_info
|
||||||
|
- if user_signed_in? && !(@contact.persisted? || current_user.person == @person)
|
||||||
|
.right
|
||||||
|
- if @incoming_request
|
||||||
|
= link_to t('.incoming_request', :name => truncate(@person.name, :length => 20, :separator => ' ', :omission => '')),
|
||||||
|
{:controller => "contacts",
|
||||||
|
:action => "new",
|
||||||
|
:person_id => @person.id},
|
||||||
|
:class => 'share_with button',
|
||||||
|
:rel => 'facebox'
|
||||||
|
-else
|
||||||
|
= link_to t('.start_sharing'),
|
||||||
|
{:controller => "contacts",
|
||||||
|
:action => "new",
|
||||||
|
:person_id => @person.id},
|
||||||
|
:class => 'share_with button',
|
||||||
|
:rel => 'facebox'
|
||||||
|
- if @share_with
|
||||||
|
= javascript_tag "$(document).ready(function() {jQuery.facebox({ ajax: '#{new_contact_path(:person_id => @person.id)}' });});"
|
||||||
|
|
||||||
|
|
||||||
|
- else
|
||||||
|
- if user_signed_in? && @contact.person && @contact.pending? == false
|
||||||
|
.right
|
||||||
|
= link_to t('people.show.mention'), new_status_message_path(:person_id => @person.id), :class => 'button', :rel => 'facebox'
|
||||||
|
= link_to t('people.show.message'), new_conversation_path(:contact_id => @contact.id, :name => @contact.person.name, :contact_id => @contact.id), :class => 'button', :rel => 'facebox'
|
||||||
|
|
||||||
|
%h3
|
||||||
|
= @person.name
|
||||||
|
%span.diaspora_handle
|
||||||
|
= @person.diaspora_handle
|
||||||
|
.description
|
||||||
|
- if !@person.profile.tag_string.blank?
|
||||||
|
= @person.profile.format_tags(@person.profile.tag_string)
|
||||||
|
- if user_signed_in? && @person == current_user.person
|
||||||
|
%span.hover_edit
|
||||||
|
= link_to t('.edit'), edit_profile_path
|
||||||
|
|
||||||
|
%hr
|
||||||
|
|
||||||
|
#people_stream.stream
|
||||||
|
- for hash in @hashes
|
||||||
|
= render :partial => 'people/person', :locals => hash
|
||||||
|
= will_paginate @contacts_of_contact
|
||||||
|
|
@ -13,14 +13,16 @@
|
||||||
= render :partial => 'people/profile_sidebar', :locals => {:person => @person, :contact => @contact }
|
= render :partial => 'people/profile_sidebar', :locals => {:person => @person, :contact => @contact }
|
||||||
|
|
||||||
- if user_signed_in? && @contact.persisted? && @contacts_of_contact.count > 0
|
- if user_signed_in? && @contact.persisted? && @contacts_of_contact.count > 0
|
||||||
.span-8.last
|
.span-8.last#contacts_of_contact
|
||||||
%hr{:style=>"width:300px;"}
|
%hr{:style=>"width:300px;"}
|
||||||
.section.contact_pictures
|
.section.contact_pictures
|
||||||
%h4
|
%h4
|
||||||
= @contacts_of_contact_count
|
= @contacts_of_contact_count
|
||||||
= t('.similar_contacts')
|
= t('.contacts_of_contact')
|
||||||
- for person in @contacts_of_contact
|
- for person in @contacts_of_contact
|
||||||
= person_image_link person
|
= person_image_link person
|
||||||
|
- if @contacts_of_contact.count > 25
|
||||||
|
%p.see_all= link_to t('.see_all'), person_path(@person)
|
||||||
|
|
||||||
.span-15.last
|
.span-15.last
|
||||||
#author_info
|
#author_info
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (c) 2010, Diaspora Inc. This file is
|
#.see_ Copyright (c) 2010, Diaspora Inc. This file is
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
|
|
@ -363,7 +363,8 @@ en:
|
||||||
not_connected: "You are not sharing with this person"
|
not_connected: "You are not sharing with this person"
|
||||||
recent_posts: "Recent Posts"
|
recent_posts: "Recent Posts"
|
||||||
recent_public_posts: "Recent Public Posts"
|
recent_public_posts: "Recent Public Posts"
|
||||||
similar_contacts: "similar contacts"
|
contacts_of_contact: "contacts"
|
||||||
|
see_all: "See all"
|
||||||
start_sharing: "start sharing"
|
start_sharing: "start sharing"
|
||||||
message: "Message"
|
message: "Message"
|
||||||
mention: "Mention"
|
mention: "Mention"
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ Diaspora::Application.routes.draw do
|
||||||
resources :status_messages
|
resources :status_messages
|
||||||
resources :photos
|
resources :photos
|
||||||
end
|
end
|
||||||
|
match '/people/:id/contacts' => 'people#contacts'
|
||||||
|
|
||||||
match '/people/by_handle' => 'people#retrieve_remote', :as => 'person_by_handle'
|
match '/people/by_handle' => 'people#retrieve_remote', :as => 'person_by_handle'
|
||||||
match '/auth/:provider/callback' => 'services#create'
|
match '/auth/:provider/callback' => 'services#create'
|
||||||
|
|
|
||||||
|
|
@ -2800,3 +2800,10 @@ h1.tag
|
||||||
:width 12px
|
:width 12px
|
||||||
:height 12px
|
:height 12px
|
||||||
:margin-left 0.5em
|
:margin-left 0.5em
|
||||||
|
|
||||||
|
#contacts_of_contact
|
||||||
|
.section
|
||||||
|
:margin
|
||||||
|
:bottom 4px
|
||||||
|
.see_all
|
||||||
|
:text-align center
|
||||||
|
|
|
||||||
|
|
@ -208,6 +208,14 @@ describe PeopleController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
describe '#contacts' do
|
||||||
|
it 'assigns the contacts of a person' do
|
||||||
|
contact = alice.contact_for(bob.person)
|
||||||
|
contacts = contact.contacts
|
||||||
|
get :contacts, :id => bob.person.id
|
||||||
|
assigns(:contacts_of_contact).should == contacts
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe '#webfinger' do
|
describe '#webfinger' do
|
||||||
it 'enqueues a webfinger job' do
|
it 'enqueues a webfinger job' do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue