Added start of individual post view and post lists view, wired upvoting functionality for individual posts

This commit is contained in:
Nathan Leniz
2015-03-03 22:03:33 +09:00
parent 94bbb7a4a5
commit 4b84b49d07
8 changed files with 307 additions and 26 deletions

View File

@@ -120,6 +120,27 @@ $(document).ready(function() {
$('#brief-instructions').show();
$('#long-instructions').hide();
});
var upvoteHandler = function () {
var _id = storyId;
$.ajax({
type: 'POST',
url: '/stories/upvote/' + _id,
beforeSend: function() {
$('#upvote').unbind('click');
},
error: function(xhr, textStatus, errorThrown) {
console.log('got error');
$('#upvote').bind('click', upvoteHandler);
},
success: function (data, textStatus, xhr) {
console.log(data);
$('#storyRank').text(data.rank);
}
});
};
$('#upvote').on('click', upvoteHandler);
});
var profileValidation = angular.module('profileValidation',['ui.bootstrap']);