From 7b85dcec9c9a47d30f890fd1a6263066c18aa9c6 Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Fri, 12 Aug 2011 15:05:58 -0700 Subject: [PATCH] dg rs; seed bob with facebook friends & fixed invitation view --- app/views/shared/_invitations.haml | 17 +++++++---------- app/views/shared/_right_sections.html.haml | 2 +- db/seeds.rb | 10 ++++------ spec/factories.rb | 7 +++++++ 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/app/views/shared/_invitations.haml b/app/views/shared/_invitations.haml index d3a726009..12c99f8ca 100644 --- a/app/views/shared/_invitations.haml +++ b/app/views/shared/_invitations.haml @@ -1,10 +1,7 @@ --if AppConfig[:open_invitations] - - if AppConfig.configured_services.include?('facebook') - - if defined? remote - = link_to t('.from_facebook'), friend_finder_path('facebook', :remote => remote), :rel => 'facebox' - -else - = link_to t('.from_facebook'), friend_finder_path('facebook'), :rel => 'facebox' - %br - = link_to t('.by_email'), new_user_invitation_path, :title => t('.invite_someone'), :rel => 'facebox' -- else - = t('.dont_have_now') +- if AppConfig.configured_services.include?('facebook') + - if defined? remote + = link_to t('.from_facebook'), friend_finder_path('facebook', :remote => remote), :rel => 'facebox' + -else + = link_to t('.from_facebook'), friend_finder_path('facebook'), :rel => 'facebox' + %br += link_to t('.by_email'), new_user_invitation_path, :title => t('.invite_someone'), :rel => 'facebox' diff --git a/app/views/shared/_right_sections.html.haml b/app/views/shared/_right_sections.html.haml index 00c4afafa..90923488d 100644 --- a/app/views/shared/_right_sections.html.haml +++ b/app/views/shared/_right_sections.html.haml @@ -3,7 +3,7 @@ -# the COPYRIGHT file. -- unless AppConfig[:invites_off] +- if AppConfig[:open_invitations] .section .title = image_tag('/images/icons/plus.png') diff --git a/db/seeds.rb b/db/seeds.rb index eb165a208..53e29fd9a 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -39,12 +39,10 @@ connect_users(bob, bob.aspects.first, alice, alice.aspects.first) connect_users(bob, bob.aspects.first, eve, eve.aspects.first) puts "done!" -# Uncomment these and return out of Service::Facebook#save_friends -#service = Service.new(:user_id => bob.id) -#service.type = "Services::Facebook" -#service.access_token = "abc123" -#service.save! -#su = ServiceUser.create!(:service_id => service.id, :photo_url => "/images/user/angela.jpg", :uid => "abc123", :name => "Angelica") +print "Adding Facebook contacts... " +facebook = Factory(:service, :type => 'Services::Facebook', :user_id => bob.id) +ServiceUser.import((1..10).map{|n| Factory.build(:service_user, :service => facebook) }) +puts "done!" require 'spec/support/fake_resque' require 'spec/support/fake_redis' diff --git a/spec/factories.rb b/spec/factories.rb index 4e8b4281d..e5bca7665 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -105,6 +105,13 @@ Factory.define :service do |service| service.sequence(:access_secret) { |token| "98765#{token}" } end +Factory.define :service_user do |s_user| + s_user.sequence(:uid) { |id| "a#{id}"} + s_user.sequence(:name) { |num| "Rob Fergus the #{num.ordinalize}" } + s_user.association :service + s_user.photo_url "/images/user/adams.jpg" +end + Factory.define(:comment) do |comment| comment.sequence(:text) {|n| "#{n} cats"} comment.association(:author, :factory => :person)