fixed the views for the friend finder
This commit is contained in:
parent
aa5bef0c3f
commit
93d69c4ec7
5 changed files with 12 additions and 10 deletions
|
|
@ -46,7 +46,8 @@ class ServicesController < ApplicationController
|
|||
|
||||
def finder
|
||||
service = current_user.services.where(:type => "Services::#{params[:provider].titleize}").first
|
||||
@friends = service ? service.finder(:remote => params[:remote]) : {}
|
||||
@friends = service ? service.finder(:remote => params[:remote]) : []
|
||||
pp @friends.class
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@ class Services::Facebook < Service
|
|||
person = Person.arel_table
|
||||
service_user = ServiceUser.arel_table
|
||||
if opts[:local]
|
||||
ServiceUser.joins(:person).where(:service_id => self.id).where(person[:owner_id].not_eq(nil))
|
||||
ServiceUser.joins(:person).where(:service_id => self.id).where(person[:owner_id].not_eq(nil)).all
|
||||
elsif opts[:remote]
|
||||
ServiceUser.joins(:person).where(:service_id => self.id).where(person[:owner_id].eq(nil))
|
||||
ServiceUser.joins(:person).where(:service_id => self.id).where(person[:owner_id].eq(nil)).all
|
||||
else
|
||||
self.service_users
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,4 +5,4 @@
|
|||
= search_field_tag :contact_search, "", :class => 'contact_list_search', :results => 5, :placeholder => t('shared.contact_list.all_contacts')
|
||||
%ul.friend_finder
|
||||
- for friend in friends
|
||||
= render :partial => 'services/remote_friend', :locals => {:friend => friend, :uid => friend.uid}
|
||||
= render :partial => 'services/remote_friend', :locals => {:friend => friend}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%li.remote_friend{:id => "uid_" + uid, :uid => uid}
|
||||
%li.remote_friend{:id => "uid_" + friend.uid, :uid => friend.uid}
|
||||
.right
|
||||
-if friend.contact && !friend.contact.pending
|
||||
= t('people.person.already_connected')
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
- elsif friend.invitation_id
|
||||
= t('invitations.new.already_invited')
|
||||
%br
|
||||
= link_to t('.resend'), service_inviter_path(:uid => uid, :provider => 'facebook', :invitation_id => friend.invitation_id)
|
||||
= link_to t('.resend'), service_inviter_path(:uid => friend.uid, :provider => 'facebook', :invitation_id => friend.invitation_id)
|
||||
- elsif friend.person
|
||||
= link_to t('people.show.start_sharing'),
|
||||
'#',
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
- elsif current_user.invites > 0
|
||||
= form_tag service_inviter_path(:provider => 'facebook') do
|
||||
= select_tag(:aspect_id, options_from_collection_for_select(@all_aspects, 'id', 'name'))
|
||||
= hidden_field_tag :uid, uid
|
||||
= hidden_field_tag :uid, friend.uid
|
||||
= submit_tag t('.invite')
|
||||
|
||||
- if friend.person
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
= friend.name
|
||||
|
||||
- unless friend.person.nil? || (friend.contact && friend.contact.pending) || (friend.request && friend.request.sender_id != friend.person.id)
|
||||
%li{:id => "options_" + uid, :class => "share_with hidden", :style => "height:auto"}
|
||||
%li{:id => "options_" + friend.uid, :class => "share_with hidden", :style => "height:auto"}
|
||||
- contact = friend.contact
|
||||
- contact ||= Contact.new
|
||||
= render :partial => 'contacts/share_with_list',
|
||||
|
|
|
|||
|
|
@ -87,8 +87,9 @@ describe ServicesController do
|
|||
@user.services << @service1
|
||||
@person = Factory(:person)
|
||||
@user.services.stub!(:where).and_return([@service1])
|
||||
@hash = {"facebook_id" => {:contact => @user.contact_for(bob.person), :name => "Robert Bobson", :person => bob.person},
|
||||
"facebook_id2" => {:name => "Robert Bobson2"}}
|
||||
@hash = [ ServiceUser.create(:contact => @user.contact_for(bob.person), :name => "Robert Bobson", :person => bob.person,
|
||||
:service => @service1, :uid => "321" ),
|
||||
ServiceUser.create(:name => "Robert Bobson", :service => @service1, :uid => "dsfasdfas")]
|
||||
@service1.should_receive(:finder).and_return(@hash)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue