improve upvoting UX and start adding angular validation to submit-story view

This commit is contained in:
Michael Q Larson
2015-03-18 00:40:18 -07:00
parent e31bad4b27
commit af19ea4308
3 changed files with 23 additions and 14 deletions

View File

@@ -126,13 +126,7 @@ $(document).ready(function() {
$('#long-instructions').hide();
});
$('#upvote').on('click', upvoteHandler);
var upvoteHandler = function (event) {
event.preventDefault();
var $this = $(this);
$this.addClass('disabled');
$this.text('Upvoted!');
var upvoteHandler = function () {
var _id = storyId;
$('#upvote').unbind('click');
var alreadyUpvoted = false;
@@ -154,10 +148,14 @@ $(document).ready(function() {
$('#upvote').bind('click', upvoteHandler);
})
.done(function (data, textStatus, xhr) {
$('#storyRank').text(data.rank);
$('#upvote').text('Upvoted!').addClass('disabled');
$('#storyRank').text(data.rank + " points");
});
}
};
$('#upvote').on('click', upvoteHandler);
var storySubmitButtonHandler = function storySubmitButtonHandler() {
@@ -279,6 +277,12 @@ profileValidation.controller('doneWithFirst100HoursFormController', ['$scope',
}
]);
profileValidation.controller('submitStoryController', ['$scope',
function($scope) {
}
]);
profileValidation.directive('uniqueUsername',['$http',function($http) {
return {
restrict: 'A',