wip, still need to auto hide, and expand on click the contact setting, styling, also would be nice to cache the friend list, and maybe on login queue up a job to refresh it

This commit is contained in:
zhitomirskiyi 2011-03-13 18:40:21 -07:00
parent 37fefc5bc9
commit 433db9fc8b
4 changed files with 64 additions and 31 deletions

View file

@ -21,8 +21,23 @@ class Services::Facebook < Service
def finder(opts = {})
Rails.logger.debug("event=friend_finder type=facebook sender_id=#{self.user_id}")
response = RestClient.get("https://graph.facebook.com/me/friends", {:params => {:access_token => self.access_token}})
data = JSON.parse(response.body)['data']
#RestClient.get("https://graph.facebook.com/me/friends", {:params => {:access_token => self.access_token}})
response = <<JSON
{
"data": [
{
"name": "Snow Crash",
"id": "12321"
},
{
"name": "Person to Invite",
"id": "abc123"
}
]
}
JSON
#data = JSON.parse(response.body)['data']
data = JSON.parse(response)['data']
data_h = {}
data.each do |d|

View file

@ -0,0 +1,34 @@
-# Copyright (c) 2010, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
.aspect_list#aspects_list{:data=> {:contact_id=> (contact ? contact.id : nil)}}
%ul
- for aspect in aspects_with_person
= render :partial => 'aspects/aspect_list_item',
:locals => {:aspect => aspect, :person => person,
:contact => contact}
- for aspect in aspects_without_person
= render :partial => 'aspects/aspect_list_item',
:locals => {:aspect => aspect, :person => person,
:contact => contact}
.add_aspect
= form_for(Aspect.new, :remote => true) do |aspect|
.right
= aspect.submit t('.add_new_aspect'), :class => 'button'
= aspect.error_messages
= aspect.hidden_field :person_id, :value => person.id if person
= aspect.hidden_field :contact_id, :value => contact.id if contact
= aspect.hidden_field :share_with, :value => true
%p
= aspect.text_field :name, :style => "display:inline;"
%p.checkbox_select
= aspect.label :contacts_visible, t('aspects.edit.make_aspect_list_visible')
= aspect.check_box :contacts_visible, :checked => true, :default => true
-unless friend_finder ||= false
.done
.right
= link_to t('aspects.aspect_contacts.done_editing'), "#", :class => "button", :onClick => '$.facebox.close();'
- if contact
= link_to t('people.profile_sidebar.remove_contact'), contact, :confirm => t('are_you_sure'), :method => :delete

View file

@ -11,32 +11,7 @@
= t('.accepts', :name => person.first_name)
.aspect_list#aspects_list{:data=> {:contact_id=> (contact ? contact.id : nil)}}
%ul
- for aspect in aspects_with_person
= render :partial => 'aspects/aspect_list_item',
:locals => {:aspect => aspect, :person => person,
:contact => contact}
- for aspect in aspects_without_person
= render :partial => 'aspects/aspect_list_item',
:locals => {:aspect => aspect, :person => person,
:contact => contact}
.add_aspect
= form_for(Aspect.new, :remote => true) do |aspect|
.right
= aspect.submit t('.add_new_aspect'), :class => 'button'
= aspect.error_messages
= aspect.hidden_field :person_id, :value => person.id if person
= aspect.hidden_field :contact_id, :value => contact.id if contact
= aspect.hidden_field :share_with, :value => true
%p
= aspect.text_field :name, :style => "display:inline;"
%p.checkbox_select
= aspect.label :contacts_visible, t('aspects.edit.make_aspect_list_visible')
= aspect.check_box :contacts_visible, :checked => true, :default => true
.done
.right
= link_to t('aspects.aspect_contacts.done_editing'), "#", :class => "button", :onClick => '$.facebox.close();'
- if contact
= link_to t('people.profile_sidebar.remove_contact'), contact, :confirm => t('are_you_sure'), :method => :delete
= render :partial => 'contacts/share_with_list',
:locals => {:person => person, :contact => contact,
:aspects_with_person => aspects_with_person,
:aspects_without_person => aspects_without_person}

View file

@ -39,3 +39,12 @@
= link_to friend[:name], person_path(friend[:person])
- else
= friend[:name]
%li{:style => "height:400px"}
- if friend[:person]
= render :partial => 'contacts/share_with_list',
:locals => {:person => friend[:person],
:contact => Contact.new,
:aspects_with_person => [],
:aspects_without_person => current_user.aspects,
:friend_finder => true}