From 159d72c04c1d1f3c1cc6fc69f2e32b1c3eb5080d Mon Sep 17 00:00:00 2001 From: danielvincent <danielgrippi@gmail.com> Date: Wed, 22 Sep 2010 16:56:39 -0700 Subject: [PATCH] DG IZ; logged in as? --- app/controllers/application_controller.rb | 6 ++++++ app/views/users/edit.html.haml | 14 +++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f0ca5bfc84..0060a89893 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -9,6 +9,7 @@ class ApplicationController < ActionController::Base before_filter :set_friends_and_status, :except => [:create, :update] before_filter :count_requests + before_filter :fb_user_info layout :layout_by_resource @@ -37,4 +38,9 @@ class ApplicationController < ActionController::Base @request_count = Request.for_user(current_user).size if current_user end + def fb_user_info + @access_token = cookies[:access_token] + @logged_in = @access_token.present? + end + end diff --git a/app/views/users/edit.html.haml b/app/views/users/edit.html.haml index ddbc9c10a1..bfb4e92e1d 100644 --- a/app/views/users/edit.html.haml +++ b/app/views/users/edit.html.haml @@ -56,10 +56,18 @@ %br %br - %h3 Connect with Facebook - %p - = link_to "Login to Facebook", @fb_access_url + %h2 Services + + %h3 Facebook + + - if @logged_in + Logged in to facebook as + - @response_hash = MiniFB.get(@access_token, @id, :type => "user") + = @response_hash[:user][:name] + %p + = link_to "Login to Facebook", @fb_access_url + #submit_block = link_to "Cancel", root_path -- GitLab