2013-05-29 12:17:44 -04:00
|
|
|
(function() {
|
|
|
|
|
var yourid = templates.get('yourid'),
|
2013-06-05 16:01:26 -04:00
|
|
|
theirid = templates.get('theirid'),
|
2013-06-17 15:25:09 -04:00
|
|
|
isFollowing = templates.get('isFollowing');
|
2013-05-29 12:17:44 -04:00
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
|
|
|
|
|
var rep = $('#reputation');
|
|
|
|
|
rep.html(app.addCommas(rep.html()));
|
|
|
|
|
|
|
|
|
|
var postcount = $('#postcount');
|
|
|
|
|
postcount.html(app.addCommas(postcount.html()));
|
|
|
|
|
|
|
|
|
|
var editLink = $('#editLink');
|
2013-06-17 15:25:09 -04:00
|
|
|
var followBtn = $('#follow-btn');
|
|
|
|
|
|
2013-05-29 12:17:44 -04:00
|
|
|
if( yourid !== theirid) {
|
|
|
|
|
editLink.hide();
|
2013-06-17 15:25:09 -04:00
|
|
|
if(isFollowing)
|
|
|
|
|
followBtn.hide();
|
2013-05-29 12:17:44 -04:00
|
|
|
else
|
2013-06-17 15:25:09 -04:00
|
|
|
followBtn.show();
|
2013-05-29 12:17:44 -04:00
|
|
|
}
|
|
|
|
|
else {
|
2013-06-17 15:25:09 -04:00
|
|
|
followBtn.hide();
|
2013-05-29 12:17:44 -04:00
|
|
|
}
|
|
|
|
|
|
2013-06-17 15:25:09 -04:00
|
|
|
followBtn.on('click', function() {
|
|
|
|
|
$.post('/users/follow', {uid: theirid},
|
2013-05-29 12:17:44 -04:00
|
|
|
function(data) {
|
2013-06-17 15:25:09 -04:00
|
|
|
followBtn.remove();
|
|
|
|
|
$('#user-action-alert').html('You are now following'+ $('.account-username').text() +'!').show();
|
2013-05-29 12:17:44 -04:00
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}());
|