diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 688ddb10b..7745ace96 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -66,4 +66,9 @@ module ApplicationHelper def post_yield_tag(post) (':' + post.id.to_s).to_sym end + + def connected_fb_as token + response_hash = MiniFB.get(token, 'me') + "Connected to facebook as #{response_hash[:name]}" + end end diff --git a/app/views/shared/_publisher.haml b/app/views/shared/_publisher.haml index 5db168f6f..d1ad995df 100644 --- a/app/views/shared/_publisher.haml +++ b/app/views/shared/_publisher.haml @@ -10,7 +10,7 @@ %p %label{:for => "status_message_message"} Message = f.text_area :message, :rows => 2, :value => params[:prefill] - = "going to Facebook as #{MiniFB.get(@access_token, 'me')[:name]}" if @logged_in && @aspect == :public + = connected_fb_as(@access_token) if @logged_in && @aspect == :public = f.hidden_field( :public, :value => (params[:action] == 'public') ) %ul.aspect_selector{ :style => "display:none;"} diff --git a/app/views/users/_services.haml b/app/views/users/_services.haml index c6e31939a..f2d976a79 100644 --- a/app/views/users/_services.haml +++ b/app/views/users/_services.haml @@ -8,20 +8,16 @@ %h3 Facebook %p - if @logged_in - Connected to facebook as - - @response_hash = MiniFB.get(@access_token, 'me') - = @response_hash[:name] - + = connected_fb_as(@access_token) + + %p - @fb_friends = MiniFB.get(@access_token, 'me', :type => "friends") - @fb_friends[:data].each do |friend| = image_tag( "http://graph.facebook.com/#{friend[:id]}/picture" ) - - form_tag "/services/fb_post" do - = text_area_tag "message" - = submit_tag "send it off" = link_to "Disconnect from Facebook", services_destroy_path - else - = link_to "Connect to Facebook", @fb_access_url + = link_to "Connect to Facebook (DO NOT USE WITH A REAL ACCOUNT)", @fb_access_url #content_bottom .back