Revert "Added hide and error message when a user tries to create a challenge for..."

This commit is contained in:
Alys
2015-03-27 20:11:12 +10:00
parent f16ef869a3
commit 1202c624f1
3 changed files with 4 additions and 12 deletions

View File

@@ -46,6 +46,5 @@
"removeTasks": "Remove Tasks", "removeTasks": "Remove Tasks",
"keepTasks": "Keep Tasks", "keepTasks": "Keep Tasks",
"closeCha": "Close challenge and...", "closeCha": "Close challenge and...",
"leaveCha": "Leave challenge and...", "leaveCha": "Leave challenge and..."
"challengeNotEnoughGems": "You do not have enough gems to post this challenge."
} }

View File

@@ -45,7 +45,6 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
*/ */
$scope.save = function(challenge) { $scope.save = function(challenge) {
if (!challenge.group) return alert(window.env.t('selectGroup')); if (!challenge.group) return alert(window.env.t('selectGroup'));
if (!$scope.enoughGems) return alert(window.env.t('challengeNotEnoughGems'));
var isNew = !challenge._id; var isNew = !challenge._id;
challenge.$save(function(_challenge){ challenge.$save(function(_challenge){
if (isNew) { if (isNew) {
@@ -219,11 +218,7 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
if (!gid) return; if (!gid) return;
var group = _.find($scope.groups, {_id:gid}); 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); $scope.maxPrize = User.user.balance*4 + ((group && group.balance && group.leader==User.user._id) ? group.balance*4 : 0);
$scope.enoughGems = true; if (gid == 'habitrpg') $scope.newChallenge.prize = 1;
if (gid == 'habitrpg') {
$scope.newChallenge.prize = 1;
if ( $scope.maxPrize <= 0 ) $scope.enoughGems = false;
}
}) })
$scope.selectAll = function(){ $scope.selectAll = function(){

View File

@@ -116,11 +116,9 @@ script(type='text/ng-template', id='partials/options.social.challenges.html')
//- what's going on here? //- what's going on here?
br br
br br
div.alert.alert-warning(ng-hide="enoughGems")
=env.t('challengeNotEnoughGems')
.form-group
input.form-control(type='number', min="{{newChallenge.group=='habitrpg' ? 1 : 0}}", max="{{enoughGems ? maxPrize : null}}", ng-model='newChallenge.prize', placeholder=env.t('prize'), ng-show="enoughGems")
.form-group
input.form-control(type='number', min="{{newChallenge.group=='habitrpg' ? 1 : 0}}", max="{{maxPrize}}", ng-model='newChallenge.prize', placeholder=env.t('prize'))
span.input-suffix.Pet_Currency_Gem1x.inline-gems span.input-suffix.Pet_Currency_Gem1x.inline-gems
|&nbsp; |&nbsp;
span.hint.vertical-20(popover=env.t('prizePop'), popover-trigger='mouseenter', popover-placement='right') span.hint.vertical-20(popover=env.t('prizePop'), popover-trigger='mouseenter', popover-placement='right')