diff options
author | danielgrippi <danielgrippi@gmail.com> | 2011-09-08 00:00:21 +0400 |
---|---|---|
committer | danielgrippi <danielgrippi@gmail.com> | 2011-09-08 00:00:21 +0400 |
commit | 184422607759d7147ecb24053a773c5f52843da4 (patch) | |
tree | 6f1be2ace0f273de94ba7dc5206da21be1b24219 | |
parent | 85c64504acfb153cef6ffd803c88be005f44a7bd (diff) |
paginate facebook friends.
-rw-r--r-- | app/controllers/services_controller.rb | 2 | ||||
-rw-r--r-- | app/views/services/finder.html.haml | 4 | ||||
-rw-r--r-- | db/seeds.rb | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/app/controllers/services_controller.rb b/app/controllers/services_controller.rb index 3e96a1a74..6e15634e4 100644 --- a/app/controllers/services_controller.rb +++ b/app/controllers/services_controller.rb @@ -50,7 +50,7 @@ class ServicesController < ApplicationController def finder @finder = true 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]).paginate( :page => params[:page], :per_page => 15) : [] end def inviter diff --git a/app/views/services/finder.html.haml b/app/views/services/finder.html.haml index e76190e31..7f4e662e4 100644 --- a/app/views/services/finder.html.haml +++ b/app/views/services/finder.html.haml @@ -12,14 +12,14 @@ = render 'shared/contact_sidebar' .span-18.last.searchable - = search_field_tag :contact_search, "", :id => "contact_list_search", :class => 'contact_list_search', :results => 5, :placeholder => t('search') + /= search_field_tag :contact_search, "", :id => "contact_list_search", :class => 'contact_list_search', :results => 5, :placeholder => t('search') %h3 = t('.service_friends', :service => params[:provider].titleize) #people_stream.stream.contacts - if @friends.size > 0 = render :partial => 'remote_friend', :collection => @friends, :as => :friend - /= will_paginate @friends + = will_paginate @friends - else .no_contacts = link_to(image_tag("social_media_logos/facebook-48x48.png"), "/auth/facebook") diff --git a/db/seeds.rb b/db/seeds.rb index 1043a2456..75b7853a5 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -41,12 +41,12 @@ puts "done!" print "Adding Facebook contacts... " bob_facebook = Factory(:service, :type => 'Services::Facebook', :user_id => bob.id, :uid => bob.username) -ServiceUser.import((1..10).map{|n| Factory.build(:service_user, :service => bob_facebook)} + +ServiceUser.import((1..40).map{|n| Factory.build(:service_user, :service => bob_facebook)} + [Factory.build(:service_user, :service => bob_facebook, :uid => eve.username, :person => eve.person, :contact => bob.contact_for(eve.person))]) eve_facebook = Factory(:service, :type => 'Services::Facebook', :user_id => eve.id, :uid => eve.username) -ServiceUser.import((1..10).map{|n| Factory.build(:service_user, :service => eve_facebook) } + +ServiceUser.import((1..40).map{|n| Factory.build(:service_user, :service => eve_facebook) } + [Factory.build(:service_user, :service => eve_facebook, :uid => bob.username, :person => bob.person, :contact => eve.contact_for(bob.person))]) |