facebook app link handling

- allow unregistered users to see the app page
- add link to app on profile page

Change-Id: Ia2ce213370ee8cc80e77bd5d01dc01165006fa38
Reviewed-on: https://gerrit.instructure.com/3595
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
This commit is contained in:
Brian Whitmer 2011-05-11 09:27:22 -06:00
parent 4465b1fc7b
commit e18af782d1
3 changed files with 17 additions and 7 deletions

View File

@ -123,11 +123,6 @@ class FacebookController < ApplicationController
@service = UserService.find_by_service_and_service_user_id('facebook', @facebook_user_id)
@user = @service && @service.user
session[:facebook_user_id] = @facebook_user_id
return true
else
flash[:error] = "Cannot find matching Facebook user"
redirect_to dashboard_url
return false
end
end
end

View File

@ -221,6 +221,14 @@ class UserService < ActiveRecord::Base
end
end
def service_access_link
if service == 'facebook' && Facebook.config && Facebook.config['canvas_name']
"https://apps.facebook.com/#{Facebook.config['canvas_name']}"
else
service_user_link
end
end
def service_user_link
case service
when 'google_docs'

View File

@ -220,8 +220,10 @@ you already use. Click any of the services in "Other Services" to see what we m
<% @user.user_services.select{|s| !UserService.configured_service?(s.service) || feature_and_service_enabled?(s.service) }.each do |service| %>
<li class="service" id="service_<%= service.service %>">
<a href="<%= profile_user_service_url(service.id) %>" class="delete_service_link no-hover" style="float: right; padding-top: 0.5em; padding-right: 10px;" title="Unregister Service"><%= image_tag "delete_circle.png" %></a>
<%= image_tag "#{service.service}.png", :style => "vertical-align: middle; float: left;" %>
<div style="float: left; margin-top: 0.5em; padding-left: 5px;">
<a href="<%= service.service_access_link %>">
<%= image_tag "#{service.service}.png", :style => "vertical-align: middle; float: left;" %>
</a>
<div style="float: left; padding-left: 5px;">
<%= service.service.titleize rescue "Unknown" %>
<div style="font-size: 0.6em; line-height: 0.5em;">
<% if service.has_profile_link? %>
@ -231,6 +233,11 @@ you already use. Click any of the services in "Other Services" to see what we m
<% elsif service.has_readable_user_name? %>
<span><%= service.service_user_name %></span>
<% end %>
<% if service.service == 'facebook' && feature_and_service_enabled?(:facebook) && Facebook.config['canvas_name'] %>
<div>
<a href="<%= service.service_access_link %>">view the Facebook app</a>
</div>
<% end %>
</div>
</div>
<div class="clear"></div>