Skip to content

Commit

Permalink
Resend button is functional on Friend Finder page, fixes #16
Browse files Browse the repository at this point in the history
  • Loading branch information
edorcutt committed May 5, 2013
1 parent 18b59bb commit 5a7250d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 12 deletions.
3 changes: 3 additions & 0 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ <h3>Forever is linked to your personal cloud</h3>
============================================ -->
<div id="view-finder" class="view row-fluid" style="display:none;">
<div class="span12">
<div id="alert-finder-success" class="alert alert-success" style="display:none;margin-left:0px;">
Your Forever Invitation has been sent</br>
</div>
<form class="form-finder form-inline">
<input type="text" name="inviteName" id="inviteName" placeholder="Name" required autofocus>
<input type="email" name="inviteEmail" id="inviteEmail" placeholder="Email" required>
Expand Down
44 changes: 32 additions & 12 deletions app/js/forever.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ $(document).ready(function() {
val.name +
'<button class="btn btn-mini btn-danger btn-finder-action btn-finder-action-revoke pull-right" data-token="'+
val.token + '">Revoke</button>' +
'<button class="btn btn-mini btn-primary btn-finder-action pull-right">Resend</button>' +
'<button class="btn btn-mini btn-primary btn-finder-action btn-finder-action-resend pull-right" data-token="'+
val.token + '" data-name="'+val.name+'" data-email="'+val.email+'">Resend</button>' +
'</td></tr>';
$('#table-finder').prepend(newRow);
})
Expand Down Expand Up @@ -314,26 +315,45 @@ $(document).ready(function() {
json.name +
'<button class="btn btn-mini btn-danger btn-finder-action btn-finder-action-revoke pull-right" data-token="'+
json.token + '">Revoke</button>' +
'<button class="btn btn-mini btn-primary btn-finder-action pull-right">Resend</button>' +
'<button class="btn btn-mini btn-primary btn-finder-action btn-finder-action-resend pull-right" data-token="'+
json.token + '" data-name="'+json.name+'" data-email="'+json.email+'">Resend</button>' +
'</td></tr>';
$('#table-finder').prepend(newRow);
$('#modalSpinner').hide();
})

// --------------------------------------------
// send invitation email
var subject = "Kynetx Forever Invitation";
var myName = $('#myProfileName').val();
var body = myName + " has invited you to Forever, an evergreen addressbook based on Personal Clouds. Follow the link below to accept the invitation.\n\n" +
"http://forevr.us/?invite=" + json.token;
CloudOS_Send_Email(ename, email, subject, body,
function(json) {
console.dir(json);
})
sendForeverInvitation(ename, email, json.token)
}
);
})

// --------------------------------------------
function sendForeverInvitation(name, email, token) {
var subject = "Kynetx Forever Invitation";
var myName = $('#myProfileName').val();
var body = myName + " has invited you to Forever, an evergreen addressbook based on Personal Clouds. Follow the link below to accept the invitation.\n\n" +
"http://forevr.us/?invite=" + token;

CloudOS_Send_Email(name, email, subject, body,
function(json) {
console.dir(json);
$('#alert-finder-success').show('fast').delay(7000).hide('fast')
})
}

// --------------------------------------------
// Finder Resend Invitation
$('#table-finder').on('click','button.btn-finder-action-resend',
function(event){
var token = $(this).attr('data-token');
var name = $(this).attr('data-name');
var email = $(this).attr('data-email');
console.debug("resend token: ", token);

sendForeverInvitation(name, email, token)
}
)

// --------------------------------------------
// Finder Revoke Invitation
$('#table-finder').on('click','button.btn-finder-action-revoke',
Expand Down

0 comments on commit 5a7250d

Please sign in to comment.