challenge prize: add to challenge creation form (including min/max validation)

This commit is contained in:
Tyler Renelle
2013-10-31 11:44:50 -07:00
parent 6c63608f83
commit 13fa947c57
5 changed files with 20 additions and 6 deletions

View File

@@ -28,6 +28,12 @@ habitrpg.controller("ChallengesCtrl", ['$scope', 'User', 'Challenges', 'Notifica
(typeof $scope.search._isMember == 'undefined' || $scope.search._isMember == chal._isMember));
}
$scope.$watch('newChallenge.group', function(gid){
if (!gid) return;
var group = _.find($scope.groups, {_id:gid});
$scope.maxPrize = User.user.balance*4 + ((group && group.balance && group.leader==User.user._id) ? group.balance*4 : 0);
})
//------------------------------------------------------------
// Challenge