vrfs152: added dynamic fetching of facebook invited_user signup url

This commit is contained in:
Jonathan Kolyer 2014-01-29 22:49:36 -06:00
parent e839c8cb69
commit 13df76e136
4 changed files with 32 additions and 8 deletions

View File

@ -6,6 +6,7 @@
var rest = context.JK.Rest();
var waitForUserToStopTypingTimer;
var sendingEmail = false;
var fbInviteURL_ = null;
function trackMetrics(emails, googleInviteCount) {
var allInvitations = emails.length; // all email invites, regardless of how they got in the form
@ -185,15 +186,31 @@
}, {scope:'publish_stream'});
}
function fbInviteURL() {
if (fbInviteURL_ === null) {
$.ajax({
type: "GET",
async: false,
url: '/api/invited_users/facebook',
success: function(response) {
fbInviteURL_ = response['signup_url'];
},
error: app.ajaxError
});
}
return fbInviteURL_;
}
function show_feed_dialog() {
var obj = {
method: 'feed',
redirect_uri: 'http://jamkazamdev.local:3000/',
link: 'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
name: 'Facebook Dialogs',
caption: 'Reference Documentation',
description: 'Using Dialogs to interact with users.'
// redirect_uri: 'http://jamkazamdev.local:3000/',
link: fbInviteURL(), //'https://developers.facebook.com/docs/reference/dialogs/'
picture: 'http://jamkazam.com/assets/logo.png',
name: 'Join me on JamKazam',
caption: 'Play live music in real-time sessions with others over the Internet, as if in the same room.',
description: '',
actions: [{ name: 'Signup', link: fbInviteURL() }]
};
function fbFeedDialogCallback(response) {
console.log("feedback dialog closed: " + response['post_id'])

View File

@ -10,7 +10,11 @@ class ApiInvitedUsersController < ApiController
end
def show
@invited_user = InvitedUser.find(params[:id])
if 'facebook' == params[:id]
@invited_user = current_user.facebook_invite!
else
@invited_user = InvitedUser.find(params[:id])
end
end
def create

View File

@ -1,3 +1,4 @@
object @invited_user
attributes :id, :created_at, :updated_at, :email, :note, :accepted
attributes :id, :created_at, :updated_at, :email, :note, :accepted

View File

@ -1,3 +1,5 @@
object @invited_user
extends "api_invited_users/invited_user"
node :signup_url do @invited_user.generate_signup_url end